diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:22:39 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | a6b6e75e096f436f0cc56edf5bca96301e194491 (patch) | |
tree | 03751594c29a7d70d317689fd6b5e44ee023633e /fs/btrfs/transaction.c | |
parent | ff79f8190b6e955ff7a71faf804a3017d526e657 (diff) |
Btrfs: Defrag only leaves, and only when the parent node has a single objectid
This allows us to defrag huge directories, but skip the expensive defrag
case in more common usage, where it does not help as much.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r-- | fs/btrfs/transaction.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 67e4aca36a62..bdfe05cf26c6 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -353,7 +353,6 @@ int btrfs_defrag_root(struct btrfs_root *root, int cacheonly) | |||
353 | 353 | ||
354 | if (root->defrag_running) | 354 | if (root->defrag_running) |
355 | return 0; | 355 | return 0; |
356 | |||
357 | trans = btrfs_start_transaction(root, 1); | 356 | trans = btrfs_start_transaction(root, 1); |
358 | while (1) { | 357 | while (1) { |
359 | root->defrag_running = 1; | 358 | root->defrag_running = 1; |
@@ -361,7 +360,6 @@ int btrfs_defrag_root(struct btrfs_root *root, int cacheonly) | |||
361 | nr = trans->blocks_used; | 360 | nr = trans->blocks_used; |
362 | btrfs_end_transaction(trans, root); | 361 | btrfs_end_transaction(trans, root); |
363 | mutex_unlock(&info->fs_mutex); | 362 | mutex_unlock(&info->fs_mutex); |
364 | |||
365 | btrfs_btree_balance_dirty(info->tree_root, nr); | 363 | btrfs_btree_balance_dirty(info->tree_root, nr); |
366 | cond_resched(); | 364 | cond_resched(); |
367 | 365 | ||