2 * Copyright (C) 2007 Oracle. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 021110-1307, USA.
23 #include "kerncompat.h"
24 #include "radix-tree.h"
25 #include "extent-cache.h"
27 struct btrfs_trans_handle;
28 #define BTRFS_MAGIC "_B2RfS_M"
30 #define BTRFS_ROOT_TREE_OBJECTID 1ULL
31 #define BTRFS_EXTENT_TREE_OBJECTID 2ULL
32 #define BTRFS_FS_TREE_OBJECTID 3ULL
33 #define BTRFS_ROOT_TREE_DIR_OBJECTID 4ULL
34 #define BTRFS_FIRST_FREE_OBJECTID 5ULL
37 * we can actually store much bigger names, but lets not confuse the rest
40 #define BTRFS_NAME_LEN 255
42 /* 32 bytes in various csum fields */
43 #define BTRFS_CSUM_SIZE 32
44 /* four bytes for CRC32 */
45 #define BTRFS_CRC32_SIZE 4
47 #define BTRFS_FT_UNKNOWN 0
48 #define BTRFS_FT_REG_FILE 1
49 #define BTRFS_FT_DIR 2
50 #define BTRFS_FT_CHRDEV 3
51 #define BTRFS_FT_BLKDEV 4
52 #define BTRFS_FT_FIFO 5
53 #define BTRFS_FT_SOCK 6
54 #define BTRFS_FT_SYMLINK 7
55 #define BTRFS_FT_XATTR 8
56 #define BTRFS_FT_MAX 9
59 * the key defines the order in the tree, and so it also defines (optimal)
60 * block layout. objectid corresonds to the inode number. The flags
61 * tells us things about the object, and is a kind of stream selector.
62 * so for a given inode, keys with flags of 1 might refer to the inode
63 * data, flags of 2 may point to file data in the btree and flags == 3
64 * may point to extents.
66 * offset is the starting byte offset for this key in the stream.
68 * btrfs_disk_key is in disk byte order. struct btrfs_key is always
69 * in cpu native order. Otherwise they are identical and their sizes
70 * should be the same (ie both packed)
72 struct btrfs_disk_key {
76 } __attribute__ ((__packed__));
82 } __attribute__ ((__packed__));
85 * every tree block (leaf or node) starts with this header.
88 u8 csum[BTRFS_CSUM_SIZE];
89 u8 fsid[16]; /* FS specific uuid */
90 __le64 bytenr; /* which block this node is supposed to live in */
96 } __attribute__ ((__packed__));
98 #define BTRFS_MAX_LEVEL 8
99 #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
100 sizeof(struct btrfs_header)) / \
101 sizeof(struct btrfs_key_ptr))
102 #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
103 #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->leafsize))
104 #define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
105 sizeof(struct btrfs_item) - \
106 sizeof(struct btrfs_file_extent_item))
109 * the super block basically lists the main trees of the FS
110 * it currently lacks any block count etc etc
112 struct btrfs_super_block {
113 u8 csum[BTRFS_CSUM_SIZE];
114 /* the first 3 fields must match struct btrfs_header */
115 u8 fsid[16]; /* FS specific uuid */
116 __le64 bytenr; /* this block number */
122 __le64 root_dir_objectid;
128 } __attribute__ ((__packed__));
131 * A leaf is full of items. offset and size tell us where to find
132 * the item in the leaf (relative to the start of the data area)
135 struct btrfs_disk_key key;
138 } __attribute__ ((__packed__));
141 * leaves have an item area and a data area:
142 * [item0, item1....itemN] [free space] [dataN...data1, data0]
144 * The data is separate from the items to get the keys closer together
148 struct btrfs_header header;
149 struct btrfs_item items[];
150 } __attribute__ ((__packed__));
153 * all non-leaf blocks are nodes, they hold only keys and pointers to
156 struct btrfs_key_ptr {
157 struct btrfs_disk_key key;
160 } __attribute__ ((__packed__));
163 struct btrfs_header header;
164 struct btrfs_key_ptr ptrs[];
165 } __attribute__ ((__packed__));
168 * btrfs_paths remember the path taken from the root down to the leaf.
169 * level 0 is always the leaf, and nodes[1...BTRFS_MAX_LEVEL] will point
170 * to any other levels that are present.
172 * The slots array records the index of the item or block pointer
173 * used while walking the tree.
176 struct btrfs_buffer *nodes[BTRFS_MAX_LEVEL];
177 int slots[BTRFS_MAX_LEVEL];
181 * items in the extent btree are used to record the objectid of the
182 * owner of the block and the number of references
184 struct btrfs_extent_item {
186 } __attribute__ ((__packed__));
188 struct btrfs_extent_ref {
193 } __attribute__ ((__packed__));
195 struct btrfs_inode_ref {
198 } __attribute__ ((__packed__));
200 struct btrfs_inode_timespec {
203 } __attribute__ ((__packed__));
206 * there is no padding here on purpose. If you want to extent the inode,
207 * make a new item type
209 struct btrfs_inode_item {
221 struct btrfs_inode_timespec atime;
222 struct btrfs_inode_timespec ctime;
223 struct btrfs_inode_timespec mtime;
224 struct btrfs_inode_timespec otime;
225 } __attribute__ ((__packed__));
227 /* inline data is just a blob of bytes */
228 struct btrfs_inline_data_item {
230 } __attribute__ ((__packed__));
232 struct btrfs_dir_item {
233 struct btrfs_disk_key location;
237 } __attribute__ ((__packed__));
239 struct btrfs_root_item {
240 struct btrfs_inode_item inode;
247 struct btrfs_disk_key drop_progress;
250 } __attribute__ ((__packed__));
252 #define BTRFS_FILE_EXTENT_REG 0
253 #define BTRFS_FILE_EXTENT_INLINE 1
255 struct btrfs_file_extent_item {
259 * disk space consumed by the extent, checksum blocks are included
263 __le64 disk_num_bytes;
265 * the logical offset in file blocks (no csums)
266 * this extent record is for. This allows a file extent to point
267 * into the middle of an existing extent on disk, sharing it
268 * between two snapshots (useful if some bytes in the middle of the
269 * extent have changed
273 * the logical number of file blocks (no csums included)
276 } __attribute__ ((__packed__));
278 struct btrfs_csum_item {
279 u8 csum[BTRFS_CSUM_SIZE];
280 } __attribute__ ((__packed__));
282 /* tag for the radix tree of block groups in ram */
283 #define BTRFS_BLOCK_GROUP_DIRTY 0
284 #define BTRFS_BLOCK_GROUP_SIZE (256 * 1024 * 1024)
287 #define BTRFS_BLOCK_GROUP_DATA 1
288 struct btrfs_block_group_item {
291 } __attribute__ ((__packed__));
293 struct btrfs_block_group_cache {
294 struct cache_extent cache;
295 struct btrfs_key key;
296 struct btrfs_block_group_item item;
300 struct btrfs_fs_info {
301 struct btrfs_root *fs_root;
302 struct btrfs_root *extent_root;
303 struct btrfs_root *tree_root;
304 struct btrfs_key last_insert;
305 struct cache_tree extent_cache;
306 struct cache_tree block_group_cache;
307 struct cache_tree pending_tree;
308 struct cache_tree pinned_tree;
309 struct cache_tree del_pending;
310 struct list_head trans;
311 struct list_head cache;
312 u64 last_inode_alloc;
313 u64 last_inode_alloc_dirid;
317 struct btrfs_trans_handle *running_transaction;
318 struct btrfs_super_block *disk_super;
322 * in ram representation of the tree. extent_root is used for all allocations
323 * and for the extent tree extent_root root.
326 struct btrfs_buffer *node;
327 struct btrfs_buffer *commit_root;
328 struct btrfs_root_item root_item;
329 struct btrfs_key root_key;
330 struct btrfs_fs_info *fs_info;
332 /* data allocations are done in sectorsize units */
335 /* node allocations are done in nodesize units */
338 /* leaf allocations are done in leafsize units */
341 /* leaf allocations are done in leafsize units */
348 /* the lower bits in the key flags defines the item type */
349 #define BTRFS_KEY_TYPE_MAX 256
350 #define BTRFS_KEY_TYPE_SHIFT 24
351 #define BTRFS_KEY_TYPE_MASK (((u32)BTRFS_KEY_TYPE_MAX - 1) << \
352 BTRFS_KEY_TYPE_SHIFT)
355 * inode items have the data typically returned from stat and store other
356 * info about object characteristics. There is one for every file and dir in
359 #define BTRFS_INODE_ITEM_KEY 1
360 #define BTRFS_INODE_REF_KEY 2
361 #define BTRFS_XATTR_ITEM_KEY 8
363 /* reserve 3-15 close to the inode for later flexibility */
366 * dir items are the name -> inode pointers in a directory. There is one
367 * for every name in a directory.
369 #define BTRFS_DIR_ITEM_KEY 16
370 #define BTRFS_DIR_INDEX_KEY 17
372 * extent data is for file data
374 #define BTRFS_EXTENT_DATA_KEY 18
376 * csum items have the checksums for data in the extents
378 #define BTRFS_CSUM_ITEM_KEY 19
380 /* reserve 20-31 for other file stuff */
383 * root items point to tree roots. There are typically in the root
384 * tree used by the super block to find all the other trees
386 #define BTRFS_ROOT_ITEM_KEY 32
388 * extent items are in the extent map tree. These record which blocks
389 * are used, and how many references there are to each block
391 #define BTRFS_EXTENT_ITEM_KEY 33
392 #define BTRFS_EXTENT_REF_KEY 34
395 * block groups give us hints into the extent allocation trees. Which
396 * blocks are free etc etc
398 #define BTRFS_BLOCK_GROUP_ITEM_KEY 50
401 * string items are for debugging. They just store a short string of
404 #define BTRFS_STRING_ITEM_KEY 253
406 #define BTRFS_SETGET_STACK_FUNCS(name, type, member, bits) \
407 static inline u##bits btrfs_##name(type *s) \
409 return le##bits##_to_cpu(s->member); \
411 static inline void btrfs_set_##name(type *s, u##bits val) \
413 s->member = cpu_to_le##bits(val); \
416 BTRFS_SETGET_STACK_FUNCS(block_group_used, struct btrfs_block_group_item,
419 BTRFS_SETGET_STACK_FUNCS(inode_generation, struct btrfs_inode_item,
422 BTRFS_SETGET_STACK_FUNCS(inode_size, struct btrfs_inode_item, size, 64);
423 BTRFS_SETGET_STACK_FUNCS(inode_nblocks, struct btrfs_inode_item, nblocks, 64);
424 BTRFS_SETGET_STACK_FUNCS(inode_block_group, struct btrfs_inode_item,
426 BTRFS_SETGET_STACK_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
427 BTRFS_SETGET_STACK_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
428 BTRFS_SETGET_STACK_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
429 BTRFS_SETGET_STACK_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
430 BTRFS_SETGET_STACK_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 32);
431 BTRFS_SETGET_STACK_FUNCS(inode_flags, struct btrfs_inode_item, flags, 16);
432 BTRFS_SETGET_STACK_FUNCS(inode_compat_flags, struct btrfs_inode_item,
435 BTRFS_SETGET_STACK_FUNCS(timpsec_sec, struct btrfs_inode_timespec, sec, 64);
436 BTRFS_SETGET_STACK_FUNCS(timpsec_nsec, struct btrfs_inode_timespec, nsec, 32);
437 BTRFS_SETGET_STACK_FUNCS(extent_refs, struct btrfs_extent_item, refs, 32);
439 BTRFS_SETGET_STACK_FUNCS(inode_ref_name_len, struct btrfs_inode_ref,
443 BTRFS_SETGET_STACK_FUNCS(ref_root, struct btrfs_extent_ref, root, 64);
444 BTRFS_SETGET_STACK_FUNCS(ref_generation, struct btrfs_extent_ref,
446 BTRFS_SETGET_STACK_FUNCS(ref_objectid, struct btrfs_extent_ref, objectid, 64);
447 BTRFS_SETGET_STACK_FUNCS(ref_offset, struct btrfs_extent_ref, offset, 64);
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 u64 btrfs_node_ptr_generation(struct btrfs_node *n, int nr)
462 return le64_to_cpu(n->ptrs[nr].generation);
465 static inline void btrfs_set_node_ptr_generation(struct btrfs_node *n, int nr,
468 n->ptrs[nr].generation = cpu_to_le64(val);
471 BTRFS_SETGET_STACK_FUNCS(item_offset, struct btrfs_item, offset, 32);
473 static inline u32 btrfs_item_end(struct btrfs_item *item)
475 return le32_to_cpu(item->offset) + le32_to_cpu(item->size);
478 BTRFS_SETGET_STACK_FUNCS(item_size, struct btrfs_item, size, 32);
479 BTRFS_SETGET_STACK_FUNCS(dir_type, struct btrfs_dir_item, type, 8);
480 BTRFS_SETGET_STACK_FUNCS(dir_name_len, struct btrfs_dir_item, name_len, 16);
481 BTRFS_SETGET_STACK_FUNCS(dir_data_len, struct btrfs_dir_item, data_len, 16);
483 static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
484 struct btrfs_disk_key *disk)
486 cpu->offset = le64_to_cpu(disk->offset);
487 cpu->type = le32_to_cpu(disk->type);
488 cpu->objectid = le64_to_cpu(disk->objectid);
491 static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
492 struct btrfs_key *cpu)
494 disk->offset = cpu_to_le64(cpu->offset);
495 disk->type = cpu_to_le32(cpu->type);
496 disk->objectid = cpu_to_le64(cpu->objectid);
499 BTRFS_SETGET_STACK_FUNCS(disk_key_objectid, struct btrfs_disk_key,
501 BTRFS_SETGET_STACK_FUNCS(disk_key_offset, struct btrfs_disk_key, offset, 64);
502 BTRFS_SETGET_STACK_FUNCS(disk_key_type, struct btrfs_disk_key, type, 8);
504 static inline u8 btrfs_key_type(struct btrfs_key *key)
509 static inline void btrfs_set_key_type(struct btrfs_key *key, u8 val)
514 BTRFS_SETGET_STACK_FUNCS(header_bytenr, struct btrfs_header, bytenr, 64);
515 BTRFS_SETGET_STACK_FUNCS(header_generation, struct btrfs_header,
517 BTRFS_SETGET_STACK_FUNCS(header_owner, struct btrfs_header, owner, 64);
518 BTRFS_SETGET_STACK_FUNCS(header_nritems, struct btrfs_header, nritems, 32);
519 BTRFS_SETGET_STACK_FUNCS(header_flags, struct btrfs_header, flags, 16);
521 static inline int btrfs_header_level(struct btrfs_header *h)
526 static inline void btrfs_set_header_level(struct btrfs_header *h, int level)
528 BUG_ON(level > BTRFS_MAX_LEVEL);
532 static inline int btrfs_is_leaf(struct btrfs_node *n)
534 return (btrfs_header_level(&n->header) == 0);
537 BTRFS_SETGET_STACK_FUNCS(root_bytenr, struct btrfs_root_item, bytenr, 64);
538 BTRFS_SETGET_STACK_FUNCS(root_byte_limit, struct btrfs_root_item,
540 BTRFS_SETGET_STACK_FUNCS(root_level, struct btrfs_root_item, level, 8);
541 BTRFS_SETGET_STACK_FUNCS(root_dirid, struct btrfs_root_item, root_dirid, 64);
542 BTRFS_SETGET_STACK_FUNCS(root_refs, struct btrfs_root_item, refs, 32);
543 BTRFS_SETGET_STACK_FUNCS(root_flags, struct btrfs_root_item, flags, 32);
544 BTRFS_SETGET_STACK_FUNCS(root_bytes_used, struct btrfs_root_item,
546 BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64);
547 BTRFS_SETGET_STACK_FUNCS(super_generation, struct btrfs_super_block,
549 BTRFS_SETGET_STACK_FUNCS(super_root_level, struct btrfs_super_block,
551 BTRFS_SETGET_STACK_FUNCS(super_root, struct btrfs_super_block, root, 64);
552 BTRFS_SETGET_STACK_FUNCS(super_total_bytes, struct btrfs_super_block,
554 BTRFS_SETGET_STACK_FUNCS(super_bytes_used, struct btrfs_super_block,
556 BTRFS_SETGET_STACK_FUNCS(super_sectorsize, struct btrfs_super_block,
558 BTRFS_SETGET_STACK_FUNCS(super_nodesize, struct btrfs_super_block,
560 BTRFS_SETGET_STACK_FUNCS(super_leafsize, struct btrfs_super_block,
562 BTRFS_SETGET_STACK_FUNCS(super_stripesize, struct btrfs_super_block,
564 BTRFS_SETGET_STACK_FUNCS(super_root_dir, struct btrfs_super_block,
565 root_dir_objectid, 64);
567 static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
569 return (u8 *)l->items;
572 BTRFS_SETGET_STACK_FUNCS(file_extent_type, struct btrfs_file_extent_item,
575 static inline char *btrfs_file_extent_inline_start(struct
576 btrfs_file_extent_item *e)
578 return (char *)(&e->disk_bytenr);
581 static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize)
583 return (unsigned long)(&((struct
584 btrfs_file_extent_item *)NULL)->disk_bytenr) + datasize;
587 static inline u32 btrfs_file_extent_inline_len(struct btrfs_item *e)
589 struct btrfs_file_extent_item *fe = NULL;
590 return btrfs_item_size(e) - (unsigned long)(&fe->disk_bytenr);
593 BTRFS_SETGET_STACK_FUNCS(file_extent_disk_bytenr, struct btrfs_file_extent_item,
595 BTRFS_SETGET_STACK_FUNCS(file_extent_generation, struct btrfs_file_extent_item,
597 BTRFS_SETGET_STACK_FUNCS(file_extent_disk_num_bytes,
598 struct btrfs_file_extent_item, disk_num_bytes, 64);
599 BTRFS_SETGET_STACK_FUNCS(file_extent_offset, struct btrfs_file_extent_item,
601 BTRFS_SETGET_STACK_FUNCS(file_extent_num_bytes, struct btrfs_file_extent_item,
604 /* helper function to cast into the data area of the leaf. */
605 #define btrfs_item_ptr(leaf, slot, type) \
606 ((type *)(btrfs_leaf_data(leaf) + \
607 btrfs_item_offset((leaf)->items + (slot))))
608 #define btrfs_item_ptr_offset(leaf, slot) \
609 ((unsigned long)(btrfs_leaf_data(leaf) + \
610 btrfs_item_offset_nr(leaf, slot)))
612 static inline u32 btrfs_level_size(struct btrfs_root *root, int level)
615 return root->leafsize;
616 return root->nodesize;
618 int btrfs_comp_keys(struct btrfs_disk_key *disk, struct btrfs_key *k2);
619 struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
620 struct btrfs_root *root,
622 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
623 struct btrfs_buffer *buf);
624 int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
625 struct btrfs_root *root, u64 owner_objectid);
626 int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
627 *root, u64 bytenr, u64 num_bytes,
628 u64 root_objectid, u64 root_generation,
629 u64 owner, u64 owner_offset, int pin);
630 int btrfs_cow_block(struct btrfs_trans_handle *trans,
631 struct btrfs_root *root, struct btrfs_buffer *buf,
632 struct btrfs_buffer *parent, int parent_slot,
633 struct btrfs_buffer **cow_ret);
634 int btrfs_extend_item(struct btrfs_trans_handle *trans, struct btrfs_root
635 *root, struct btrfs_path *path, u32 data_size);
636 int btrfs_truncate_item(struct btrfs_trans_handle *trans,
637 struct btrfs_root *root,
638 struct btrfs_path *path,
639 u32 new_size, int from_end);
640 int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root
641 *root, struct btrfs_key *key, struct btrfs_path *p, int
643 void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
644 void btrfs_init_path(struct btrfs_path *p);
645 int btrfs_del_item(struct btrfs_trans_handle *trans, struct btrfs_root *root,
646 struct btrfs_path *path);
647 int btrfs_insert_item(struct btrfs_trans_handle *trans, struct btrfs_root
648 *root, struct btrfs_key *key, void *data, u32 data_size);
649 int btrfs_insert_empty_item(struct btrfs_trans_handle *trans, struct btrfs_root
650 *root, struct btrfs_path *path, struct btrfs_key
651 *cpu_key, u32 data_size);
652 int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
653 int btrfs_leaf_free_space(struct btrfs_root *root, struct btrfs_leaf *leaf);
654 int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root
655 *root, struct btrfs_buffer *snap);
656 int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, struct
658 int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
659 struct btrfs_key *key);
660 int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root
661 *root, struct btrfs_key *key, struct btrfs_root_item
663 int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
664 *root, struct btrfs_key *key, struct btrfs_root_item
666 int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
667 btrfs_root_item *item, struct btrfs_key *key);
668 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
669 *root, char *name, int name_len, u64 dir,
670 struct btrfs_key *location, u8 type);
671 struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
672 struct btrfs_root *root, struct btrfs_path *path,
673 u64 dir, char *name, int name_len, int mod);
674 struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
675 struct btrfs_path *path,
676 const char *name, int name_len);
677 int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
678 struct btrfs_root *root,
679 struct btrfs_path *path,
680 struct btrfs_dir_item *di);
681 int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
682 struct btrfs_root *fs_root,
683 u64 dirid, u64 *objectid);
684 int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root
685 *root, u64 objectid, struct btrfs_inode_item
687 int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
688 *root, struct btrfs_path *path, u64 objectid, int mod);
689 int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans,
690 struct btrfs_root *root);
691 int btrfs_free_block_groups(struct btrfs_fs_info *info);
692 int btrfs_read_block_groups(struct btrfs_root *root);
693 int btrfs_insert_block_group(struct btrfs_trans_handle *trans,
694 struct btrfs_root *root,
695 struct btrfs_key *key,
696 struct btrfs_block_group_item *bi);
698 int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
699 struct btrfs_root *root,
700 u64 objectid, u64 pos, u64 offset,
701 u64 disk_num_bytes, u64 num_bytes);
702 int btrfs_insert_inline_file_extent(struct btrfs_trans_handle *trans,
703 struct btrfs_root *root, u64 objectid,
704 u64 offset, char *buffer, size_t size);
705 int btrfs_lookup_csum(struct btrfs_trans_handle *trans, struct btrfs_root
706 *root, struct btrfs_path *path, u64 objectid,
707 u64 offset, int cow, struct btrfs_csum_item **item_ret);
708 int btrfs_csum_file_block(struct btrfs_trans_handle *trans, struct btrfs_root
709 *root, struct btrfs_inode_item *inode,
710 u64 objectid, u64 offset, char *data, size_t len);
711 int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
712 struct btrfs_root *root,
713 const char *name, int name_len,
714 u64 inode_objectid, u64 ref_objectid);