diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:22:11 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:56 -0400 |
commit | cf786e79e3f96f4bc037c69e1a7afb5fb85c6111 (patch) | |
tree | 5d6acee007d82cd477033d77115f4fb1362db41c /fs/btrfs/tree-defrag.c | |
parent | 304fced668079ce222200d5742657d34cc44af09 (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/tree-defrag.c')
-rw-r--r-- | fs/btrfs/tree-defrag.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; |