diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-08-08 20:17:12 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-08-08 20:17:12 -0400 |
commit | 409eb95d7f6632d5af32b795244ce68a29e49319 (patch) | |
tree | d652da6d5c5055a5f090e3327e512d752d430279 /fs/btrfs | |
parent | 26b8003f10569a9155b7539ef5a7379ee0c6b050 (diff) |
Btrfs: Further reduce the concurrency penalty of defrag and drop_snapshot
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 13 | ||||
-rw-r--r-- | fs/btrfs/transaction.c | 3 | ||||
-rw-r--r-- | fs/btrfs/tree-defrag.c | 7 |
3 files changed, 11 insertions, 12 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ba50bd7b9a78..120c448f58f8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1312,7 +1312,10 @@ static void reada_walk_down(struct btrfs_root *root, | |||
1312 | BUG_ON(ret); | 1312 | BUG_ON(ret); |
1313 | if (refs != 1) | 1313 | if (refs != 1) |
1314 | continue; | 1314 | continue; |
1315 | mutex_unlock(&root->fs_info->fs_mutex); | ||
1315 | ret = readahead_tree_block(root, blocknr); | 1316 | ret = readahead_tree_block(root, blocknr); |
1317 | cond_resched(); | ||
1318 | mutex_lock(&root->fs_info->fs_mutex); | ||
1316 | if (ret) | 1319 | if (ret) |
1317 | break; | 1320 | break; |
1318 | } | 1321 | } |
@@ -1445,7 +1448,6 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1445 | struct btrfs_path *path; | 1448 | struct btrfs_path *path; |
1446 | int i; | 1449 | int i; |
1447 | int orig_level; | 1450 | int orig_level; |
1448 | int num_walks = 0; | ||
1449 | struct btrfs_root_item *root_item = &root->root_item; | 1451 | struct btrfs_root_item *root_item = &root->root_item; |
1450 | 1452 | ||
1451 | path = btrfs_alloc_path(); | 1453 | path = btrfs_alloc_path(); |
@@ -1486,12 +1488,9 @@ int btrfs_drop_snapshot(struct btrfs_trans_handle *trans, struct btrfs_root | |||
1486 | break; | 1488 | break; |
1487 | if (wret < 0) | 1489 | if (wret < 0) |
1488 | ret = wret; | 1490 | ret = wret; |
1489 | num_walks++; | 1491 | ret = -EAGAIN; |
1490 | if (num_walks > 2) { | 1492 | get_bh(root->node); |
1491 | ret = -EAGAIN; | 1493 | break; |
1492 | get_bh(root->node); | ||
1493 | break; | ||
1494 | } | ||
1495 | } | 1494 | } |
1496 | for (i = 0; i <= orig_level; i++) { | 1495 | for (i = 0; i <= orig_level; i++) { |
1497 | if (path->nodes[i]) { | 1496 | if (path->nodes[i]) { |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index e64ecec3f52e..204337c5ca0f 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -364,6 +364,9 @@ int btrfs_defrag_dirty_roots(struct btrfs_fs_info *info) | |||
364 | break; | 364 | break; |
365 | } | 365 | } |
366 | root->defrag_running = 0; | 366 | root->defrag_running = 0; |
367 | radix_tree_tag_clear(&info->fs_roots_radix, | ||
368 | (unsigned long)root->root_key.objectid, | ||
369 | BTRFS_ROOT_DEFRAG_TAG); | ||
367 | } | 370 | } |
368 | } | 371 | } |
369 | btrfs_end_transaction(trans, tree_root); | 372 | btrfs_end_transaction(trans, tree_root); |
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c index 15d0a486fb59..7ea66b4aa5c2 100644 --- a/fs/btrfs/tree-defrag.c +++ b/fs/btrfs/tree-defrag.c | |||
@@ -148,7 +148,6 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, | |||
148 | int level; | 148 | int level; |
149 | int orig_level; | 149 | int orig_level; |
150 | int i; | 150 | int i; |
151 | int num_runs = 0; | ||
152 | 151 | ||
153 | if (root->ref_cows == 0) { | 152 | if (root->ref_cows == 0) { |
154 | goto out; | 153 | goto out; |
@@ -200,10 +199,8 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, | |||
200 | break; | 199 | break; |
201 | if (wret < 0) | 200 | if (wret < 0) |
202 | ret = wret; | 201 | ret = wret; |
203 | if (num_runs++ > 8) { | 202 | ret = -EAGAIN; |
204 | ret = -EAGAIN; | 203 | break; |
205 | break; | ||
206 | } | ||
207 | } | 204 | } |
208 | for (i = 0; i <= orig_level; i++) { | 205 | for (i = 0; i <= orig_level; i++) { |
209 | if (path->nodes[i]) { | 206 | if (path->nodes[i]) { |