aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2016-04-26 10:36:38 -0400
committerFilipe Manana <fdmanana@suse.com>2016-05-12 20:59:14 -0400
commit578def7c50f236432ba140d35bb7ca4ef0a1b20b (patch)
treec6b2e052c0ba5b95d1659f0e95651445951426e1 /fs/btrfs/dev-replace.c
parent3f9749f6e9edcf8ec569fb542efc3be35e06e84a (diff)
Btrfs: don't wait for unrelated IO to finish before relocation
Before the relocation process of a block group starts, it sets the block group to readonly mode, then flushes all delalloc writes and then finally it waits for all ordered extents to complete. This last step includes waiting for ordered extents destinated at extents allocated in other block groups, making us waste unecessary time. So improve this by waiting only for ordered extents that fall into the block group's range. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Josef Bacik <jbacik@fb.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r--fs/btrfs/dev-replace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 26bcb487f958..3371f9e546d9 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -403,7 +403,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
403 if (ret) 403 if (ret)
404 btrfs_err(root->fs_info, "kobj add dev failed %d\n", ret); 404 btrfs_err(root->fs_info, "kobj add dev failed %d\n", ret);
405 405
406 btrfs_wait_ordered_roots(root->fs_info, -1); 406 btrfs_wait_ordered_roots(root->fs_info, -1, 0, (u64)-1);
407 407
408 /* force writing the updated state information to disk */ 408 /* force writing the updated state information to disk */
409 trans = btrfs_start_transaction(root, 0); 409 trans = btrfs_start_transaction(root, 0);
@@ -495,7 +495,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
495 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); 495 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
496 return ret; 496 return ret;
497 } 497 }
498 btrfs_wait_ordered_roots(root->fs_info, -1); 498 btrfs_wait_ordered_roots(root->fs_info, -1, 0, (u64)-1);
499 499
500 trans = btrfs_start_transaction(root, 0); 500 trans = btrfs_start_transaction(root, 0);
501 if (IS_ERR(trans)) { 501 if (IS_ERR(trans)) {