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
{
196 * disk space consumed by the extent, checksum blocks are included
200 __le64 disk_num_blocks
;
202 * the logical offset in file blocks (no csums)
203 * this extent record is for. This allows a file extent to point
204 * into the middle of an existing extent on disk, sharing it
205 * between two snapshots (useful if some bytes in the middle of the
206 * extent have changed
210 * the logical number of file blocks (no csums included)
213 } __attribute__ ((__packed__
));
215 struct btrfs_inode_map_item
{
216 struct btrfs_disk_key key
;
217 } __attribute__ ((__packed__
));
219 struct btrfs_fs_info
{
220 struct btrfs_root
*fs_root
;
221 struct btrfs_root
*extent_root
;
222 struct btrfs_root
*tree_root
;
223 struct btrfs_root
*inode_root
;
224 struct btrfs_key current_insert
;
225 struct btrfs_key last_insert
;
226 struct radix_tree_root pending_del_radix
;
227 struct radix_tree_root pinned_radix
;
228 u64 last_inode_alloc
;
229 u64 last_inode_alloc_dirid
;
231 struct btrfs_transaction
*running_transaction
;
232 struct btrfs_super_block
*disk_super
;
233 struct buffer_head
*sb_buffer
;
234 struct super_block
*sb
;
235 struct mutex trans_mutex
;
236 struct mutex fs_mutex
;
240 * in ram representation of the tree. extent_root is used for all allocations
241 * and for the extent tree extent_root root. current_insert is used
242 * only for the extent tree.
245 struct buffer_head
*node
;
246 struct buffer_head
*commit_root
;
247 struct btrfs_root_item root_item
;
248 struct btrfs_key root_key
;
249 struct btrfs_fs_info
*fs_info
;
255 /* the lower bits in the key flags defines the item type */
256 #define BTRFS_KEY_TYPE_MAX 256
257 #define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
260 * inode items have the data typically returned from stat and store other
261 * info about object characteristics. There is one for every file and dir in
264 #define BTRFS_INODE_ITEM_KEY 1
267 * dir items are the name -> inode pointers in a directory. There is one
268 * for every name in a directory.
270 #define BTRFS_DIR_ITEM_KEY 2
272 * inline data is file data that fits in the btree.
274 #define BTRFS_INLINE_DATA_KEY 3
276 * extent data is for data that can't fit in the btree. It points to
277 * a (hopefully) huge chunk of disk
279 #define BTRFS_EXTENT_DATA_KEY 4
281 * root items point to tree roots. There are typically in the root
282 * tree used by the super block to find all the other trees
284 #define BTRFS_ROOT_ITEM_KEY 5
286 * extent items are in the extent map tree. These record which blocks
287 * are used, and how many references there are to each block
289 #define BTRFS_EXTENT_ITEM_KEY 6
292 * the inode map records which inode numbers are in use and where
293 * they actually live on disk
295 #define BTRFS_INODE_MAP_ITEM_KEY 7
297 * string items are for debugging. They just store a short string of
300 #define BTRFS_STRING_ITEM_KEY 8
302 static inline u64
btrfs_inode_generation(struct btrfs_inode_item
*i
)
304 return le64_to_cpu(i
->generation
);
307 static inline void btrfs_set_inode_generation(struct btrfs_inode_item
*i
,
310 i
->generation
= cpu_to_le64(val
);
313 static inline u64
btrfs_inode_size(struct btrfs_inode_item
*i
)
315 return le64_to_cpu(i
->size
);
318 static inline void btrfs_set_inode_size(struct btrfs_inode_item
*i
, u64 val
)
320 i
->size
= cpu_to_le64(val
);
323 static inline u64
btrfs_inode_nblocks(struct btrfs_inode_item
*i
)
325 return le64_to_cpu(i
->nblocks
);
328 static inline void btrfs_set_inode_nblocks(struct btrfs_inode_item
*i
, u64 val
)
330 i
->nblocks
= cpu_to_le64(val
);
333 static inline u32
btrfs_inode_nlink(struct btrfs_inode_item
*i
)
335 return le32_to_cpu(i
->nlink
);
338 static inline void btrfs_set_inode_nlink(struct btrfs_inode_item
*i
, u32 val
)
340 i
->nlink
= cpu_to_le32(val
);
343 static inline u32
btrfs_inode_uid(struct btrfs_inode_item
*i
)
345 return le32_to_cpu(i
->uid
);
348 static inline void btrfs_set_inode_uid(struct btrfs_inode_item
*i
, u32 val
)
350 i
->uid
= cpu_to_le32(val
);
353 static inline u32
btrfs_inode_gid(struct btrfs_inode_item
*i
)
355 return le32_to_cpu(i
->gid
);
358 static inline void btrfs_set_inode_gid(struct btrfs_inode_item
*i
, u32 val
)
360 i
->gid
= cpu_to_le32(val
);
363 static inline u32
btrfs_inode_mode(struct btrfs_inode_item
*i
)
365 return le32_to_cpu(i
->mode
);
368 static inline void btrfs_set_inode_mode(struct btrfs_inode_item
*i
, u32 val
)
370 i
->mode
= cpu_to_le32(val
);
373 static inline u32
btrfs_inode_rdev(struct btrfs_inode_item
*i
)
375 return le32_to_cpu(i
->rdev
);
378 static inline void btrfs_set_inode_rdev(struct btrfs_inode_item
*i
, u32 val
)
380 i
->rdev
= cpu_to_le32(val
);
383 static inline u16
btrfs_inode_flags(struct btrfs_inode_item
*i
)
385 return le16_to_cpu(i
->flags
);
388 static inline void btrfs_set_inode_flags(struct btrfs_inode_item
*i
, u16 val
)
390 i
->flags
= cpu_to_le16(val
);
393 static inline u16
btrfs_inode_compat_flags(struct btrfs_inode_item
*i
)
395 return le16_to_cpu(i
->compat_flags
);
398 static inline void btrfs_set_inode_compat_flags(struct btrfs_inode_item
*i
,
401 i
->compat_flags
= cpu_to_le16(val
);
404 static inline u32
btrfs_timespec_sec(struct btrfs_inode_timespec
*ts
)
406 return le32_to_cpu(ts
->sec
);
409 static inline void btrfs_set_timespec_sec(struct btrfs_inode_timespec
*ts
,
412 ts
->sec
= cpu_to_le32(val
);
415 static inline u32
btrfs_timespec_nsec(struct btrfs_inode_timespec
*ts
)
417 return le32_to_cpu(ts
->nsec
);
420 static inline void btrfs_set_timespec_nsec(struct btrfs_inode_timespec
*ts
,
423 ts
->nsec
= cpu_to_le32(val
);
428 static inline u64
btrfs_extent_owner(struct btrfs_extent_item
*ei
)
430 return le64_to_cpu(ei
->owner
);
433 static inline void btrfs_set_extent_owner(struct btrfs_extent_item
*ei
, u64 val
)
435 ei
->owner
= cpu_to_le64(val
);
438 static inline u32
btrfs_extent_refs(struct btrfs_extent_item
*ei
)
440 return le32_to_cpu(ei
->refs
);
443 static inline void btrfs_set_extent_refs(struct btrfs_extent_item
*ei
, u32 val
)
445 ei
->refs
= cpu_to_le32(val
);
448 static inline u64
btrfs_node_blockptr(struct btrfs_node
*n
, int nr
)
450 return le64_to_cpu(n
->ptrs
[nr
].blockptr
);
453 static inline void btrfs_set_node_blockptr(struct btrfs_node
*n
, int nr
,
456 n
->ptrs
[nr
].blockptr
= cpu_to_le64(val
);
459 static inline u32
btrfs_item_offset(struct btrfs_item
*item
)
461 return le32_to_cpu(item
->offset
);
464 static inline void btrfs_set_item_offset(struct btrfs_item
*item
, u32 val
)
466 item
->offset
= cpu_to_le32(val
);
469 static inline u32
btrfs_item_end(struct btrfs_item
*item
)
471 return le32_to_cpu(item
->offset
) + le16_to_cpu(item
->size
);
474 static inline u16
btrfs_item_size(struct btrfs_item
*item
)
476 return le16_to_cpu(item
->size
);
479 static inline void btrfs_set_item_size(struct btrfs_item
*item
, u16 val
)
481 item
->size
= cpu_to_le16(val
);
484 static inline u64
btrfs_dir_objectid(struct btrfs_dir_item
*d
)
486 return le64_to_cpu(d
->objectid
);
489 static inline void btrfs_set_dir_objectid(struct btrfs_dir_item
*d
, u64 val
)
491 d
->objectid
= cpu_to_le64(val
);
494 static inline u16
btrfs_dir_flags(struct btrfs_dir_item
*d
)
496 return le16_to_cpu(d
->flags
);
499 static inline void btrfs_set_dir_flags(struct btrfs_dir_item
*d
, u16 val
)
501 d
->flags
= cpu_to_le16(val
);
504 static inline u8
btrfs_dir_type(struct btrfs_dir_item
*d
)
509 static inline void btrfs_set_dir_type(struct btrfs_dir_item
*d
, u8 val
)
514 static inline u16
btrfs_dir_name_len(struct btrfs_dir_item
*d
)
516 return le16_to_cpu(d
->name_len
);
519 static inline void btrfs_set_dir_name_len(struct btrfs_dir_item
*d
, u16 val
)
521 d
->name_len
= cpu_to_le16(val
);
524 static inline void btrfs_disk_key_to_cpu(struct btrfs_key
*cpu
,
525 struct btrfs_disk_key
*disk
)
527 cpu
->offset
= le64_to_cpu(disk
->offset
);
528 cpu
->flags
= le32_to_cpu(disk
->flags
);
529 cpu
->objectid
= le64_to_cpu(disk
->objectid
);
532 static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key
*disk
,
533 struct btrfs_key
*cpu
)
535 disk
->offset
= cpu_to_le64(cpu
->offset
);
536 disk
->flags
= cpu_to_le32(cpu
->flags
);
537 disk
->objectid
= cpu_to_le64(cpu
->objectid
);
540 static inline u64
btrfs_disk_key_objectid(struct btrfs_disk_key
*disk
)
542 return le64_to_cpu(disk
->objectid
);
545 static inline void btrfs_set_disk_key_objectid(struct btrfs_disk_key
*disk
,
548 disk
->objectid
= cpu_to_le64(val
);
551 static inline u64
btrfs_disk_key_offset(struct btrfs_disk_key
*disk
)
553 return le64_to_cpu(disk
->offset
);
556 static inline void btrfs_set_disk_key_offset(struct btrfs_disk_key
*disk
,
559 disk
->offset
= cpu_to_le64(val
);
562 static inline u32
btrfs_disk_key_flags(struct btrfs_disk_key
*disk
)
564 return le32_to_cpu(disk
->flags
);
567 static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key
*disk
,
570 disk
->flags
= cpu_to_le32(val
);
573 static inline u32
btrfs_key_type(struct btrfs_key
*key
)
575 return key
->flags
& BTRFS_KEY_TYPE_MASK
;
578 static inline u32
btrfs_disk_key_type(struct btrfs_disk_key
*key
)
580 return le32_to_cpu(key
->flags
) & BTRFS_KEY_TYPE_MASK
;
583 static inline void btrfs_set_key_type(struct btrfs_key
*key
, u32 type
)
585 BUG_ON(type
>= BTRFS_KEY_TYPE_MAX
);
586 key
->flags
= (key
->flags
& ~((u64
)BTRFS_KEY_TYPE_MASK
)) | type
;
589 static inline void btrfs_set_disk_key_type(struct btrfs_disk_key
*key
, u32 type
)
591 u32 flags
= btrfs_disk_key_flags(key
);
592 BUG_ON(type
>= BTRFS_KEY_TYPE_MAX
);
593 flags
= (flags
& ~((u64
)BTRFS_KEY_TYPE_MASK
)) | type
;
594 btrfs_set_disk_key_flags(key
, flags
);
597 static inline u64
btrfs_header_blocknr(struct btrfs_header
*h
)
599 return le64_to_cpu(h
->blocknr
);
602 static inline void btrfs_set_header_blocknr(struct btrfs_header
*h
, u64 blocknr
)
604 h
->blocknr
= cpu_to_le64(blocknr
);
607 static inline u64
btrfs_header_generation(struct btrfs_header
*h
)
609 return le64_to_cpu(h
->generation
);
612 static inline void btrfs_set_header_generation(struct btrfs_header
*h
,
615 h
->generation
= cpu_to_le64(val
);
618 static inline u64
btrfs_header_parentid(struct btrfs_header
*h
)
620 return le64_to_cpu(h
->parentid
);
623 static inline void btrfs_set_header_parentid(struct btrfs_header
*h
,
626 h
->parentid
= cpu_to_le64(parentid
);
629 static inline u16
btrfs_header_nritems(struct btrfs_header
*h
)
631 return le16_to_cpu(h
->nritems
);
634 static inline void btrfs_set_header_nritems(struct btrfs_header
*h
, u16 val
)
636 h
->nritems
= cpu_to_le16(val
);
639 static inline u16
btrfs_header_flags(struct btrfs_header
*h
)
641 return le16_to_cpu(h
->flags
);
644 static inline void btrfs_set_header_flags(struct btrfs_header
*h
, u16 val
)
646 h
->flags
= cpu_to_le16(val
);
649 static inline int btrfs_header_level(struct btrfs_header
*h
)
654 static inline void btrfs_set_header_level(struct btrfs_header
*h
, int level
)
656 BUG_ON(level
> BTRFS_MAX_LEVEL
);
660 static inline int btrfs_is_leaf(struct btrfs_node
*n
)
662 return (btrfs_header_level(&n
->header
) == 0);
665 static inline u64
btrfs_root_blocknr(struct btrfs_root_item
*item
)
667 return le64_to_cpu(item
->blocknr
);
670 static inline void btrfs_set_root_blocknr(struct btrfs_root_item
*item
, u64 val
)
672 item
->blocknr
= cpu_to_le64(val
);
675 static inline u32
btrfs_root_refs(struct btrfs_root_item
*item
)
677 return le32_to_cpu(item
->refs
);
680 static inline void btrfs_set_root_refs(struct btrfs_root_item
*item
, u32 val
)
682 item
->refs
= cpu_to_le32(val
);
685 static inline u64
btrfs_super_blocknr(struct btrfs_super_block
*s
)
687 return le64_to_cpu(s
->blocknr
);
690 static inline void btrfs_set_super_blocknr(struct btrfs_super_block
*s
, u64 val
)
692 s
->blocknr
= cpu_to_le64(val
);
695 static inline u64
btrfs_super_root(struct btrfs_super_block
*s
)
697 return le64_to_cpu(s
->root
);
700 static inline void btrfs_set_super_root(struct btrfs_super_block
*s
, u64 val
)
702 s
->root
= cpu_to_le64(val
);
705 static inline u64
btrfs_super_total_blocks(struct btrfs_super_block
*s
)
707 return le64_to_cpu(s
->total_blocks
);
710 static inline void btrfs_set_super_total_blocks(struct btrfs_super_block
*s
,
713 s
->total_blocks
= cpu_to_le64(val
);
716 static inline u64
btrfs_super_blocks_used(struct btrfs_super_block
*s
)
718 return le64_to_cpu(s
->blocks_used
);
721 static inline void btrfs_set_super_blocks_used(struct btrfs_super_block
*s
,
724 s
->blocks_used
= cpu_to_le64(val
);
727 static inline u32
btrfs_super_blocksize(struct btrfs_super_block
*s
)
729 return le32_to_cpu(s
->blocksize
);
732 static inline void btrfs_set_super_blocksize(struct btrfs_super_block
*s
,
735 s
->blocksize
= cpu_to_le32(val
);
738 static inline u64
btrfs_super_root_dir(struct btrfs_super_block
*s
)
740 return le64_to_cpu(s
->root_dir_objectid
);
743 static inline void btrfs_set_super_root_dir(struct btrfs_super_block
*s
, u64
746 s
->root_dir_objectid
= cpu_to_le64(val
);
749 static inline u8
*btrfs_leaf_data(struct btrfs_leaf
*l
)
751 return (u8
*)l
->items
;
754 static inline u64
btrfs_file_extent_disk_blocknr(struct btrfs_file_extent_item
757 return le64_to_cpu(e
->disk_blocknr
);
760 static inline void btrfs_set_file_extent_disk_blocknr(struct
761 btrfs_file_extent_item
764 e
->disk_blocknr
= cpu_to_le64(val
);
767 static inline u64
btrfs_file_extent_disk_num_blocks(struct
768 btrfs_file_extent_item
*e
)
770 return le64_to_cpu(e
->disk_num_blocks
);
773 static inline void btrfs_set_file_extent_disk_num_blocks(struct
774 btrfs_file_extent_item
777 e
->disk_num_blocks
= cpu_to_le64(val
);
780 static inline u64
btrfs_file_extent_offset(struct btrfs_file_extent_item
*e
)
782 return le64_to_cpu(e
->offset
);
785 static inline void btrfs_set_file_extent_offset(struct btrfs_file_extent_item
788 e
->offset
= cpu_to_le64(val
);
791 static inline u64
btrfs_file_extent_num_blocks(struct btrfs_file_extent_item
794 return le64_to_cpu(e
->num_blocks
);
797 static inline void btrfs_set_file_extent_num_blocks(struct
798 btrfs_file_extent_item
*e
,
801 e
->num_blocks
= cpu_to_le64(val
);
804 static inline struct btrfs_root
*btrfs_sb(struct super_block
*sb
)
806 return sb
->s_fs_info
;
809 /* helper function to cast into the data area of the leaf. */
810 #define btrfs_item_ptr(leaf, slot, type) \
811 ((type *)(btrfs_leaf_data(leaf) + \
812 btrfs_item_offset((leaf)->items + (slot))))
815 struct buffer_head
*btrfs_alloc_free_block(struct btrfs_trans_handle
*trans
,
816 struct btrfs_root
*root
);
817 int btrfs_alloc_extent(struct btrfs_trans_handle
*trans
, struct btrfs_root
818 *root
, u64 num_blocks
, u64 search_start
, u64
819 search_end
, u64 owner
, struct btrfs_key
*ins
);
820 int btrfs_inc_ref(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
821 struct buffer_head
*buf
);
822 int btrfs_free_extent(struct btrfs_trans_handle
*trans
, struct btrfs_root
823 *root
, u64 blocknr
, u64 num_blocks
, int pin
);
824 int btrfs_finish_extent_commit(struct btrfs_trans_handle
*trans
, struct
827 int btrfs_search_slot(struct btrfs_trans_handle
*trans
, struct btrfs_root
828 *root
, struct btrfs_key
*key
, struct btrfs_path
*p
, int
830 void btrfs_release_path(struct btrfs_root
*root
, struct btrfs_path
*p
);
831 void btrfs_init_path(struct btrfs_path
*p
);
832 int btrfs_del_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
833 struct btrfs_path
*path
);
834 int btrfs_insert_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
835 *root
, struct btrfs_key
*key
, void *data
, u32 data_size
);
836 int btrfs_insert_empty_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
837 *root
, struct btrfs_path
*path
, struct btrfs_key
838 *cpu_key
, u32 data_size
);
839 int btrfs_next_leaf(struct btrfs_root
*root
, struct btrfs_path
*path
);
840 int btrfs_leaf_free_space(struct btrfs_root
*root
, struct btrfs_leaf
*leaf
);
841 int btrfs_drop_snapshot(struct btrfs_trans_handle
*trans
, struct btrfs_root
842 *root
, struct buffer_head
*snap
);
844 int btrfs_del_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
*root
,
845 struct btrfs_key
*key
);
846 int btrfs_insert_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
847 *root
, struct btrfs_key
*key
, struct btrfs_root_item
849 int btrfs_update_root(struct btrfs_trans_handle
*trans
, struct btrfs_root
850 *root
, struct btrfs_key
*key
, struct btrfs_root_item
852 int btrfs_find_last_root(struct btrfs_root
*root
, u64 objectid
, struct
853 btrfs_root_item
*item
, struct btrfs_key
*key
);
855 int btrfs_insert_dir_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
856 *root
, const char *name
, int name_len
, u64 dir
, u64
858 int btrfs_lookup_dir_item(struct btrfs_trans_handle
*trans
, struct btrfs_root
859 *root
, struct btrfs_path
*path
, u64 dir
,
860 const char *name
, int name_len
, int mod
);
861 int btrfs_match_dir_item_name(struct btrfs_root
*root
, struct btrfs_path
*path
,
862 const char *name
, int name_len
);
864 int btrfs_find_free_objectid(struct btrfs_trans_handle
*trans
,
865 struct btrfs_root
*fs_root
,
866 u64 dirid
, u64
*objectid
);
867 int btrfs_insert_inode_map(struct btrfs_trans_handle
*trans
,
868 struct btrfs_root
*root
,
869 u64 objectid
, struct btrfs_key
*location
);
870 int btrfs_lookup_inode_map(struct btrfs_trans_handle
*trans
,
871 struct btrfs_root
*root
, struct btrfs_path
*path
,
872 u64 objectid
, int mod
);
874 int btrfs_insert_inode(struct btrfs_trans_handle
*trans
, struct btrfs_root
875 *root
, u64 objectid
, struct btrfs_inode_item
877 int btrfs_lookup_inode(struct btrfs_trans_handle
*trans
, struct btrfs_root
878 *root
, struct btrfs_path
*path
, u64 objectid
, int mod
);
881 int btrfs_alloc_file_extent(struct btrfs_trans_handle
*trans
,
882 struct btrfs_root
*root
,
883 u64 objectid
, u64 offset
,
884 u64 num_blocks
, u64 hint_block
,
886 int btrfs_lookup_file_extent(struct btrfs_trans_handle
*trans
,
887 struct btrfs_root
*root
,
888 struct btrfs_path
*path
, u64 objectid
,
889 u64 blocknr
, u64 num_blocks
, int mod
);