diff options
Diffstat (limited to 'fs/btrfs/ref-cache.h')
-rw-r--r-- | fs/btrfs/ref-cache.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/btrfs/ref-cache.h b/fs/btrfs/ref-cache.h index 79ecc47110f2..823c049f72f1 100644 --- a/fs/btrfs/ref-cache.h +++ b/fs/btrfs/ref-cache.h | |||
@@ -15,6 +15,8 @@ | |||
15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | * Boston, MA 021110-1307, USA. | 16 | * Boston, MA 021110-1307, USA. |
17 | */ | 17 | */ |
18 | #ifndef __REFCACHE__ | ||
19 | #define __REFCACHE__ | ||
18 | 20 | ||
19 | struct btrfs_extent_info { | 21 | struct btrfs_extent_info { |
20 | u64 bytenr; | 22 | u64 bytenr; |
@@ -25,7 +27,6 @@ struct btrfs_extent_info { | |||
25 | 27 | ||
26 | struct btrfs_leaf_ref { | 28 | struct btrfs_leaf_ref { |
27 | struct rb_node rb_node; | 29 | struct rb_node rb_node; |
28 | struct btrfs_key key; | ||
29 | int in_tree; | 30 | int in_tree; |
30 | atomic_t usage; | 31 | atomic_t usage; |
31 | 32 | ||
@@ -33,14 +34,9 @@ struct btrfs_leaf_ref { | |||
33 | u64 owner; | 34 | u64 owner; |
34 | u64 generation; | 35 | u64 generation; |
35 | int nritems; | 36 | int nritems; |
36 | struct btrfs_extent_info extents[]; | ||
37 | }; | ||
38 | 37 | ||
39 | struct btrfs_leaf_ref_tree { | 38 | struct list_head list; |
40 | struct rb_root root; | 39 | struct btrfs_extent_info extents[]; |
41 | struct btrfs_leaf_ref *last; | ||
42 | u64 generation; | ||
43 | spinlock_t lock; | ||
44 | }; | 40 | }; |
45 | 41 | ||
46 | static inline size_t btrfs_leaf_ref_size(int nr_extents) | 42 | static inline size_t btrfs_leaf_ref_size(int nr_extents) |
@@ -53,7 +49,7 @@ static inline void btrfs_leaf_ref_tree_init(struct btrfs_leaf_ref_tree *tree) | |||
53 | { | 49 | { |
54 | tree->root.rb_node = NULL; | 50 | tree->root.rb_node = NULL; |
55 | tree->last = NULL; | 51 | tree->last = NULL; |
56 | tree->generation = 0; | 52 | INIT_LIST_HEAD(&tree->list); |
57 | spin_lock_init(&tree->lock); | 53 | spin_lock_init(&tree->lock); |
58 | } | 54 | } |
59 | 55 | ||
@@ -66,7 +62,9 @@ void btrfs_leaf_ref_tree_init(struct btrfs_leaf_ref_tree *tree); | |||
66 | struct btrfs_leaf_ref *btrfs_alloc_leaf_ref(int nr_extents); | 62 | struct btrfs_leaf_ref *btrfs_alloc_leaf_ref(int nr_extents); |
67 | void btrfs_free_leaf_ref(struct btrfs_leaf_ref *ref); | 63 | void btrfs_free_leaf_ref(struct btrfs_leaf_ref *ref); |
68 | struct btrfs_leaf_ref *btrfs_lookup_leaf_ref(struct btrfs_root *root, | 64 | struct btrfs_leaf_ref *btrfs_lookup_leaf_ref(struct btrfs_root *root, |
69 | struct btrfs_key *key); | 65 | u64 bytenr); |
70 | int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); | 66 | int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); |
71 | int btrfs_remove_leaf_refs(struct btrfs_root *root); | 67 | int btrfs_remove_leaf_refs(struct btrfs_root *root); |
72 | int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); | 68 | int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref); |
69 | |||
70 | #endif | ||