summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-defrag.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-08-10 14:42:37 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-10 14:42:37 -0400
commitf2183bde1a918d338337955c8e8ba29bd8f5e7b1 (patch)
treee27baea3779112618d2158902270c460444feeff /fs/btrfs/tree-defrag.c
parente9d0b13b5bbb58c9b840e407a8d181442f799966 (diff)
downloadlinux-f2183bde1a918d338337955c8e8ba29bd8f5e7b1.tar.bz2
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.c3
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,
if (cache_only) {
next = btrfs_find_tree_block(root, blocknr);
if (!next || !buffer_uptodate(next) ||
- buffer_locked(next)) {
+ buffer_locked(next) || !buffer_defrag(next)) {
brelse(next);
path->slots[*level]++;
continue;
@@ -142,6 +142,7 @@ static int defrag_walk_up(struct btrfs_trans_handle *trans,
root->defrag_level = i;
return 0;
} else {
+ clear_buffer_defrag(path->nodes[*level]);
btrfs_block_release(root, path->nodes[*level]);
path->nodes[*level] = NULL;
*level = i + 1;