aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-10-15 16:22:11 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commitcf786e79e3f96f4bc037c69e1a7afb5fb85c6111 (patch)
tree5d6acee007d82cd477033d77115f4fb1362db41c /fs/btrfs
parent304fced668079ce222200d5742657d34cc44af09 (diff)
Btrfs: Defrag: only walk into nodes with the defrag bit set
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.c1
-rw-r--r--fs/btrfs/tree-defrag.c8
2 files changed, 4 insertions, 5 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index e1557e573d74..984f4745440e 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -280,7 +280,6 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
280 *last_ret = search_start; 280 *last_ret = search_start;
281 if (parent_level == 1) 281 if (parent_level == 1)
282 btrfs_clear_buffer_defrag(tmp); 282 btrfs_clear_buffer_defrag(tmp);
283 btrfs_set_buffer_defrag_done(tmp);
284 free_extent_buffer(tmp); 283 free_extent_buffer(tmp);
285 } 284 }
286 return err; 285 return err;
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index d31c21ac6f23..f86eccf511b9 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -87,8 +87,8 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans,
87 if (cache_only) { 87 if (cache_only) {
88 next = btrfs_find_tree_block(root, bytenr, 88 next = btrfs_find_tree_block(root, bytenr,
89 btrfs_level_size(root, *level - 1)); 89 btrfs_level_size(root, *level - 1));
90 /* FIXME, test for defrag */ 90 if (!next || !btrfs_buffer_uptodate(next) ||
91 if (!next || !btrfs_buffer_uptodate(next)) { 91 !btrfs_buffer_defrag(next)) {
92 free_extent_buffer(next); 92 free_extent_buffer(next);
93 path->slots[*level]++; 93 path->slots[*level]++;
94 continue; 94 continue;
@@ -147,7 +147,8 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans,
147 root->defrag_level = i; 147 root->defrag_level = i;
148 return 0; 148 return 0;
149 } else { 149 } else {
150 if (*level > 1 && path->nodes[*level] != root->node) { 150 if (*level > 1 && path->nodes[*level] != root->node &&
151 btrfs_buffer_defrag(path->nodes[*level])) {
151 struct extent_buffer *next; 152 struct extent_buffer *next;
152 u64 last; 153 u64 last;
153 int ret; 154 int ret;
@@ -168,7 +169,6 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans,
168 } 169 }
169 170
170 btrfs_clear_buffer_defrag(path->nodes[*level]); 171 btrfs_clear_buffer_defrag(path->nodes[*level]);
171 btrfs_clear_buffer_defrag_done(path->nodes[*level]);
172 free_extent_buffer(path->nodes[*level]); 172 free_extent_buffer(path->nodes[*level]);
173 path->nodes[*level] = NULL; 173 path->nodes[*level] = NULL;
174 *level = i + 1; 174 *level = i + 1;