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