add generation to file extents
[btrfs-progs-unstable.git] / ctree.h
blob3349281e7e7ae755827b04a173a867aa0926aba4
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
15 #define BTRFS_FIRST_FREE_OBJECTID 5
18 * the key defines the order in the tree, and so it also defines (optimal)
19 * block layout. objectid corresonds to the inode number. The flags
20 * tells us things about the object, and is a kind of stream selector.
21 * so for a given inode, keys with flags of 1 might refer to the inode
22 * data, flags of 2 may point to file data in the btree and flags == 3
23 * may point to extents.
25 * offset is the starting byte offset for this key in the stream.
27 * btrfs_disk_key is in disk byte order. struct btrfs_key is always
28 * in cpu native order. Otherwise they are identical and their sizes
29 * should be the same (ie both packed)
31 struct btrfs_disk_key {
32 __le64 objectid;
33 __le32 flags;
34 __le64 offset;
35 } __attribute__ ((__packed__));
37 struct btrfs_key {
38 u64 objectid;
39 u32 flags;
40 u64 offset;
41 } __attribute__ ((__packed__));
44 * every tree block (leaf or node) starts with this header.
46 struct btrfs_header {
47 u8 fsid[16]; /* FS specific uuid */
48 __le64 blocknr; /* which block this node is supposed to live in */
49 __le64 generation;
50 __le64 parentid; /* objectid of the tree root */
51 __le32 csum;
52 __le32 ham;
53 __le16 nritems;
54 __le16 flags;
55 u8 level;
56 } __attribute__ ((__packed__));
58 #define BTRFS_MAX_LEVEL 8
59 #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->blocksize - \
60 sizeof(struct btrfs_header)) / \
61 (sizeof(struct btrfs_disk_key) + sizeof(u64)))
62 #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
63 #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
65 struct btrfs_buffer;
67 * the super block basically lists the main trees of the FS
68 * it currently lacks any block count etc etc
70 struct btrfs_super_block {
71 u8 fsid[16]; /* FS specific uuid */
72 __le64 blocknr; /* this block number */
73 __le32 csum;
74 __le64 magic;
75 __le32 blocksize;
76 __le64 generation;
77 __le64 root;
78 __le64 total_blocks;
79 __le64 blocks_used;
80 __le64 root_dir_objectid;
81 } __attribute__ ((__packed__));
84 * A leaf is full of items. offset and size tell us where to find
85 * the item in the leaf (relative to the start of the data area)
87 struct btrfs_item {
88 struct btrfs_disk_key key;
89 __le32 offset;
90 __le16 size;
91 } __attribute__ ((__packed__));
94 * leaves have an item area and a data area:
95 * [item0, item1....itemN] [free space] [dataN...data1, data0]
97 * The data is separate from the items to get the keys closer together
98 * during searches.
100 struct btrfs_leaf {
101 struct btrfs_header header;
102 struct btrfs_item items[];
103 } __attribute__ ((__packed__));
106 * all non-leaf blocks are nodes, they hold only keys and pointers to
107 * other blocks
109 struct btrfs_key_ptr {
110 struct btrfs_disk_key key;
111 __le64 blockptr;
112 } __attribute__ ((__packed__));
114 struct btrfs_node {
115 struct btrfs_header header;
116 struct btrfs_key_ptr ptrs[];
117 } __attribute__ ((__packed__));
120 * btrfs_paths remember the path taken from the root down to the leaf.
121 * level 0 is always the leaf, and nodes[1...BTRFS_MAX_LEVEL] will point
122 * to any other levels that are present.
124 * The slots array records the index of the item or block pointer
125 * used while walking the tree.
127 struct btrfs_path {
128 struct btrfs_buffer *nodes[BTRFS_MAX_LEVEL];
129 int slots[BTRFS_MAX_LEVEL];
133 * items in the extent btree are used to record the objectid of the
134 * owner of the block and the number of references
136 struct btrfs_extent_item {
137 __le32 refs;
138 __le64 owner;
139 } __attribute__ ((__packed__));
141 struct btrfs_inode_timespec {
142 __le32 sec;
143 __le32 nsec;
144 } __attribute__ ((__packed__));
147 * there is no padding here on purpose. If you want to extent the inode,
148 * make a new item type
150 struct btrfs_inode_item {
151 __le64 generation;
152 __le64 size;
153 __le64 nblocks;
154 __le32 nlink;
155 __le32 uid;
156 __le32 gid;
157 __le32 mode;
158 __le32 rdev;
159 __le16 flags;
160 __le16 compat_flags;
161 struct btrfs_inode_timespec atime;
162 struct btrfs_inode_timespec ctime;
163 struct btrfs_inode_timespec mtime;
164 struct btrfs_inode_timespec otime;
165 } __attribute__ ((__packed__));
167 /* inline data is just a blob of bytes */
168 struct btrfs_inline_data_item {
169 u8 data;
170 } __attribute__ ((__packed__));
172 struct btrfs_dir_item {
173 __le64 objectid;
174 __le16 flags;
175 __le16 name_len;
176 u8 type;
177 } __attribute__ ((__packed__));
179 struct btrfs_root_item {
180 __le64 blocknr;
181 __le32 flags;
182 __le64 block_limit;
183 __le64 blocks_used;
184 __le32 refs;
185 } __attribute__ ((__packed__));
187 struct btrfs_file_extent_item {
188 __le64 generation;
190 * disk space consumed by the extent, checksum blocks are included
191 * in these numbers
193 __le64 disk_blocknr;
194 __le64 disk_num_blocks;
196 * the logical offset in file blocks (no csums)
197 * this extent record is for. This allows a file extent to point
198 * into the middle of an existing extent on disk, sharing it
199 * between two snapshots (useful if some bytes in the middle of the
200 * extent have changed
202 __le64 offset;
204 * the logical number of file blocks (no csums included)
206 __le64 num_blocks;
207 } __attribute__ ((__packed__));
209 struct btrfs_inode_map_item {
210 struct btrfs_disk_key key;
211 } __attribute__ ((__packed__));
213 struct btrfs_fs_info {
214 struct btrfs_root *fs_root;
215 struct btrfs_root *extent_root;
216 struct btrfs_root *tree_root;
217 struct btrfs_root *inode_root;
218 struct btrfs_key current_insert;
219 struct btrfs_key last_insert;
220 struct radix_tree_root cache_radix;
221 struct radix_tree_root pinned_radix;
222 struct list_head trans;
223 struct list_head cache;
224 u64 last_inode_alloc;
225 u64 last_inode_alloc_dirid;
226 u64 generation;
227 int cache_size;
228 int fp;
229 struct btrfs_trans_handle *running_transaction;
230 struct btrfs_super_block *disk_super;
234 * in ram representation of the tree. extent_root is used for all allocations
235 * and for the extent tree extent_root root. current_insert is used
236 * only for the extent tree.
238 struct btrfs_root {
239 struct btrfs_buffer *node;
240 struct btrfs_buffer *commit_root;
241 struct btrfs_root_item root_item;
242 struct btrfs_key root_key;
243 struct btrfs_fs_info *fs_info;
244 u32 blocksize;
245 int ref_cows;
246 u32 type;
249 /* the lower bits in the key flags defines the item type */
250 #define BTRFS_KEY_TYPE_MAX 256
251 #define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
254 * inode items have the data typically returned from stat and store other
255 * info about object characteristics. There is one for every file and dir in
256 * the FS
258 #define BTRFS_INODE_ITEM_KEY 1
261 * dir items are the name -> inode pointers in a directory. There is one
262 * for every name in a directory.
264 #define BTRFS_DIR_ITEM_KEY 2
266 * inline data is file data that fits in the btree.
268 #define BTRFS_INLINE_DATA_KEY 3
270 * extent data is for data that can't fit in the btree. It points to
271 * a (hopefully) huge chunk of disk
273 #define BTRFS_EXTENT_DATA_KEY 4
275 * root items point to tree roots. There are typically in the root
276 * tree used by the super block to find all the other trees
278 #define BTRFS_ROOT_ITEM_KEY 5
280 * extent items are in the extent map tree. These record which blocks
281 * are used, and how many references there are to each block
283 #define BTRFS_EXTENT_ITEM_KEY 6
286 * the inode map records which inode numbers are in use and where
287 * they actually live on disk
289 #define BTRFS_INODE_MAP_ITEM_KEY 7
291 * string items are for debugging. They just store a short string of
292 * data in the FS
294 #define BTRFS_STRING_ITEM_KEY 8
296 static inline u64 btrfs_inode_generation(struct btrfs_inode_item *i)
298 return le64_to_cpu(i->generation);
301 static inline void btrfs_set_inode_generation(struct btrfs_inode_item *i,
302 u64 val)
304 i->generation = cpu_to_le64(val);
307 static inline u64 btrfs_inode_size(struct btrfs_inode_item *i)
309 return le64_to_cpu(i->size);
312 static inline void btrfs_set_inode_size(struct btrfs_inode_item *i, u64 val)
314 i->size = cpu_to_le64(val);
317 static inline u64 btrfs_inode_nblocks(struct btrfs_inode_item *i)
319 return le64_to_cpu(i->nblocks);
322 static inline void btrfs_set_inode_nblocks(struct btrfs_inode_item *i, u64 val)
324 i->nblocks = cpu_to_le64(val);
327 static inline u32 btrfs_inode_nlink(struct btrfs_inode_item *i)
329 return le32_to_cpu(i->nlink);
332 static inline void btrfs_set_inode_nlink(struct btrfs_inode_item *i, u32 val)
334 i->nlink = cpu_to_le32(val);
337 static inline u32 btrfs_inode_uid(struct btrfs_inode_item *i)
339 return le32_to_cpu(i->uid);
342 static inline void btrfs_set_inode_uid(struct btrfs_inode_item *i, u32 val)
344 i->uid = cpu_to_le32(val);
347 static inline u32 btrfs_inode_gid(struct btrfs_inode_item *i)
349 return le32_to_cpu(i->gid);
352 static inline void btrfs_set_inode_gid(struct btrfs_inode_item *i, u32 val)
354 i->gid = cpu_to_le32(val);
357 static inline u32 btrfs_inode_mode(struct btrfs_inode_item *i)
359 return le32_to_cpu(i->mode);
362 static inline void btrfs_set_inode_mode(struct btrfs_inode_item *i, u32 val)
364 i->mode = cpu_to_le32(val);
367 static inline u32 btrfs_inode_rdev(struct btrfs_inode_item *i)
369 return le32_to_cpu(i->rdev);
372 static inline void btrfs_set_inode_rdev(struct btrfs_inode_item *i, u32 val)
374 i->rdev = cpu_to_le32(val);
377 static inline u16 btrfs_inode_flags(struct btrfs_inode_item *i)
379 return le16_to_cpu(i->flags);
382 static inline void btrfs_set_inode_flags(struct btrfs_inode_item *i, u16 val)
384 i->flags = cpu_to_le16(val);
387 static inline u16 btrfs_inode_compat_flags(struct btrfs_inode_item *i)
389 return le16_to_cpu(i->compat_flags);
392 static inline void btrfs_set_inode_compat_flags(struct btrfs_inode_item *i,
393 u16 val)
395 i->compat_flags = cpu_to_le16(val);
399 static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
401 return le64_to_cpu(ei->owner);
404 static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
406 ei->owner = cpu_to_le64(val);
409 static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei)
411 return le32_to_cpu(ei->refs);
414 static inline void btrfs_set_extent_refs(struct btrfs_extent_item *ei, u32 val)
416 ei->refs = cpu_to_le32(val);
419 static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
421 return le64_to_cpu(n->ptrs[nr].blockptr);
424 static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr,
425 u64 val)
427 n->ptrs[nr].blockptr = cpu_to_le64(val);
430 static inline u32 btrfs_item_offset(struct btrfs_item *item)
432 return le32_to_cpu(item->offset);
435 static inline void btrfs_set_item_offset(struct btrfs_item *item, u32 val)
437 item->offset = cpu_to_le32(val);
440 static inline u32 btrfs_item_end(struct btrfs_item *item)
442 return le32_to_cpu(item->offset) + le16_to_cpu(item->size);
445 static inline u16 btrfs_item_size(struct btrfs_item *item)
447 return le16_to_cpu(item->size);
450 static inline void btrfs_set_item_size(struct btrfs_item *item, u16 val)
452 item->size = cpu_to_le16(val);
455 static inline u64 btrfs_dir_objectid(struct btrfs_dir_item *d)
457 return le64_to_cpu(d->objectid);
460 static inline void btrfs_set_dir_objectid(struct btrfs_dir_item *d, u64 val)
462 d->objectid = cpu_to_le64(val);
465 static inline u16 btrfs_dir_flags(struct btrfs_dir_item *d)
467 return le16_to_cpu(d->flags);
470 static inline void btrfs_set_dir_flags(struct btrfs_dir_item *d, u16 val)
472 d->flags = cpu_to_le16(val);
475 static inline u8 btrfs_dir_type(struct btrfs_dir_item *d)
477 return d->type;
480 static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val)
482 d->type = val;
485 static inline u16 btrfs_dir_name_len(struct btrfs_dir_item *d)
487 return le16_to_cpu(d->name_len);
490 static inline void btrfs_set_dir_name_len(struct btrfs_dir_item *d, u16 val)
492 d->name_len = cpu_to_le16(val);
495 static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
496 struct btrfs_disk_key *disk)
498 cpu->offset = le64_to_cpu(disk->offset);
499 cpu->flags = le32_to_cpu(disk->flags);
500 cpu->objectid = le64_to_cpu(disk->objectid);
503 static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
504 struct btrfs_key *cpu)
506 disk->offset = cpu_to_le64(cpu->offset);
507 disk->flags = cpu_to_le32(cpu->flags);
508 disk->objectid = cpu_to_le64(cpu->objectid);
511 static inline u64 btrfs_disk_key_objectid(struct btrfs_disk_key *disk)
513 return le64_to_cpu(disk->objectid);
516 static inline void btrfs_set_disk_key_objectid(struct btrfs_disk_key *disk,
517 u64 val)
519 disk->objectid = cpu_to_le64(val);
522 static inline u64 btrfs_disk_key_offset(struct btrfs_disk_key *disk)
524 return le64_to_cpu(disk->offset);
527 static inline void btrfs_set_disk_key_offset(struct btrfs_disk_key *disk,
528 u64 val)
530 disk->offset = cpu_to_le64(val);
533 static inline u32 btrfs_disk_key_flags(struct btrfs_disk_key *disk)
535 return le32_to_cpu(disk->flags);
538 static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key *disk,
539 u32 val)
541 disk->flags = cpu_to_le32(val);
544 static inline u32 btrfs_key_type(struct btrfs_key *key)
546 return key->flags & BTRFS_KEY_TYPE_MASK;
549 static inline u32 btrfs_disk_key_type(struct btrfs_disk_key *key)
551 return le32_to_cpu(key->flags) & BTRFS_KEY_TYPE_MASK;
554 static inline void btrfs_set_key_type(struct btrfs_key *key, u32 type)
556 BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
557 key->flags = (key->flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
560 static inline void btrfs_set_disk_key_type(struct btrfs_disk_key *key, u32 type)
562 u32 flags = btrfs_disk_key_flags(key);
563 BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
564 flags = (flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
565 btrfs_set_disk_key_flags(key, flags);
568 static inline u64 btrfs_header_blocknr(struct btrfs_header *h)
570 return le64_to_cpu(h->blocknr);
573 static inline void btrfs_set_header_blocknr(struct btrfs_header *h, u64 blocknr)
575 h->blocknr = cpu_to_le64(blocknr);
578 static inline u64 btrfs_header_generation(struct btrfs_header *h)
580 return le64_to_cpu(h->generation);
583 static inline void btrfs_set_header_generation(struct btrfs_header *h,
584 u64 val)
586 h->generation = cpu_to_le64(val);
589 static inline u64 btrfs_header_parentid(struct btrfs_header *h)
591 return le64_to_cpu(h->parentid);
594 static inline void btrfs_set_header_parentid(struct btrfs_header *h,
595 u64 parentid)
597 h->parentid = cpu_to_le64(parentid);
600 static inline u16 btrfs_header_nritems(struct btrfs_header *h)
602 return le16_to_cpu(h->nritems);
605 static inline void btrfs_set_header_nritems(struct btrfs_header *h, u16 val)
607 h->nritems = cpu_to_le16(val);
610 static inline u16 btrfs_header_flags(struct btrfs_header *h)
612 return le16_to_cpu(h->flags);
615 static inline void btrfs_set_header_flags(struct btrfs_header *h, u16 val)
617 h->flags = cpu_to_le16(val);
620 static inline int btrfs_header_level(struct btrfs_header *h)
622 return h->level;
625 static inline void btrfs_set_header_level(struct btrfs_header *h, int level)
627 BUG_ON(level > BTRFS_MAX_LEVEL);
628 h->level = 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_generation(struct btrfs_file_extent_item *e)
740 return le64_to_cpu(e->generation);
743 static inline void btrfs_set_file_extent_generation(struct
744 btrfs_file_extent_item *e,
745 u64 val)
747 e->generation = cpu_to_le64(val);
750 static inline u64 btrfs_file_extent_disk_num_blocks(struct
751 btrfs_file_extent_item *e)
753 return le64_to_cpu(e->disk_num_blocks);
756 static inline void btrfs_set_file_extent_disk_num_blocks(struct
757 btrfs_file_extent_item
758 *e, u64 val)
760 e->disk_num_blocks = cpu_to_le64(val);
763 static inline u64 btrfs_file_extent_offset(struct btrfs_file_extent_item *e)
765 return le64_to_cpu(e->offset);
768 static inline void btrfs_set_file_extent_offset(struct btrfs_file_extent_item
769 *e, u64 val)
771 e->offset = cpu_to_le64(val);
774 static inline u64 btrfs_file_extent_num_blocks(struct btrfs_file_extent_item
777 return le64_to_cpu(e->num_blocks);
780 static inline void btrfs_set_file_extent_num_blocks(struct
781 btrfs_file_extent_item *e,
782 u64 val)
784 e->num_blocks = cpu_to_le64(val);
787 /* helper function to cast into the data area of the leaf. */
788 #define btrfs_item_ptr(leaf, slot, type) \
789 ((type *)(btrfs_leaf_data(leaf) + \
790 btrfs_item_offset((leaf)->items + (slot))))
792 struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
793 struct btrfs_root *root);
794 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
795 struct btrfs_buffer *buf);
796 int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
797 *root, u64 blocknr, u64 num_blocks, int pin);
798 int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
799 *root, struct btrfs_key *key, struct btrfs_path *p, int
800 ins_len, int cow);
801 void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
802 void btrfs_init_path(struct btrfs_path *p);
803 int btrfs_del_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
804 struct btrfs_path *path);
805 int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
806 *root, struct btrfs_key *key, void *data, u32 data_size);
807 int btrfs_insert_empty_item(struct btrfs_trans_handle *trans, struct btrfs_root
808 *root, struct btrfs_path *path, struct btrfs_key
809 *cpu_key, u32 data_size);
810 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
811 int btrfs_leaf_free_space(struct btrfs_root *root, struct btrfs_leaf *leaf);
812 int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
813 *root, struct btrfs_buffer *snap);
814 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
815 btrfs_root *root);
816 int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
817 struct btrfs_key *key);
818 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
819 *root, struct btrfs_key *key, struct btrfs_root_item
820 *item);
821 int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
822 *root, struct btrfs_key *key, struct btrfs_root_item
823 *item);
824 int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
825 btrfs_root_item *item, struct btrfs_key *key);
826 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
827 *root, char *name, int name_len, u64 dir, u64
828 objectid, u8 type);
829 int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
830 *root, struct btrfs_path *path, u64 dir, char *name,
831 int name_len, int mod);
832 int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path,
833 char *name, int name_len);
834 int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
835 struct btrfs_root *fs_root,
836 u64 dirid, u64 *objectid);
837 int btrfs_insert_inode_map(struct btrfs_trans_handle *trans,
838 struct btrfs_root *root,
839 u64 objectid, struct btrfs_key *location);
840 int btrfs_lookup_inode_map(struct btrfs_trans_handle *trans,
841 struct btrfs_root *root, struct btrfs_path *path,
842 u64 objectid, int mod);
843 int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root
844 *root, u64 objectid, struct btrfs_inode_item
845 *inode_item);
846 int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
847 *root, struct btrfs_path *path, u64 objectid, int mod);
848 #endif