diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-13 16:47:54 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-13 16:47:54 -0400 |
commit | 3768f3689fc76ecea17414936dff7a02746a4355 (patch) | |
tree | 0494b12e3ba0be0a25f122922e205bc91d88957b /fs/btrfs/extent-tree.c | |
parent | eaee50e881b88766d9a781c54c4142456cf5e527 (diff) |
Btrfs: Change the super to point to a tree of trees to enable persistent snapshots
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a6969538bca2..21f39b404697 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -82,7 +82,7 @@ int btrfs_inc_ref(struct btrfs_root *root, struct btrfs_buffer *buf) | |||
82 | u64 blocknr; | 82 | u64 blocknr; |
83 | int i; | 83 | int i; |
84 | 84 | ||
85 | if (root == root->extent_root) | 85 | if (!root->ref_cows) |
86 | return 0; | 86 | return 0; |
87 | if (btrfs_is_leaf(&buf->node)) | 87 | if (btrfs_is_leaf(&buf->node)) |
88 | return 0; | 88 | return 0; |
@@ -96,23 +96,22 @@ int btrfs_inc_ref(struct btrfs_root *root, struct btrfs_buffer *buf) | |||
96 | 96 | ||
97 | int btrfs_finish_extent_commit(struct btrfs_root *root) | 97 | int btrfs_finish_extent_commit(struct btrfs_root *root) |
98 | { | 98 | { |
99 | struct btrfs_root *extent_root = root->extent_root; | ||
100 | unsigned long gang[8]; | 99 | unsigned long gang[8]; |
101 | int ret; | 100 | int ret; |
102 | int i; | 101 | int i; |
103 | 102 | ||
104 | while(1) { | 103 | while(1) { |
105 | ret = radix_tree_gang_lookup(&extent_root->pinned_radix, | 104 | ret = radix_tree_gang_lookup(&root->pinned_radix, |
106 | (void **)gang, 0, | 105 | (void **)gang, 0, |
107 | ARRAY_SIZE(gang)); | 106 | ARRAY_SIZE(gang)); |
108 | if (!ret) | 107 | if (!ret) |
109 | break; | 108 | break; |
110 | for (i = 0; i < ret; i++) { | 109 | for (i = 0; i < ret; i++) { |
111 | radix_tree_delete(&extent_root->pinned_radix, gang[i]); | 110 | radix_tree_delete(&root->pinned_radix, gang[i]); |
112 | } | 111 | } |
113 | } | 112 | } |
114 | extent_root->last_insert.objectid = 0; | 113 | root->last_insert.objectid = 0; |
115 | extent_root->last_insert.offset = 0; | 114 | root->last_insert.offset = 0; |
116 | return 0; | 115 | return 0; |
117 | } | 116 | } |
118 | 117 | ||
@@ -173,7 +172,7 @@ static int __free_extent(struct btrfs_root *root, u64 blocknr, u64 num_blocks) | |||
173 | refs = btrfs_extent_refs(ei) - 1; | 172 | refs = btrfs_extent_refs(ei) - 1; |
174 | btrfs_set_extent_refs(ei, refs); | 173 | btrfs_set_extent_refs(ei, refs); |
175 | if (refs == 0) { | 174 | if (refs == 0) { |
176 | if (root == extent_root) { | 175 | if (!root->ref_cows) { |
177 | int err; | 176 | int err; |
178 | radix_tree_preload(GFP_KERNEL); | 177 | radix_tree_preload(GFP_KERNEL); |
179 | err = radix_tree_insert(&extent_root->pinned_radix, | 178 | err = radix_tree_insert(&extent_root->pinned_radix, |
@@ -513,7 +512,7 @@ static int walk_up_tree(struct btrfs_root *root, struct btrfs_path *path, | |||
513 | */ | 512 | */ |
514 | int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap) | 513 | int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap) |
515 | { | 514 | { |
516 | int ret = 0;; | 515 | int ret = 0; |
517 | int wret; | 516 | int wret; |
518 | int level; | 517 | int level; |
519 | struct btrfs_path path; | 518 | struct btrfs_path path; |