7 struct btrfs_trans_handle
;
8 struct btrfs_transaction
;
10 #define BTRFS_MAGIC "_BtRfS_M"
12 #define BTRFS_ROOT_TREE_OBJECTID 1ULL
13 #define BTRFS_EXTENT_TREE_OBJECTID 2ULL
14 #define BTRFS_INODE_MAP_OBJECTID 3ULL
15 #define BTRFS_FS_TREE_OBJECTID 4ULL
16 #define BTRFS_FIRST_FREE_OBJECTID 5ULL
19 * we can actually store much bigger names, but lets not confuse the rest
22 #define BTRFS_NAME_LEN 255
25 * the key defines the order in the tree, and so it also defines (optimal)
26 * block layout. objectid corresonds to the inode number. The flags
27 * tells us things about the object, and is a kind of stream selector.
28 * so for a given inode, keys with flags of 1 might refer to the inode
29 * data, flags of 2 may point to file data in the btree and flags == 3
30 * may point to extents.
32 * offset is the starting byte offset for this key in the stream.
34 * btrfs_disk_key is in disk byte order. struct btrfs_key is always
35 * in cpu native order. Otherwise they are identical and their sizes
36 * should be the same (ie both packed)
38 struct btrfs_disk_key
{
42 } __attribute__ ((__packed__
));
48 } __attribute__ ((__packed__
));
51 * every tree block (leaf or node) starts with this header.
54 u8 fsid
[16]; /* FS specific uuid */
55 __le64 blocknr
; /* which block this node is supposed to live in */
57 __le64 parentid
; /* objectid of the tree root */
63 } __attribute__ ((__packed__
));
65 #define BTRFS_MAX_LEVEL 8
66 #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->blocksize - \
67 sizeof(struct btrfs_header)) / \
68 (sizeof(struct btrfs_disk_key) + sizeof(u64)))
69 #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
70 #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
74 * the super block basically lists the main trees of the FS
75 * it currently lacks any block count etc etc
77 struct btrfs_super_block
{
78 u8 fsid
[16]; /* FS specific uuid */
79 __le64 blocknr
; /* this block number */
87 __le64 root_dir_objectid
;
88 } __attribute__ ((__packed__
));
91 * A leaf is full of items. offset and size tell us where to find
92 * the item in the leaf (relative to the start of the data area)
95 struct btrfs_disk_key key
;
98 } __attribute__ ((__packed__
));
101 * leaves have an item area and a data area:
102 * [item0, item1....itemN] [free space] [dataN...data1, data0]
104 * The data is separate from the items to get the keys closer together
108 struct btrfs_header header
;
109 struct btrfs_item items
[];
110 } __attribute__ ((__packed__
));
113 * all non-leaf blocks are nodes, they hold only keys and pointers to
116 struct btrfs_key_ptr
{
117 struct btrfs_disk_key key
;
119 } __attribute__ ((__packed__
));
122 struct btrfs_header header
;
123 struct btrfs_key_ptr ptrs
[];
124 } __attribute__ ((__packed__
));
127 * btrfs_paths remember the path taken from the root down to the leaf.
128 * level 0 is always the leaf, and nodes[1...BTRFS_MAX_LEVEL] will point
129 * to any other levels that are present.
131 * The slots array records the index of the item or block pointer
132 * used while walking the tree.
135 struct buffer_head
*nodes
[BTRFS_MAX_LEVEL
];
136 int slots
[BTRFS_MAX_LEVEL
];
140 * items in the extent btree are used to record the objectid of the
141 * owner of the block and the number of references
143 struct btrfs_extent_item
{
146 } __attribute__ ((__packed__
));
148 struct btrfs_inode_timespec
{
151 } __attribute__ ((__packed__
));
154 * there is no padding here on purpose. If you want to extent the inode,
155 * make a new item type
157 struct btrfs_inode_item
{
168 struct btrfs_inode_timespec atime
;
169 struct btrfs_inode_timespec ctime
;
170 struct btrfs_inode_timespec mtime
;
171 struct btrfs_inode_timespec otime
;
172 } __attribute__ ((__packed__
));
174 /* inline data is just a blob of bytes */
175 struct btrfs_inline_data_item
{
177 } __attribute__ ((__packed__
));
179 struct btrfs_dir_item
{
184 } __attribute__ ((__packed__
));
186 struct btrfs_root_item
{
192 } __attribute__ ((__packed__
));
194 struct btrfs_file_extent_item
{
197 * disk space consumed by the extent, checksum blocks are included
201 __le64 disk_num_blocks
;
203 * the logical offset in file blocks (no csums)
204 * this extent record is for. This allows a file extent to point
205 * into the middle of an existing extent on disk, sharing it
206 * between two snapshots (useful if some bytes in the middle of the
207 * extent have changed
211 * the logical number of file blocks (no csums included)
214 } __attribute__ ((__packed__
));
216 struct btrfs_inode_map_item
{
217 struct btrfs_disk_key key
;
218 } __attribute__ ((__packed__
));
220 struct btrfs_fs_info
{
221 struct btrfs_root
*fs_root
;
222 struct btrfs_root
*extent_root
;
223 struct btrfs_root
*tree_root
;
224 struct btrfs_root
*inode_root
;
225 struct btrfs_key current_insert
;
226 struct btrfs_key last_insert
;
227 struct radix_tree_root pending_del_radix
;
228 struct radix_tree_root pinned_radix
;
229 u64 last_inode_alloc
;
230 u64 last_inode_alloc_dirid
;
232 struct btrfs_transaction
*running_transaction
;
233 struct btrfs_super_block
*disk_super
;
234 struct buffer_head
*sb_buffer
;
235 struct super_block
*sb
;
236 struct mutex trans_mutex
;
237 struct mutex fs_mutex
;
241 * in ram representation of the tree. extent_root is used for all allocations
242 * and for the extent tree extent_root root. current_insert is used
243 * only for the extent tree.
246 struct buffer_head
*node
;
247 struct buffer_head
*commit_root
;
248 struct btrfs_root_item root_item
;
249 struct btrfs_key root_key
;
250 struct btrfs_fs_info
*fs_info
;
256 /* the lower bits in the key flags defines the item type */
257 #define BTRFS_KEY_TYPE_MAX 256
258 #define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
261 * inode items have the data typically returned from stat and store other
262 * info about object characteristics. There is one for every file and dir in
265 #define BTRFS_INODE_ITEM_KEY 1
268 * dir items are the name -> inode pointers in a directory. There is one
269 * for every name in a directory.
271 #define BTRFS_DIR_ITEM_KEY 2
273 * inline data is file data that fits in the btree.
275 #define BTRFS_INLINE_DATA_KEY 3
277 * extent data is for data that can't fit in the btree. It points to
278 * a (hopefully) huge chunk of disk
280 #define BTRFS_EXTENT_DATA_KEY 4
282 * root items point to tree roots. There are typically in the root
283 * tree used by the super block to find all the other trees
285 #define BTRFS_ROOT_ITEM_KEY 5
287 * extent items are in the extent map tree. These record which blocks
288 * are used, and how many references there are to each block
290 #define BTRFS_EXTENT_ITEM_KEY 6
293 * the inode map records which inode numbers are in use and where
294 * they actually live on disk
296 #define BTRFS_INODE_MAP_ITEM_KEY 7
298 * string items are for debugging. They just store a short string of
301 #define BTRFS_STRING_ITEM_KEY 8
303 static inline u64
btrfs_inode_generation(struct btrfs_inode_item
*i
)
305 return le64_to_cpu(i
->generation
);
308 static inline void btrfs_set_inode_generation(struct btrfs_inode_item
*i
,
311 i
->generation
= cpu_to_le64(val
);
314 static inline u64
btrfs_inode_size(struct btrfs_inode_item
*i
)
316 return le64_to_cpu(i
->size
);
319 static inline void btrfs_set_inode_size(struct btrfs_inode_item
*i
, u64 val
)
321 i
->size
= cpu_to_le64(val
);
324 static inline u64
btrfs_inode_nblocks(struct btrfs_inode_item
*i
)
326 return le64_to_cpu(i
->nblocks
);
329 static inline void btrfs_set_inode_nblocks(struct btrfs_inode_item
*i
, u64 val
)
331 i
->nblocks
= cpu_to_le64(val
);
334 static inline u32
btrfs_inode_nlink(struct btrfs_inode_item
*i
)
336 return le32_to_cpu(i
->nlink
);
339 static inline void btrfs_set_inode_nlink(struct btrfs_inode_item
*i
, u32 val
)
341 i
->nlink
= cpu_to_le32(val
);
344 static inline u32
btrfs_inode_uid(struct btrfs_inode_item
*i
)
346 return le32_to_cpu(i
->uid
);
349 static inline void btrfs_set_inode_uid(struct btrfs_inode_item
*i
, u32 val
)
351 i
->uid
= cpu_to_le32(val
);
354 static inline u32
btrfs_inode_gid(struct btrfs_inode_item
*i
)
356 return le32_to_cpu(i
->gid
);
359 static inline void btrfs_set_inode_gid(struct btrfs_inode_item
*i
, u32 val
)
361 i
->gid
= cpu_to_le32(val
);
364 static inline u32
btrfs_inode_mode(struct btrfs_inode_item
*i
)
366 return le32_to_cpu(i
->mode
);
369 static inline void btrfs_set_inode_mode(struct btrfs_inode_item
*i
, u32 val
)
371 i
->mode
= cpu_to_le32(val
);
374 static inline u32
btrfs_inode_rdev(struct btrfs_inode_item
*i
)
376 return le32_to_cpu(i
->rdev
);
379 static inline void btrfs_set_inode_rdev(struct btrfs_inode_item
*i
, u32 val
)
381 i
->rdev
= cpu_to_le32(val
);
384 static inline u16
btrfs_inode_flags(struct btrfs_inode_item
*i
)
386 return le16_to_cpu(i
->flags
);
389 static inline void btrfs_set_inode_flags(struct btrfs_inode_item
*i
, u16 val
)
391 i
->flags
= cpu_to_le16(val
);
394 static inline u16
btrfs_inode_compat_flags(struct btrfs_inode_item
*i
)
396 return le16_to_cpu(i
->compat_flags
);
399 static inline void btrfs_set_inode_compat_flags(struct btrfs_inode_item
*i
,
402 i
->compat_flags
= cpu_to_le16(val
);
405 static inline u32
btrfs_timespec_sec(struct btrfs_inode_timespec
*ts
)
407 return le32_to_cpu(ts
->sec
);
410 static inline void btrfs_set_timespec_sec(struct btrfs_inode_timespec
*ts
,
413 ts
->sec
= cpu_to_le32(val
);
416 static inline u32
btrfs_timespec_nsec(struct btrfs_inode_timespec
*ts
)
418 return le32_to_cpu(ts
->nsec
);
421 static inline void btrfs_set_timespec_nsec(struct btrfs_inode_timespec
*ts
,
424 ts
->nsec
= cpu_to_le32(val
);
429 static inline u64
btrfs_extent_owner(struct btrfs_extent_item
*ei
)
431 return le64_to_cpu(ei
->owner
);
434 static inline void btrfs_set_extent_owner(struct btrfs_extent_item
*ei
, u64 val
)
436 ei
->owner
= cpu_to_le64(val
);
439 static inline u32
btrfs_extent_refs(struct btrfs_extent_item
*ei
)
441 return le32_to_cpu(ei
->refs
);
444 static inline void btrfs_set_extent_refs(struct btrfs_extent_item
*ei
, u32 val
)
446 ei
->refs
= cpu_to_le32(val
);
449 static inline u64
btrfs_node_blockptr(struct btrfs_node
*n
, int nr
)
451 return le64_to_cpu(n
->ptrs
[nr
].blockptr
);
454 static inline void btrfs_set_node_blockptr(struct btrfs_node
*n
, int nr
,
457 n
->ptrs
[nr
].blockptr
= cpu_to_le64(val
);
460 static inline u32
btrfs_item_offset(struct btrfs_item
*item
)
462 return le32_to_cpu(item
->offset
);
465 static inline void btrfs_set_item_offset(struct btrfs_item
*item
, u32 val
)
467 item
->offset
= cpu_to_le32(val
);
470 static inline u32
btrfs_item_end(struct btrfs_item
*item
)
472 return le32_to_cpu(item
->offset
) + le16_to_cpu(item
->size
);
475 static inline u16
btrfs_item_size(struct btrfs_item
*item
)
477 return le16_to_cpu(item
->size
);
480 static inline void btrfs_set_item_size(struct btrfs_item
*item
, u16 val
)
482 item
->size
= cpu_to_le16(val
);
485 static inline u64
btrfs_dir_objectid(struct btrfs_dir_item
*d
)
487 return le64_to_cpu(d
->objectid
);
490 static inline void btrfs_set_dir_objectid(struct btrfs_dir_item
*d
, u64 val
)
492 d
->objectid
= cpu_to_le64(val
);
495 static inline u16
btrfs_dir_flags(struct btrfs_dir_item
*d
)
497 return le16_to_cpu(d
->flags
);
500 static inline void btrfs_set_dir_flags(struct btrfs_dir_item
*d
, u16 val
)
502 d
->flags
= cpu_to_le16(val
);
505 static inline u8
btrfs_dir_type(struct btrfs_dir_item
*d
)
510 static inline void btrfs_set_dir_type(struct btrfs_dir_item
*d
, u8 val
)
515 static inline u16
btrfs_dir_name_len(struct btrfs_dir_item
*d
)
517 return le16_to_cpu(d
->name_len
);
520 static inline void btrfs_set_dir_name_len(struct btrfs_dir_item
*d
, u16 val
)
522 d
->name_len
= cpu_to_le16(val
);
525 static inline void btrfs_disk_key_to_cpu(struct btrfs_key
*cpu
,
526 struct btrfs_disk_key
*disk
)
528 cpu
->offset
= le64_to_cpu(disk
->offset
);
529 cpu
->flags
= le32_to_cpu(disk
->flags
);
530 cpu
->objectid
= le64_to_cpu(disk
->objectid
);
533 static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key
*disk
,
534 struct btrfs_key
*cpu
)
536 disk
->offset
= cpu_to_le64(cpu
->offset
);
537 disk
->flags
= cpu_to_le32(cpu
->flags
);
538 disk
->objectid
= cpu_to_le64(cpu
->objectid
);
541 static inline u64
btrfs_disk_key_objectid(struct btrfs_disk_key
*disk
)
543 return le64_to_cpu(disk
->objectid
);
546 static inline void btrfs_set_disk_key_objectid(struct btrfs_disk_key
*disk
,
549 disk
->objectid
= cpu_to_le64(val
);
552 static inline u64
btrfs_disk_key_offset(struct btrfs_disk_key
*disk
)
554 return le64_to_cpu(disk
->offset
);
557 static inline void btrfs_set_disk_key_offset(struct btrfs_disk_key
*disk
,
560 disk
->offset
= cpu_to_le64(val
);
563 static inline u32
btrfs_disk_key_flags(struct btrfs_disk_key
*disk
)
565 return le32_to_cpu(disk
->flags
);
568 static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key
*disk
,
571 disk
->flags
= cpu_to_le32(val
);
574 static inline u32
btrfs_key_type(struct btrfs_key
*key
)
576 return key
->flags
& BTRFS_KEY_TYPE_MASK
;
579 static inline u32
btrfs_disk_key_type(struct btrfs_disk_key
*key
)
581 return le32_to_cpu(key
->flags
) & BTRFS_KEY_TYPE_MASK
;
584 static inline void btrfs_set_key_type(struct btrfs_key
*key
, u32 type
)
586 BUG_ON(type
>= BTRFS_KEY_TYPE_MAX
);
587 key
->flags
= (key
->flags
& ~((u64
)BTRFS_KEY_TYPE_MASK
)) | type
;
590 static inline void btrfs_set_disk_key_type(struct btrfs_disk_key
*key
, u32 type
)
592 u32 flags
= btrfs_disk_key_flags(key
);
593 BUG_ON(type
>= BTRFS_KEY_TYPE_MAX
);
594 flags
= (flags
& ~((u64
)BTRFS_KEY_TYPE_MASK
)) | type
;
595 btrfs_set_disk_key_flags(key
, flags
);
598 static inline u64
btrfs_header_blocknr(struct btrfs_header
*h
)
600 return le64_to_cpu(h
->blocknr
);
603 static inline void btrfs_set_header_blocknr(struct btrfs_header
*h
, u64 blocknr
)
605 h
->blocknr
= cpu_to_le64(blocknr
);
608 static inline u64
btrfs_header_generation(struct btrfs_header
*h
)
610 return le64_to_cpu(h
->generation
);
613 static inline void btrfs_set_header_generation(struct btrfs_header
*h
,
616 h
->generation
= cpu_to_le64(val
);
619 static inline u64
btrfs_header_parentid(struct btrfs_header
*h
)
621 return le64_to_cpu(h
->parentid
);
624 static inline void btrfs_set_header_parentid(struct btrfs_header
*h
,
627 h
->parentid
= cpu_to_le64(parentid
);
630 static inline u16
btrfs_header_nritems(struct btrfs_header
*h
)
632 return le16_to_cpu(h
->nritems
);
635 static inline void btrfs_set_header_nritems(struct btrfs_header
*h
, u16 val
)
637 h
->nritems
= cpu_to_le16(val
);
640 static inline u16
btrfs_header_flags(struct btrfs_header
*h
)
642 return le16_to_cpu(h
->flags
);
645 static inline void btrfs_set_header_flags(struct btrfs_header
*h
, u16 val
)
647 h
->flags
= cpu_to_le16(val
);
650 static inline int btrfs_header_level(struct btrfs_header
*h
)
655 static inline void btrfs_set_header_level(struct btrfs_header
*h
, int level
)
657 BUG_ON(level
> BTRFS_MAX_LEVEL
);
661 static inline int btrfs_is_leaf(struct btrfs_node
*n
)
663 return (btrfs_header_level(&n
->header
) == 0);
666 static inline u64
btrfs_root_blocknr(struct btrfs_root_item
*item
)
668 return le64_to_cpu(item
->blocknr
);
671 static inline void btrfs_set_root_blocknr(struct btrfs_root_item
*item
, u64 val
)
673 item
->blocknr
= cpu_to_le64(val
);
676 static inline u32
btrfs_root_refs(struct btrfs_root_item
*item
)
678 return le32_to_cpu(item
->refs
);
681 static inline void btrfs_set_root_refs(struct btrfs_root_item
*item
, u32 val
)
683 item
->refs
= cpu_to_le32(val
);
686 static inline u64
btrfs_super_blocknr(struct btrfs_super_block
*s
)
688 return le64_to_cpu(s
->blocknr
);
691 static inline void btrfs_set_super_blocknr(struct btrfs_super_block
*s
, u64 val
)
693 s
->blocknr
= cpu_to_le64(val
);
696 static inline u64
btrfs_super_root(struct btrfs_super_block
*s
)
698 return le64_to_cpu(s
->root
);
701 static inline void btrfs_set_super_root(struct btrfs_super_block
*s
, u64 val
)
703 s
->root
= cpu_to_le64(val
);
706 static inline u64
btrfs_super_total_blocks(struct btrfs_super_block
*s
)
708 return le64_to_cpu(s
->total_blocks
);
711 static inline void btrfs_set_super_total_blocks(struct btrfs_super_block
*s
,
714 s
->total_blocks
= cpu_to_le64(val
);
717 static inline u64
btrfs_super_blocks_used(struct btrfs_super_block
*s
)
719 return le64_to_cpu(s
->blocks_used
);
722 static inline void btrfs_set_super_blocks_used(struct btrfs_super_block
*s
,
725 s
->blocks_used
= cpu_to_le64(val
);
728 static inline u32
btrfs_super_blocksize(struct btrfs_super_block
*s
)
730 return le32_to_cpu(s
->blocksize
);
733 static inline void btrfs_set_super_blocksize(struct btrfs_super_block
*s
,
736 s
->blocksize
= cpu_to_le32(val
);
739 static inline u64
btrfs_super_root_dir(struct btrfs_super_block
*s
)
741 return le64_to_cpu(s
->root_dir_objectid
);
744 static inline void btrfs_set_super_root_dir(struct btrfs_super_block
*s
, u64
747 s
->root_dir_objectid
= cpu_to_le64(val
);
750 static inline u8
*btrfs_leaf_data(struct btrfs_leaf
*l
)
752 return (u8
*)l
->items
;
755 static inline u64
btrfs_file_extent_disk_blocknr(struct btrfs_file_extent_item
758 return le64_to_cpu(e
->disk_blocknr
);
761 static inline void btrfs_set_file_extent_disk_blocknr(struct
762 btrfs_file_extent_item
765 e
->disk_blocknr
= cpu_to_le64(val
);
768 static inline u64
btrfs_file_extent_generation(struct btrfs_file_extent_item
*e
)
770 return le64_to_cpu(e
->generation
);
773 static inline void btrfs_set_file_extent_generation(struct
774 btrfs_file_extent_item
*e
,
777 e
->generation
= cpu_to_le64(val
);
780 static inline u64
btrfs_file_extent_disk_num_blocks(struct
781 btrfs_file_extent_item
*e
)
783 return le64_to_cpu(e
->disk_num_blocks
);
786 static inline void btrfs_set_file_extent_disk_num_blocks(struct
787 btrfs_file_extent_item
790 e
->disk_num_blocks
= cpu_to_le64(val
);
793 static inline u64
btrfs_file_extent_offset(struct btrfs_file_extent_item
*e
)
795 return le64_to_cpu(e
->offset
);
798 static inline void btrfs_set_file_extent_offset(struct btrfs_file_extent_item
801 e
->offset
= cpu_to_le64(val
);
804 static inline u64
btrfs_file_extent_num_blocks(struct btrfs_file_extent_item
807 return le64_to_cpu(e
->num_blocks
);
810 static inline void btrfs_set_file_extent_num_blocks(struct
811 btrfs_file_extent_item
*e
,
814 e
->num_blocks
= cpu_to_le64(val
);
817 static inline struct btrfs_root
*btrfs_sb(struct super_block
*sb
)
819 return sb
->s_fs_info
;
822 /* helper function to cast into the data area of the leaf. */
823 #define btrfs_item_ptr(leaf, slot, type) \
824 ((type *)(btrfs_leaf_data(leaf) + \
825 btrfs_item_offset((leaf)->items + (slot))))
828 struct buffer_head
*btrfs_alloc_free_block(struct btrfs_trans_handle
*trans
,
829 struct btrfs_root
*root
);
830 int btrfs_alloc_extent(struct btrfs_trans_handle
*trans
, struct btrfs_root
831 *root
, u64 num_blocks
, u64 search_start
, u64
832 search_end
, u64 owner
, struct btrfs_key
*ins
);
833 int btrfs_inc_ref(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
834 struct buffer_head
*buf
);
835 int btrfs_free_extent(struct btrfs_trans_handle
*trans
, struct btrfs_root
836 *root
, u64 blocknr
, u64 num_blocks
, int pin
);
837 int btrfs_finish_extent_commit(struct btrfs_trans_handle
*trans
, struct
840 int btrfs_search_slot(struct btrfs_trans_handle
*trans
, struct btrfs_root
841 *root
, struct btrfs_key
*key
, struct btrfs_path
*p
, int
843 void btrfs_release_path(struct btrfs_root
*root
, struct btrfs_path
*p
);
844 void btrfs_init_path(struct btrfs_path
*p
);
845 int btrfs_del_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
846 struct btrfs_path
*path
);
847 int btrfs_insert_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
848 *root
, struct btrfs_key
*key
, void *data
, u32 data_size
);
849 int btrfs_insert_empty_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
850 *root
, struct btrfs_path
*path
, struct btrfs_key
851 *cpu_key
, u32 data_size
);
852 int btrfs_next_leaf(struct btrfs_root
*root
, struct btrfs_path
*path
);
853 int btrfs_leaf_free_space(struct btrfs_root
*root
, struct btrfs_leaf
*leaf
);
854 int btrfs_drop_snapshot(struct btrfs_trans_handle
*trans
, struct btrfs_root
855 *root
, struct buffer_head
*snap
);
857 int btrfs_del_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
858 struct btrfs_key
*key
);
859 int btrfs_insert_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
860 *root
, struct btrfs_key
*key
, struct btrfs_root_item
862 int btrfs_update_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
863 *root
, struct btrfs_key
*key
, struct btrfs_root_item
865 int btrfs_find_last_root(struct btrfs_root
*root
, u64 objectid
, struct
866 btrfs_root_item
*item
, struct btrfs_key
*key
);
868 int btrfs_insert_dir_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
869 *root
, const char *name
, int name_len
, u64 dir
, u64
871 int btrfs_lookup_dir_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
872 *root
, struct btrfs_path
*path
, u64 dir
,
873 const char *name
, int name_len
, int mod
);
874 int btrfs_match_dir_item_name(struct btrfs_root
*root
, struct btrfs_path
*path
,
875 const char *name
, int name_len
);
877 int btrfs_find_free_objectid(struct btrfs_trans_handle
*trans
,
878 struct btrfs_root
*fs_root
,
879 u64 dirid
, u64
*objectid
);
880 int btrfs_insert_inode_map(struct btrfs_trans_handle
*trans
,
881 struct btrfs_root
*root
,
882 u64 objectid
, struct btrfs_key
*location
);
883 int btrfs_lookup_inode_map(struct btrfs_trans_handle
*trans
,
884 struct btrfs_root
*root
, struct btrfs_path
*path
,
885 u64 objectid
, int mod
);
887 int btrfs_insert_inode(struct btrfs_trans_handle
*trans
, struct btrfs_root
888 *root
, u64 objectid
, struct btrfs_inode_item
890 int btrfs_lookup_inode(struct btrfs_trans_handle
*trans
, struct btrfs_root
891 *root
, struct btrfs_path
*path
, u64 objectid
, int mod
);
894 int btrfs_alloc_file_extent(struct btrfs_trans_handle
*trans
,
895 struct btrfs_root
*root
,
896 u64 objectid
, u64 offset
,
897 u64 num_blocks
, u64 hint_block
,
899 int btrfs_lookup_file_extent(struct btrfs_trans_handle
*trans
,
900 struct btrfs_root
*root
,
901 struct btrfs_path
*path
, u64 objectid
,
902 u64 blocknr
, int mod
);