add file extents to print_leaf
[btrfs-progs-unstable.git] / ctree.h
blob8fed41e3f3812ebec7d0c2ce897f2756253fc313
1 #ifndef __BTRFS__
2 #define __BTRFS__
4 #include "list.h"
5 #include "kerncompat.h"
7 struct btrfs_trans_handle;
9 #define BTRFS_MAGIC "_BtRfS_M"
11 #define BTRFS_ROOT_TREE_OBJECTID 1
12 #define BTRFS_EXTENT_TREE_OBJECTID 2
13 #define BTRFS_INODE_MAP_OBJECTID 3
14 #define BTRFS_FS_TREE_OBJECTID 4
17 * the key defines the order in the tree, and so it also defines (optimal)
18 * block layout. objectid corresonds to the inode number. The flags
19 * tells us things about the object, and is a kind of stream selector.
20 * so for a given inode, keys with flags of 1 might refer to the inode
21 * data, flags of 2 may point to file data in the btree and flags == 3
22 * may point to extents.
24 * offset is the starting byte offset for this key in the stream.
26 * btrfs_disk_key is in disk byte order. struct btrfs_key is always
27 * in cpu native order. Otherwise they are identical and their sizes
28 * should be the same (ie both packed)
30 struct btrfs_disk_key {
31 __le64 objectid;
32 __le32 flags;
33 __le64 offset;
34 } __attribute__ ((__packed__));
36 struct btrfs_key {
37 u64 objectid;
38 u32 flags;
39 u64 offset;
40 } __attribute__ ((__packed__));
43 * every tree block (leaf or node) starts with this header.
45 struct btrfs_header {
46 u8 fsid[16]; /* FS specific uuid */
47 __le64 blocknr; /* which block this node is supposed to live in */
48 __le64 generation;
49 __le64 parentid; /* objectid of the tree root */
50 __le32 csum;
51 __le32 ham;
52 __le16 nritems;
53 __le16 flags;
54 /* generation flags to be added */
55 } __attribute__ ((__packed__));
57 #define BTRFS_MAX_LEVEL 8
58 #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->blocksize - \
59 sizeof(struct btrfs_header)) / \
60 (sizeof(struct btrfs_disk_key) + sizeof(u64)))
61 #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
62 #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
64 struct btrfs_buffer;
66 * the super block basically lists the main trees of the FS
67 * it currently lacks any block count etc etc
69 struct btrfs_super_block {
70 u8 fsid[16]; /* FS specific uuid */
71 __le64 blocknr; /* this block number */
72 __le32 csum;
73 __le64 magic;
74 __le32 blocksize;
75 __le64 generation;
76 __le64 root;
77 __le64 total_blocks;
78 __le64 blocks_used;
79 __le64 root_dir_objectid;
80 } __attribute__ ((__packed__));
83 * A leaf is full of items. offset and size tell us where to find
84 * the item in the leaf (relative to the start of the data area)
86 struct btrfs_item {
87 struct btrfs_disk_key key;
88 __le32 offset;
89 __le16 size;
90 } __attribute__ ((__packed__));
93 * leaves have an item area and a data area:
94 * [item0, item1....itemN] [free space] [dataN...data1, data0]
96 * The data is separate from the items to get the keys closer together
97 * during searches.
99 struct btrfs_leaf {
100 struct btrfs_header header;
101 struct btrfs_item items[];
102 } __attribute__ ((__packed__));
105 * all non-leaf blocks are nodes, they hold only keys and pointers to
106 * other blocks
108 struct btrfs_key_ptr {
109 struct btrfs_disk_key key;
110 __le64 blockptr;
111 } __attribute__ ((__packed__));
113 struct btrfs_node {
114 struct btrfs_header header;
115 struct btrfs_key_ptr ptrs[];
116 } __attribute__ ((__packed__));
119 * btrfs_paths remember the path taken from the root down to the leaf.
120 * level 0 is always the leaf, and nodes[1...BTRFS_MAX_LEVEL] will point
121 * to any other levels that are present.
123 * The slots array records the index of the item or block pointer
124 * used while walking the tree.
126 struct btrfs_path {
127 struct btrfs_buffer *nodes[BTRFS_MAX_LEVEL];
128 int slots[BTRFS_MAX_LEVEL];
132 * items in the extent btree are used to record the objectid of the
133 * owner of the block and the number of references
135 struct btrfs_extent_item {
136 __le32 refs;
137 __le64 owner;
138 } __attribute__ ((__packed__));
140 struct btrfs_inode_timespec {
141 __le32 sec;
142 __le32 nsec;
143 } __attribute__ ((__packed__));
146 * there is no padding here on purpose. If you want to extent the inode,
147 * make a new item type
149 struct btrfs_inode_item {
150 __le64 generation;
151 __le64 size;
152 __le64 nblocks;
153 __le32 nlink;
154 __le32 uid;
155 __le32 gid;
156 __le32 mode;
157 __le32 rdev;
158 __le16 flags;
159 __le16 compat_flags;
160 struct btrfs_inode_timespec atime;
161 struct btrfs_inode_timespec ctime;
162 struct btrfs_inode_timespec mtime;
163 struct btrfs_inode_timespec otime;
164 } __attribute__ ((__packed__));
166 /* inline data is just a blob of bytes */
167 struct btrfs_inline_data_item {
168 u8 data;
169 } __attribute__ ((__packed__));
171 struct btrfs_dir_item {
172 __le64 objectid;
173 __le16 flags;
174 __le16 name_len;
175 u8 type;
176 } __attribute__ ((__packed__));
178 struct btrfs_root_item {
179 __le64 blocknr;
180 __le32 flags;
181 __le64 block_limit;
182 __le64 blocks_used;
183 __le32 refs;
184 } __attribute__ ((__packed__));
186 struct btrfs_file_extent_item {
188 * disk space consumed by the extent, checksum blocks are included
189 * in these numbers
191 __le64 disk_blocknr;
192 __le64 disk_num_blocks;
194 * the logical offset in file blocks (no csums)
195 * this extent record is for. This allows a file extent to point
196 * into the middle of an existing extent on disk, sharing it
197 * between two snapshots (useful if some bytes in the middle of the
198 * extent have changed
200 __le64 offset;
202 * the logical number of file blocks (no csums included)
204 __le64 num_blocks;
205 } __attribute__ ((__packed__));
207 struct btrfs_inode_map_item {
208 struct btrfs_disk_key key;
209 } __attribute__ ((__packed__));
211 struct btrfs_fs_info {
212 struct btrfs_root *fs_root;
213 struct btrfs_root *extent_root;
214 struct btrfs_root *tree_root;
215 struct btrfs_root *inode_root;
216 struct btrfs_key current_insert;
217 struct btrfs_key last_insert;
218 struct radix_tree_root cache_radix;
219 struct radix_tree_root pinned_radix;
220 struct list_head trans;
221 struct list_head cache;
222 u64 last_inode_alloc;
223 u64 last_inode_alloc_dirid;
224 u64 generation;
225 int cache_size;
226 int fp;
227 struct btrfs_trans_handle *running_transaction;
228 struct btrfs_super_block *disk_super;
232 * in ram representation of the tree. extent_root is used for all allocations
233 * and for the extent tree extent_root root. current_insert is used
234 * only for the extent tree.
236 struct btrfs_root {
237 struct btrfs_buffer *node;
238 struct btrfs_buffer *commit_root;
239 struct btrfs_root_item root_item;
240 struct btrfs_key root_key;
241 struct btrfs_fs_info *fs_info;
242 u32 blocksize;
243 int ref_cows;
244 u32 type;
247 /* the lower bits in the key flags defines the item type */
248 #define BTRFS_KEY_TYPE_MAX 256
249 #define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
252 * inode items have the data typically returned from stat and store other
253 * info about object characteristics. There is one for every file and dir in
254 * the FS
256 #define BTRFS_INODE_ITEM_KEY 1
259 * dir items are the name -> inode pointers in a directory. There is one
260 * for every name in a directory.
262 #define BTRFS_DIR_ITEM_KEY 2
264 * inline data is file data that fits in the btree.
266 #define BTRFS_INLINE_DATA_KEY 3
268 * extent data is for data that can't fit in the btree. It points to
269 * a (hopefully) huge chunk of disk
271 #define BTRFS_EXTENT_DATA_KEY 4
273 * root items point to tree roots. There are typically in the root
274 * tree used by the super block to find all the other trees
276 #define BTRFS_ROOT_ITEM_KEY 5
278 * extent items are in the extent map tree. These record which blocks
279 * are used, and how many references there are to each block
281 #define BTRFS_EXTENT_ITEM_KEY 6
284 * the inode map records which inode numbers are in use and where
285 * they actually live on disk
287 #define BTRFS_INODE_MAP_ITEM_KEY 7
289 * string items are for debugging. They just store a short string of
290 * data in the FS
292 #define BTRFS_STRING_ITEM_KEY 8
294 static inline u64 btrfs_inode_generation(struct btrfs_inode_item *i)
296 return le64_to_cpu(i->generation);
299 static inline void btrfs_set_inode_generation(struct btrfs_inode_item *i,
300 u64 val)
302 i->generation = cpu_to_le64(val);
305 static inline u64 btrfs_inode_size(struct btrfs_inode_item *i)
307 return le64_to_cpu(i->size);
310 static inline void btrfs_set_inode_size(struct btrfs_inode_item *i, u64 val)
312 i->size = cpu_to_le64(val);
315 static inline u64 btrfs_inode_nblocks(struct btrfs_inode_item *i)
317 return le64_to_cpu(i->nblocks);
320 static inline void btrfs_set_inode_nblocks(struct btrfs_inode_item *i, u64 val)
322 i->nblocks = cpu_to_le64(val);
325 static inline u32 btrfs_inode_nlink(struct btrfs_inode_item *i)
327 return le32_to_cpu(i->nlink);
330 static inline void btrfs_set_inode_nlink(struct btrfs_inode_item *i, u32 val)
332 i->nlink = cpu_to_le32(val);
335 static inline u32 btrfs_inode_uid(struct btrfs_inode_item *i)
337 return le32_to_cpu(i->uid);
340 static inline void btrfs_set_inode_uid(struct btrfs_inode_item *i, u32 val)
342 i->uid = cpu_to_le32(val);
345 static inline u32 btrfs_inode_gid(struct btrfs_inode_item *i)
347 return le32_to_cpu(i->gid);
350 static inline void btrfs_set_inode_gid(struct btrfs_inode_item *i, u32 val)
352 i->gid = cpu_to_le32(val);
355 static inline u32 btrfs_inode_mode(struct btrfs_inode_item *i)
357 return le32_to_cpu(i->mode);
360 static inline void btrfs_set_inode_mode(struct btrfs_inode_item *i, u32 val)
362 i->mode = cpu_to_le32(val);
365 static inline u32 btrfs_inode_rdev(struct btrfs_inode_item *i)
367 return le32_to_cpu(i->rdev);
370 static inline void btrfs_set_inode_rdev(struct btrfs_inode_item *i, u32 val)
372 i->rdev = cpu_to_le32(val);
375 static inline u16 btrfs_inode_flags(struct btrfs_inode_item *i)
377 return le16_to_cpu(i->flags);
380 static inline void btrfs_set_inode_flags(struct btrfs_inode_item *i, u16 val)
382 i->flags = cpu_to_le16(val);
385 static inline u16 btrfs_inode_compat_flags(struct btrfs_inode_item *i)
387 return le16_to_cpu(i->compat_flags);
390 static inline void btrfs_set_inode_compat_flags(struct btrfs_inode_item *i,
391 u16 val)
393 i->compat_flags = cpu_to_le16(val);
397 static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
399 return le64_to_cpu(ei->owner);
402 static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
404 ei->owner = cpu_to_le64(val);
407 static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei)
409 return le32_to_cpu(ei->refs);
412 static inline void btrfs_set_extent_refs(struct btrfs_extent_item *ei, u32 val)
414 ei->refs = cpu_to_le32(val);
417 static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
419 return le64_to_cpu(n->ptrs[nr].blockptr);
422 static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr,
423 u64 val)
425 n->ptrs[nr].blockptr = cpu_to_le64(val);
428 static inline u32 btrfs_item_offset(struct btrfs_item *item)
430 return le32_to_cpu(item->offset);
433 static inline void btrfs_set_item_offset(struct btrfs_item *item, u32 val)
435 item->offset = cpu_to_le32(val);
438 static inline u32 btrfs_item_end(struct btrfs_item *item)
440 return le32_to_cpu(item->offset) + le16_to_cpu(item->size);
443 static inline u16 btrfs_item_size(struct btrfs_item *item)
445 return le16_to_cpu(item->size);
448 static inline void btrfs_set_item_size(struct btrfs_item *item, u16 val)
450 item->size = cpu_to_le16(val);
453 static inline u64 btrfs_dir_objectid(struct btrfs_dir_item *d)
455 return le64_to_cpu(d->objectid);
458 static inline void btrfs_set_dir_objectid(struct btrfs_dir_item *d, u64 val)
460 d->objectid = cpu_to_le64(val);
463 static inline u16 btrfs_dir_flags(struct btrfs_dir_item *d)
465 return le16_to_cpu(d->flags);
468 static inline void btrfs_set_dir_flags(struct btrfs_dir_item *d, u16 val)
470 d->flags = cpu_to_le16(val);
473 static inline u8 btrfs_dir_type(struct btrfs_dir_item *d)
475 return d->type;
478 static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val)
480 d->type = val;
483 static inline u16 btrfs_dir_name_len(struct btrfs_dir_item *d)
485 return le16_to_cpu(d->name_len);
488 static inline void btrfs_set_dir_name_len(struct btrfs_dir_item *d, u16 val)
490 d->name_len = cpu_to_le16(val);
493 static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
494 struct btrfs_disk_key *disk)
496 cpu->offset = le64_to_cpu(disk->offset);
497 cpu->flags = le32_to_cpu(disk->flags);
498 cpu->objectid = le64_to_cpu(disk->objectid);
501 static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
502 struct btrfs_key *cpu)
504 disk->offset = cpu_to_le64(cpu->offset);
505 disk->flags = cpu_to_le32(cpu->flags);
506 disk->objectid = cpu_to_le64(cpu->objectid);
509 static inline u64 btrfs_disk_key_objectid(struct btrfs_disk_key *disk)
511 return le64_to_cpu(disk->objectid);
514 static inline void btrfs_set_disk_key_objectid(struct btrfs_disk_key *disk,
515 u64 val)
517 disk->objectid = cpu_to_le64(val);
520 static inline u64 btrfs_disk_key_offset(struct btrfs_disk_key *disk)
522 return le64_to_cpu(disk->offset);
525 static inline void btrfs_set_disk_key_offset(struct btrfs_disk_key *disk,
526 u64 val)
528 disk->offset = cpu_to_le64(val);
531 static inline u32 btrfs_disk_key_flags(struct btrfs_disk_key *disk)
533 return le32_to_cpu(disk->flags);
536 static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key *disk,
537 u32 val)
539 disk->flags = cpu_to_le32(val);
542 static inline u32 btrfs_key_type(struct btrfs_key *key)
544 return key->flags & BTRFS_KEY_TYPE_MASK;
547 static inline u32 btrfs_disk_key_type(struct btrfs_disk_key *key)
549 return le32_to_cpu(key->flags) & BTRFS_KEY_TYPE_MASK;
552 static inline void btrfs_set_key_type(struct btrfs_key *key, u32 type)
554 BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
555 key->flags = (key->flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
558 static inline void btrfs_set_disk_key_type(struct btrfs_disk_key *key, u32 type)
560 u32 flags = btrfs_disk_key_flags(key);
561 BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
562 flags = (flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
563 btrfs_set_disk_key_flags(key, flags);
566 static inline u64 btrfs_header_blocknr(struct btrfs_header *h)
568 return le64_to_cpu(h->blocknr);
571 static inline void btrfs_set_header_blocknr(struct btrfs_header *h, u64 blocknr)
573 h->blocknr = cpu_to_le64(blocknr);
576 static inline u64 btrfs_header_generation(struct btrfs_header *h)
578 return le64_to_cpu(h->generation);
581 static inline void btrfs_set_header_generation(struct btrfs_header *h,
582 u64 val)
584 h->generation = cpu_to_le64(val);
587 static inline u64 btrfs_header_parentid(struct btrfs_header *h)
589 return le64_to_cpu(h->parentid);
592 static inline void btrfs_set_header_parentid(struct btrfs_header *h,
593 u64 parentid)
595 h->parentid = cpu_to_le64(parentid);
598 static inline u16 btrfs_header_nritems(struct btrfs_header *h)
600 return le16_to_cpu(h->nritems);
603 static inline void btrfs_set_header_nritems(struct btrfs_header *h, u16 val)
605 h->nritems = cpu_to_le16(val);
608 static inline u16 btrfs_header_flags(struct btrfs_header *h)
610 return le16_to_cpu(h->flags);
613 static inline void btrfs_set_header_flags(struct btrfs_header *h, u16 val)
615 h->flags = cpu_to_le16(val);
618 static inline int btrfs_header_level(struct btrfs_header *h)
620 return btrfs_header_flags(h) & (BTRFS_MAX_LEVEL - 1);
623 static inline void btrfs_set_header_level(struct btrfs_header *h, int level)
625 u16 flags;
626 BUG_ON(level > BTRFS_MAX_LEVEL);
627 flags = btrfs_header_flags(h) & ~(BTRFS_MAX_LEVEL - 1);
628 btrfs_set_header_flags(h, flags | level);
631 static inline int btrfs_is_leaf(struct btrfs_node *n)
633 return (btrfs_header_level(&n->header) == 0);
636 static inline u64 btrfs_root_blocknr(struct btrfs_root_item *item)
638 return le64_to_cpu(item->blocknr);
641 static inline void btrfs_set_root_blocknr(struct btrfs_root_item *item, u64 val)
643 item->blocknr = cpu_to_le64(val);
646 static inline u32 btrfs_root_refs(struct btrfs_root_item *item)
648 return le32_to_cpu(item->refs);
651 static inline void btrfs_set_root_refs(struct btrfs_root_item *item, u32 val)
653 item->refs = cpu_to_le32(val);
656 static inline u64 btrfs_super_blocknr(struct btrfs_super_block *s)
658 return le64_to_cpu(s->blocknr);
661 static inline void btrfs_set_super_blocknr(struct btrfs_super_block *s, u64 val)
663 s->blocknr = cpu_to_le64(val);
666 static inline u64 btrfs_super_root(struct btrfs_super_block *s)
668 return le64_to_cpu(s->root);
671 static inline void btrfs_set_super_root(struct btrfs_super_block *s, u64 val)
673 s->root = cpu_to_le64(val);
676 static inline u64 btrfs_super_total_blocks(struct btrfs_super_block *s)
678 return le64_to_cpu(s->total_blocks);
681 static inline void btrfs_set_super_total_blocks(struct btrfs_super_block *s,
682 u64 val)
684 s->total_blocks = cpu_to_le64(val);
687 static inline u64 btrfs_super_blocks_used(struct btrfs_super_block *s)
689 return le64_to_cpu(s->blocks_used);
692 static inline void btrfs_set_super_blocks_used(struct btrfs_super_block *s,
693 u64 val)
695 s->blocks_used = cpu_to_le64(val);
698 static inline u32 btrfs_super_blocksize(struct btrfs_super_block *s)
700 return le32_to_cpu(s->blocksize);
703 static inline void btrfs_set_super_blocksize(struct btrfs_super_block *s,
704 u32 val)
706 s->blocksize = cpu_to_le32(val);
709 static inline u64 btrfs_super_root_dir(struct btrfs_super_block *s)
711 return le64_to_cpu(s->root_dir_objectid);
714 static inline void btrfs_set_super_root_dir(struct btrfs_super_block *s, u64
715 val)
717 s->root_dir_objectid = cpu_to_le64(val);
720 static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
722 return (u8 *)l->items;
725 static inline u64 btrfs_file_extent_disk_blocknr(struct btrfs_file_extent_item
728 return le64_to_cpu(e->disk_blocknr);
731 static inline void btrfs_set_file_extent_disk_blocknr(struct
732 btrfs_file_extent_item
733 *e, u64 val)
735 e->disk_blocknr = cpu_to_le64(val);
738 static inline u64 btrfs_file_extent_disk_num_blocks(struct
739 btrfs_file_extent_item *e)
741 return le64_to_cpu(e->disk_num_blocks);
744 static inline void btrfs_set_file_extent_disk_num_blocks(struct
745 btrfs_file_extent_item
746 *e, u64 val)
748 e->disk_num_blocks = cpu_to_le64(val);
751 static inline u64 btrfs_file_extent_offset(struct btrfs_file_extent_item *e)
753 return le64_to_cpu(e->offset);
756 static inline void btrfs_set_file_extent_offset(struct btrfs_file_extent_item
757 *e, u64 val)
759 e->offset = cpu_to_le64(val);
762 static inline u64 btrfs_file_extent_num_blocks(struct btrfs_file_extent_item
765 return le64_to_cpu(e->num_blocks);
768 static inline void btrfs_set_file_extent_num_blocks(struct
769 btrfs_file_extent_item *e,
770 u64 val)
772 e->num_blocks = cpu_to_le64(val);
775 /* helper function to cast into the data area of the leaf. */
776 #define btrfs_item_ptr(leaf, slot, type) \
777 ((type *)(btrfs_leaf_data(leaf) + \
778 btrfs_item_offset((leaf)->items + (slot))))
780 struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
781 struct btrfs_root *root);
782 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
783 struct btrfs_buffer *buf);
784 int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
785 *root, u64 blocknr, u64 num_blocks, int pin);
786 int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
787 *root, struct btrfs_key *key, struct btrfs_path *p, int
788 ins_len, int cow);
789 void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
790 void btrfs_init_path(struct btrfs_path *p);
791 int btrfs_del_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
792 struct btrfs_path *path);
793 int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
794 *root, struct btrfs_key *key, void *data, u32 data_size);
795 int btrfs_insert_empty_item(struct btrfs_trans_handle *trans, struct btrfs_root
796 *root, struct btrfs_path *path, struct btrfs_key
797 *cpu_key, u32 data_size);
798 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
799 int btrfs_leaf_free_space(struct btrfs_root *root, struct btrfs_leaf *leaf);
800 int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
801 *root, struct btrfs_buffer *snap);
802 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
803 btrfs_root *root);
804 int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
805 struct btrfs_key *key);
806 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
807 *root, struct btrfs_key *key, struct btrfs_root_item
808 *item);
809 int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
810 *root, struct btrfs_key *key, struct btrfs_root_item
811 *item);
812 int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
813 btrfs_root_item *item, struct btrfs_key *key);
814 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
815 *root, char *name, int name_len, u64 dir, u64
816 objectid, u8 type);
817 int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
818 *root, struct btrfs_path *path, u64 dir, char *name,
819 int name_len, int mod);
820 int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path,
821 char *name, int name_len);
822 int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
823 struct btrfs_root *fs_root,
824 u64 dirid, u64 *objectid);
825 int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
826 struct btrfs_root *root,
827 u64 objectid, struct btrfs_key *location);
828 int btrfs_lookup_inode_map(struct btrfs_trans_handle *trans,
829 struct btrfs_root *root, struct btrfs_path *path,
830 u64 objectid, int mod);
831 int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root
832 *root, u64 objectid, struct btrfs_inode_item
833 *inode_item);
834 int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
835 *root, struct btrfs_path *path, u64 objectid, int mod);
836 #endif