diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-02-20 16:40:44 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-02-20 16:40:44 -0500 |
commit | d97e63b69ef21c02b67e20e41d9968b0e503572e (patch) | |
tree | 400db046be21c09f2d96f74ff98677464c45507f /fs/btrfs/ctree.h | |
parent | 74123bd72a4e34c66e5ad95ce233dd352bebc572 (diff) |
Btrfs: early extent mapping support
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 586bf1866042..b737925be314 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __CTREE__ | 1 | #ifndef __CTREE__ |
2 | #define __CTREE__ | 2 | #define __CTREE__ |
3 | 3 | ||
4 | #define CTREE_BLOCKSIZE 4096 | 4 | #define CTREE_BLOCKSIZE 256 |
5 | 5 | ||
6 | struct key { | 6 | struct key { |
7 | u64 objectid; | 7 | u64 objectid; |
@@ -22,18 +22,41 @@ struct header { | |||
22 | #define NODEPTRS_PER_BLOCK ((CTREE_BLOCKSIZE - sizeof(struct header)) / \ | 22 | #define NODEPTRS_PER_BLOCK ((CTREE_BLOCKSIZE - sizeof(struct header)) / \ |
23 | (sizeof(struct key) + sizeof(u64))) | 23 | (sizeof(struct key) + sizeof(u64))) |
24 | 24 | ||
25 | #define LEVEL_BITS 3 | 25 | #define MAX_LEVEL 8 |
26 | #define MAX_LEVEL (1 << LEVEL_BITS) | ||
27 | #define node_level(f) ((f) & (MAX_LEVEL-1)) | 26 | #define node_level(f) ((f) & (MAX_LEVEL-1)) |
28 | #define is_leaf(f) (node_level(f) == 0) | 27 | #define is_leaf(f) (node_level(f) == 0) |
29 | 28 | ||
30 | struct tree_buffer; | 29 | struct tree_buffer; |
30 | |||
31 | struct alloc_extent { | ||
32 | u64 blocknr; | ||
33 | u64 num_blocks; | ||
34 | u64 num_used; | ||
35 | } __attribute__ ((__packed__)); | ||
36 | |||
31 | struct ctree_root { | 37 | struct ctree_root { |
32 | struct tree_buffer *node; | 38 | struct tree_buffer *node; |
39 | struct ctree_root *extent_root; | ||
40 | struct alloc_extent *alloc_extent; | ||
41 | struct alloc_extent *reserve_extent; | ||
33 | int fp; | 42 | int fp; |
34 | struct radix_tree_root cache_radix; | 43 | struct radix_tree_root cache_radix; |
44 | struct alloc_extent ai1; | ||
45 | struct alloc_extent ai2; | ||
35 | }; | 46 | }; |
36 | 47 | ||
48 | struct ctree_root_info { | ||
49 | u64 fsid[2]; /* FS specific uuid */ | ||
50 | u64 blocknr; /* blocknr of this block */ | ||
51 | u64 objectid; /* inode number of this root */ | ||
52 | u64 tree_root; /* the tree root */ | ||
53 | u32 csum; | ||
54 | u32 ham; | ||
55 | struct alloc_extent alloc_extent; | ||
56 | struct alloc_extent reserve_extent; | ||
57 | u64 snapuuid[2]; /* root specific uuid */ | ||
58 | } __attribute__ ((__packed__)); | ||
59 | |||
37 | struct item { | 60 | struct item { |
38 | struct key key; | 61 | struct key key; |
39 | u16 offset; | 62 | u16 offset; |
@@ -55,6 +78,11 @@ struct node { | |||
55 | u64 blockptrs[NODEPTRS_PER_BLOCK]; | 78 | u64 blockptrs[NODEPTRS_PER_BLOCK]; |
56 | } __attribute__ ((__packed__)); | 79 | } __attribute__ ((__packed__)); |
57 | 80 | ||
81 | struct extent_item { | ||
82 | u32 refs; | ||
83 | u64 owner; | ||
84 | } __attribute__ ((__packed__)); | ||
85 | |||
58 | struct ctree_path { | 86 | struct ctree_path { |
59 | struct tree_buffer *nodes[MAX_LEVEL]; | 87 | struct tree_buffer *nodes[MAX_LEVEL]; |
60 | int slots[MAX_LEVEL]; | 88 | int slots[MAX_LEVEL]; |