diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-08-10 14:42:37 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-08-10 14:42:37 -0400 |
commit | f2183bde1a918d338337955c8e8ba29bd8f5e7b1 (patch) | |
tree | e27baea3779112618d2158902270c460444feeff /fs/btrfs/tree-defrag.c | |
parent | e9d0b13b5bbb58c9b840e407a8d181442f799966 (diff) |
Btrfs: Add BH_Defrag to mark buffers that are in need of defragging
This allows the tree walking code to defrag only the newly allocated
buffers, it seems to be a good balance between perfect defragging and the
performance hit of repeatedly reallocating blocks.
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 | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c index a09064a9a41c..35fd20d24645 100644 --- a/fs/btrfs/tree-defrag.c +++ b/fs/btrfs/tree-defrag.c | |||
@@ -86,7 +86,7 @@ static int defrag_walk_down(struct btrfs_trans_handle *trans, | |||
86 | if (cache_only) { | 86 | if (cache_only) { |
87 | next = btrfs_find_tree_block(root, blocknr); | 87 | next = btrfs_find_tree_block(root, blocknr); |
88 | if (!next || !buffer_uptodate(next) || | 88 | if (!next || !buffer_uptodate(next) || |
89 | buffer_locked(next)) { | 89 | buffer_locked(next) || !buffer_defrag(next)) { |
90 | brelse(next); | 90 | brelse(next); |
91 | path->slots[*level]++; | 91 | path->slots[*level]++; |
92 | continue; | 92 | continue; |
@@ -142,6 +142,7 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans, | |||
142 | root->defrag_level = i; | 142 | root->defrag_level = i; |
143 | return 0; | 143 | return 0; |
144 | } else { | 144 | } else { |
145 | clear_buffer_defrag(path->nodes[*level]); | ||
145 | btrfs_block_release(root, path->nodes[*level]); | 146 | btrfs_block_release(root, path->nodes[*level]); |
146 | path->nodes[*level] = NULL; | 147 | path->nodes[*level] = NULL; |
147 | *level = i + 1; | 148 | *level = i + 1; |