ctree.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. #ifndef __BTRFS__
  2. #define __BTRFS__
  3. #include "list.h"
  4. #include "kerncompat.h"
  5. #define BTRFS_MAGIC "_BtRfS_M"
  6. #define BTRFS_ROOT_TREE_OBJECTID 1
  7. #define BTRFS_EXTENT_TREE_OBJECTID 2
  8. #define BTRFS_FS_TREE_OBJECTID 3
  9. /*
  10. * the key defines the order in the tree, and so it also defines (optimal)
  11. * block layout. objectid corresonds to the inode number. The flags
  12. * tells us things about the object, and is a kind of stream selector.
  13. * so for a given inode, keys with flags of 1 might refer to the inode
  14. * data, flags of 2 may point to file data in the btree and flags == 3
  15. * may point to extents.
  16. *
  17. * offset is the starting byte offset for this key in the stream.
  18. *
  19. * btrfs_disk_key is in disk byte order. struct btrfs_key is always
  20. * in cpu native order. Otherwise they are identical and their sizes
  21. * should be the same (ie both packed)
  22. */
  23. struct btrfs_disk_key {
  24. __le64 objectid;
  25. __le64 offset;
  26. __le32 flags;
  27. } __attribute__ ((__packed__));
  28. struct btrfs_key {
  29. u64 objectid;
  30. u64 offset;
  31. u32 flags;
  32. } __attribute__ ((__packed__));
  33. /*
  34. * every tree block (leaf or node) starts with this header.
  35. */
  36. struct btrfs_header {
  37. u8 fsid[16]; /* FS specific uuid */
  38. __le64 blocknr; /* which block this node is supposed to live in */
  39. __le64 parentid; /* objectid of the tree root */
  40. __le32 csum;
  41. __le32 ham;
  42. __le16 nritems;
  43. __le16 flags;
  44. /* generation flags to be added */
  45. } __attribute__ ((__packed__));
  46. #define BTRFS_MAX_LEVEL 8
  47. #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->blocksize - \
  48. sizeof(struct btrfs_header)) / \
  49. (sizeof(struct btrfs_disk_key) + sizeof(u64)))
  50. #define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
  51. #define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
  52. struct btrfs_buffer;
  53. /*
  54. * the super block basically lists the main trees of the FS
  55. * it currently lacks any block count etc etc
  56. */
  57. struct btrfs_super_block {
  58. u8 fsid[16]; /* FS specific uuid */
  59. __le64 blocknr; /* this block number */
  60. __le32 csum;
  61. __le64 magic;
  62. __le32 blocksize;
  63. __le64 generation;
  64. __le64 root;
  65. __le64 total_blocks;
  66. __le64 blocks_used;
  67. } __attribute__ ((__packed__));
  68. /*
  69. * A leaf is full of items. offset and size tell us where to find
  70. * the item in the leaf (relative to the start of the data area)
  71. */
  72. struct btrfs_item {
  73. struct btrfs_disk_key key;
  74. __le32 offset;
  75. __le16 size;
  76. } __attribute__ ((__packed__));
  77. /*
  78. * leaves have an item area and a data area:
  79. * [item0, item1....itemN] [free space] [dataN...data1, data0]
  80. *
  81. * The data is separate from the items to get the keys closer together
  82. * during searches.
  83. */
  84. struct btrfs_leaf {
  85. struct btrfs_header header;
  86. struct btrfs_item items[];
  87. } __attribute__ ((__packed__));
  88. /*
  89. * all non-leaf blocks are nodes, they hold only keys and pointers to
  90. * other blocks
  91. */
  92. struct btrfs_key_ptr {
  93. struct btrfs_disk_key key;
  94. __le64 blockptr;
  95. } __attribute__ ((__packed__));
  96. struct btrfs_node {
  97. struct btrfs_header header;
  98. struct btrfs_key_ptr ptrs[];
  99. } __attribute__ ((__packed__));
  100. /*
  101. * btrfs_paths remember the path taken from the root down to the leaf.
  102. * level 0 is always the leaf, and nodes[1...BTRFS_MAX_LEVEL] will point
  103. * to any other levels that are present.
  104. *
  105. * The slots array records the index of the item or block pointer
  106. * used while walking the tree.
  107. */
  108. struct btrfs_path {
  109. struct btrfs_buffer *nodes[BTRFS_MAX_LEVEL];
  110. int slots[BTRFS_MAX_LEVEL];
  111. };
  112. /*
  113. * items in the extent btree are used to record the objectid of the
  114. * owner of the block and the number of references
  115. */
  116. struct btrfs_extent_item {
  117. __le32 refs;
  118. __le64 owner;
  119. } __attribute__ ((__packed__));
  120. struct btrfs_inode_timespec {
  121. __le32 sec;
  122. __le32 nsec;
  123. } __attribute__ ((__packed__));
  124. /*
  125. * there is no padding here on purpose. If you want to extent the inode,
  126. * make a new item type
  127. */
  128. struct btrfs_inode_item {
  129. __le64 generation;
  130. __le64 size;
  131. __le64 nblocks;
  132. __le32 nlink;
  133. __le32 uid;
  134. __le32 gid;
  135. __le32 mode;
  136. __le32 rdev;
  137. __le16 flags;
  138. __le16 compat_flags;
  139. struct btrfs_inode_timespec atime;
  140. struct btrfs_inode_timespec ctime;
  141. struct btrfs_inode_timespec mtime;
  142. struct btrfs_inode_timespec otime;
  143. } __attribute__ ((__packed__));
  144. /* inline data is just a blob of bytes */
  145. struct btrfs_inline_data_item {
  146. u8 data;
  147. } __attribute__ ((__packed__));
  148. struct btrfs_dir_item {
  149. __le64 objectid;
  150. __le16 flags;
  151. u8 type;
  152. } __attribute__ ((__packed__));
  153. struct btrfs_root_item {
  154. __le64 blocknr;
  155. __le32 flags;
  156. __le64 block_limit;
  157. __le64 blocks_used;
  158. __le32 refs;
  159. };
  160. /*
  161. * in ram representation of the tree. extent_root is used for all allocations
  162. * and for the extent tree extent_root root. current_insert is used
  163. * only for the extent tree.
  164. */
  165. struct btrfs_root {
  166. struct btrfs_buffer *node;
  167. struct btrfs_buffer *commit_root;
  168. struct btrfs_root *extent_root;
  169. struct btrfs_root *tree_root;
  170. struct btrfs_key current_insert;
  171. struct btrfs_key last_insert;
  172. int fp;
  173. struct radix_tree_root cache_radix;
  174. struct radix_tree_root pinned_radix;
  175. struct list_head trans;
  176. struct list_head cache;
  177. int cache_size;
  178. int ref_cows;
  179. struct btrfs_root_item root_item;
  180. struct btrfs_key root_key;
  181. u32 blocksize;
  182. };
  183. /* the lower bits in the key flags defines the item type */
  184. #define BTRFS_KEY_TYPE_MAX 256
  185. #define BTRFS_KEY_TYPE_MASK (BTRFS_KEY_TYPE_MAX - 1)
  186. /*
  187. * inode items have the data typically returned from stat and store other
  188. * info about object characteristics. There is one for every file and dir in
  189. * the FS
  190. */
  191. #define BTRFS_INODE_ITEM_KEY 1
  192. /*
  193. * dir items are the name -> inode pointers in a directory. There is one
  194. * for every name in a directory.
  195. */
  196. #define BTRFS_DIR_ITEM_KEY 2
  197. /*
  198. * inline data is file data that fits in the btree.
  199. */
  200. #define BTRFS_INLINE_DATA_KEY 3
  201. /*
  202. * extent data is for data that can't fit in the btree. It points to
  203. * a (hopefully) huge chunk of disk
  204. */
  205. #define BTRFS_EXTENT_DATA_KEY 4
  206. /*
  207. * root items point to tree roots. There are typically in the root
  208. * tree used by the super block to find all the other trees
  209. */
  210. #define BTRFS_ROOT_ITEM_KEY 5
  211. /*
  212. * extent items are in the extent map tree. These record which blocks
  213. * are used, and how many references there are to each block
  214. */
  215. #define BTRFS_EXTENT_ITEM_KEY 6
  216. /*
  217. * string items are for debugging. They just store a short string of
  218. * data in the FS
  219. */
  220. #define BTRFS_STRING_ITEM_KEY 7
  221. static inline u64 btrfs_inode_generation(struct btrfs_inode_item *i)
  222. {
  223. return le64_to_cpu(i->generation);
  224. }
  225. static inline void btrfs_set_inode_generation(struct btrfs_inode_item *i,
  226. u64 val)
  227. {
  228. i->generation = cpu_to_le64(val);
  229. }
  230. static inline u64 btrfs_inode_size(struct btrfs_inode_item *i)
  231. {
  232. return le64_to_cpu(i->size);
  233. }
  234. static inline void btrfs_set_inode_size(struct btrfs_inode_item *i, u64 val)
  235. {
  236. i->size = cpu_to_le64(val);
  237. }
  238. static inline u64 btrfs_inode_nblocks(struct btrfs_inode_item *i)
  239. {
  240. return le64_to_cpu(i->nblocks);
  241. }
  242. static inline void btrfs_set_inode_nblocks(struct btrfs_inode_item *i, u64 val)
  243. {
  244. i->nblocks = cpu_to_le64(val);
  245. }
  246. static inline u32 btrfs_inode_nlink(struct btrfs_inode_item *i)
  247. {
  248. return le32_to_cpu(i->nlink);
  249. }
  250. static inline void btrfs_set_inode_nlink(struct btrfs_inode_item *i, u32 val)
  251. {
  252. i->nlink = cpu_to_le32(val);
  253. }
  254. static inline u32 btrfs_inode_uid(struct btrfs_inode_item *i)
  255. {
  256. return le32_to_cpu(i->uid);
  257. }
  258. static inline void btrfs_set_inode_uid(struct btrfs_inode_item *i, u32 val)
  259. {
  260. i->uid = cpu_to_le32(val);
  261. }
  262. static inline u32 btrfs_inode_gid(struct btrfs_inode_item *i)
  263. {
  264. return le32_to_cpu(i->gid);
  265. }
  266. static inline void btrfs_set_inode_gid(struct btrfs_inode_item *i, u32 val)
  267. {
  268. i->gid = cpu_to_le32(val);
  269. }
  270. static inline u32 btrfs_inode_mode(struct btrfs_inode_item *i)
  271. {
  272. return le32_to_cpu(i->mode);
  273. }
  274. static inline void btrfs_set_inode_mode(struct btrfs_inode_item *i, u32 val)
  275. {
  276. i->mode = cpu_to_le32(val);
  277. }
  278. static inline u32 btrfs_inode_rdev(struct btrfs_inode_item *i)
  279. {
  280. return le32_to_cpu(i->rdev);
  281. }
  282. static inline void btrfs_set_inode_rdev(struct btrfs_inode_item *i, u32 val)
  283. {
  284. i->rdev = cpu_to_le32(val);
  285. }
  286. static inline u16 btrfs_inode_flags(struct btrfs_inode_item *i)
  287. {
  288. return le16_to_cpu(i->flags);
  289. }
  290. static inline void btrfs_set_inode_flags(struct btrfs_inode_item *i, u16 val)
  291. {
  292. i->flags = cpu_to_le16(val);
  293. }
  294. static inline u16 btrfs_inode_compat_flags(struct btrfs_inode_item *i)
  295. {
  296. return le16_to_cpu(i->compat_flags);
  297. }
  298. static inline void btrfs_set_inode_compat_flags(struct btrfs_inode_item *i,
  299. u16 val)
  300. {
  301. i->compat_flags = cpu_to_le16(val);
  302. }
  303. static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
  304. {
  305. return le64_to_cpu(ei->owner);
  306. }
  307. static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
  308. {
  309. ei->owner = cpu_to_le64(val);
  310. }
  311. static inline u32 btrfs_extent_refs(struct btrfs_extent_item *ei)
  312. {
  313. return le32_to_cpu(ei->refs);
  314. }
  315. static inline void btrfs_set_extent_refs(struct btrfs_extent_item *ei, u32 val)
  316. {
  317. ei->refs = cpu_to_le32(val);
  318. }
  319. static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
  320. {
  321. return le64_to_cpu(n->ptrs[nr].blockptr);
  322. }
  323. static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr,
  324. u64 val)
  325. {
  326. n->ptrs[nr].blockptr = cpu_to_le64(val);
  327. }
  328. static inline u32 btrfs_item_offset(struct btrfs_item *item)
  329. {
  330. return le32_to_cpu(item->offset);
  331. }
  332. static inline void btrfs_set_item_offset(struct btrfs_item *item, u32 val)
  333. {
  334. item->offset = cpu_to_le32(val);
  335. }
  336. static inline u32 btrfs_item_end(struct btrfs_item *item)
  337. {
  338. return le32_to_cpu(item->offset) + le16_to_cpu(item->size);
  339. }
  340. static inline u16 btrfs_item_size(struct btrfs_item *item)
  341. {
  342. return le16_to_cpu(item->size);
  343. }
  344. static inline void btrfs_set_item_size(struct btrfs_item *item, u16 val)
  345. {
  346. item->size = cpu_to_le16(val);
  347. }
  348. static inline u64 btrfs_dir_objectid(struct btrfs_dir_item *d)
  349. {
  350. return le64_to_cpu(d->objectid);
  351. }
  352. static inline void btrfs_set_dir_objectid(struct btrfs_dir_item *d, u64 val)
  353. {
  354. d->objectid = cpu_to_le64(val);
  355. }
  356. static inline u16 btrfs_dir_flags(struct btrfs_dir_item *d)
  357. {
  358. return le16_to_cpu(d->flags);
  359. }
  360. static inline void btrfs_set_dir_flags(struct btrfs_dir_item *d, u16 val)
  361. {
  362. d->flags = cpu_to_le16(val);
  363. }
  364. static inline u8 btrfs_dir_type(struct btrfs_dir_item *d)
  365. {
  366. return d->type;
  367. }
  368. static inline void btrfs_set_dir_type(struct btrfs_dir_item *d, u8 val)
  369. {
  370. d->type = val;
  371. }
  372. static inline u32 btrfs_dir_name_len(struct btrfs_item *i)
  373. {
  374. return btrfs_item_size(i) - sizeof(struct btrfs_dir_item);
  375. }
  376. static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
  377. struct btrfs_disk_key *disk)
  378. {
  379. cpu->offset = le64_to_cpu(disk->offset);
  380. cpu->flags = le32_to_cpu(disk->flags);
  381. cpu->objectid = le64_to_cpu(disk->objectid);
  382. }
  383. static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
  384. struct btrfs_key *cpu)
  385. {
  386. disk->offset = cpu_to_le64(cpu->offset);
  387. disk->flags = cpu_to_le32(cpu->flags);
  388. disk->objectid = cpu_to_le64(cpu->objectid);
  389. }
  390. static inline u64 btrfs_disk_key_objectid(struct btrfs_disk_key *disk)
  391. {
  392. return le64_to_cpu(disk->objectid);
  393. }
  394. static inline void btrfs_set_disk_key_objectid(struct btrfs_disk_key *disk,
  395. u64 val)
  396. {
  397. disk->objectid = cpu_to_le64(val);
  398. }
  399. static inline u64 btrfs_disk_key_offset(struct btrfs_disk_key *disk)
  400. {
  401. return le64_to_cpu(disk->offset);
  402. }
  403. static inline void btrfs_set_disk_key_offset(struct btrfs_disk_key *disk,
  404. u64 val)
  405. {
  406. disk->offset = cpu_to_le64(val);
  407. }
  408. static inline u32 btrfs_disk_key_flags(struct btrfs_disk_key *disk)
  409. {
  410. return le32_to_cpu(disk->flags);
  411. }
  412. static inline void btrfs_set_disk_key_flags(struct btrfs_disk_key *disk,
  413. u32 val)
  414. {
  415. disk->flags = cpu_to_le32(val);
  416. }
  417. static inline u32 btrfs_key_type(struct btrfs_key *key)
  418. {
  419. return key->flags & BTRFS_KEY_TYPE_MASK;
  420. }
  421. static inline u32 btrfs_disk_key_type(struct btrfs_disk_key *key)
  422. {
  423. return le32_to_cpu(key->flags) & BTRFS_KEY_TYPE_MASK;
  424. }
  425. static inline void btrfs_set_key_type(struct btrfs_key *key, u32 type)
  426. {
  427. BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
  428. key->flags = (key->flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
  429. }
  430. static inline void btrfs_set_disk_key_type(struct btrfs_disk_key *key, u32 type)
  431. {
  432. u32 flags = btrfs_disk_key_flags(key);
  433. BUG_ON(type >= BTRFS_KEY_TYPE_MAX);
  434. flags = (flags & ~((u64)BTRFS_KEY_TYPE_MASK)) | type;
  435. btrfs_set_disk_key_flags(key, flags);
  436. }
  437. static inline u64 btrfs_header_blocknr(struct btrfs_header *h)
  438. {
  439. return le64_to_cpu(h->blocknr);
  440. }
  441. static inline void btrfs_set_header_blocknr(struct btrfs_header *h, u64 blocknr)
  442. {
  443. h->blocknr = cpu_to_le64(blocknr);
  444. }
  445. static inline u64 btrfs_header_parentid(struct btrfs_header *h)
  446. {
  447. return le64_to_cpu(h->parentid);
  448. }
  449. static inline void btrfs_set_header_parentid(struct btrfs_header *h,
  450. u64 parentid)
  451. {
  452. h->parentid = cpu_to_le64(parentid);
  453. }
  454. static inline u16 btrfs_header_nritems(struct btrfs_header *h)
  455. {
  456. return le16_to_cpu(h->nritems);
  457. }
  458. static inline void btrfs_set_header_nritems(struct btrfs_header *h, u16 val)
  459. {
  460. h->nritems = cpu_to_le16(val);
  461. }
  462. static inline u16 btrfs_header_flags(struct btrfs_header *h)
  463. {
  464. return le16_to_cpu(h->flags);
  465. }
  466. static inline void btrfs_set_header_flags(struct btrfs_header *h, u16 val)
  467. {
  468. h->flags = cpu_to_le16(val);
  469. }
  470. static inline int btrfs_header_level(struct btrfs_header *h)
  471. {
  472. return btrfs_header_flags(h) & (BTRFS_MAX_LEVEL - 1);
  473. }
  474. static inline void btrfs_set_header_level(struct btrfs_header *h, int level)
  475. {
  476. u16 flags;
  477. BUG_ON(level > BTRFS_MAX_LEVEL);
  478. flags = btrfs_header_flags(h) & ~(BTRFS_MAX_LEVEL - 1);
  479. btrfs_set_header_flags(h, flags | level);
  480. }
  481. static inline int btrfs_is_leaf(struct btrfs_node *n)
  482. {
  483. return (btrfs_header_level(&n->header) == 0);
  484. }
  485. static inline u64 btrfs_root_blocknr(struct btrfs_root_item *item)
  486. {
  487. return le64_to_cpu(item->blocknr);
  488. }
  489. static inline void btrfs_set_root_blocknr(struct btrfs_root_item *item, u64 val)
  490. {
  491. item->blocknr = cpu_to_le64(val);
  492. }
  493. static inline u32 btrfs_root_refs(struct btrfs_root_item *item)
  494. {
  495. return le32_to_cpu(item->refs);
  496. }
  497. static inline void btrfs_set_root_refs(struct btrfs_root_item *item, u32 val)
  498. {
  499. item->refs = cpu_to_le32(val);
  500. }
  501. static inline u64 btrfs_super_blocknr(struct btrfs_super_block *s)
  502. {
  503. return le64_to_cpu(s->blocknr);
  504. }
  505. static inline void btrfs_set_super_blocknr(struct btrfs_super_block *s, u64 val)
  506. {
  507. s->blocknr = cpu_to_le64(val);
  508. }
  509. static inline u64 btrfs_super_root(struct btrfs_super_block *s)
  510. {
  511. return le64_to_cpu(s->root);
  512. }
  513. static inline void btrfs_set_super_root(struct btrfs_super_block *s, u64 val)
  514. {
  515. s->root = cpu_to_le64(val);
  516. }
  517. static inline u64 btrfs_super_total_blocks(struct btrfs_super_block *s)
  518. {
  519. return le64_to_cpu(s->total_blocks);
  520. }
  521. static inline void btrfs_set_super_total_blocks(struct btrfs_super_block *s,
  522. u64 val)
  523. {
  524. s->total_blocks = cpu_to_le64(val);
  525. }
  526. static inline u64 btrfs_super_blocks_used(struct btrfs_super_block *s)
  527. {
  528. return le64_to_cpu(s->blocks_used);
  529. }
  530. static inline void btrfs_set_super_blocks_used(struct btrfs_super_block *s,
  531. u64 val)
  532. {
  533. s->blocks_used = cpu_to_le64(val);
  534. }
  535. static inline u32 btrfs_super_blocksize(struct btrfs_super_block *s)
  536. {
  537. return le32_to_cpu(s->blocksize);
  538. }
  539. static inline void btrfs_set_super_blocksize(struct btrfs_super_block *s,
  540. u32 val)
  541. {
  542. s->blocksize = cpu_to_le32(val);
  543. }
  544. static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
  545. {
  546. return (u8 *)l->items;
  547. }
  548. /* helper function to cast into the data area of the leaf. */
  549. #define btrfs_item_ptr(leaf, slot, type) \
  550. ((type *)(btrfs_leaf_data(leaf) + \
  551. btrfs_item_offset((leaf)->items + (slot))))
  552. struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_root *root);
  553. int btrfs_inc_ref(struct btrfs_root *root, struct btrfs_buffer *buf);
  554. int btrfs_free_extent(struct btrfs_root *root, u64 blocknr, u64 num_blocks);
  555. int btrfs_search_slot(struct btrfs_root *root, struct btrfs_key *key,
  556. struct btrfs_path *p, int ins_len, int cow);
  557. void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
  558. void btrfs_init_path(struct btrfs_path *p);
  559. int btrfs_del_item(struct btrfs_root *root, struct btrfs_path *path);
  560. int btrfs_insert_item(struct btrfs_root *root, struct btrfs_key *key,
  561. void *data, u32 data_size);
  562. int btrfs_insert_empty_item(struct btrfs_root *root, struct btrfs_path *path,
  563. struct btrfs_key *cpu_key, u32 data_size);
  564. int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path);
  565. int btrfs_leaf_free_space(struct btrfs_root *root, struct btrfs_leaf *leaf);
  566. int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap);
  567. int btrfs_finish_extent_commit(struct btrfs_root *root);
  568. int btrfs_del_root(struct btrfs_root *root, struct btrfs_key *key);
  569. int btrfs_insert_root(struct btrfs_root *root, struct btrfs_key *key,
  570. struct btrfs_root_item *item);
  571. int btrfs_update_root(struct btrfs_root *root, struct btrfs_key *key,
  572. struct btrfs_root_item *item);
  573. int btrfs_find_last_root(struct btrfs_root *root, u64 objectid,
  574. struct btrfs_root_item *item, struct btrfs_key *key);
  575. int btrfs_insert_dir_item(struct btrfs_root *root, char *name, int name_len,
  576. u64 dir, u64 objectid, u8 type);
  577. int btrfs_lookup_dir_item(struct btrfs_root *root, struct btrfs_path *path,
  578. u64 dir, char *name, int name_len, int mod);
  579. int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path,
  580. char *name, int name_len);
  581. #endif