aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r--fs/btrfs/dev-replace.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 7aed8a8ce694..02031fc07f7f 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -327,19 +327,6 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
327 args->start.tgtdev_name[0] == '\0') 327 args->start.tgtdev_name[0] == '\0')
328 return -EINVAL; 328 return -EINVAL;
329 329
330 /*
331 * Here we commit the transaction to make sure commit_total_bytes
332 * of all the devices are updated.
333 */
334 trans = btrfs_attach_transaction(root);
335 if (!IS_ERR(trans)) {
336 ret = btrfs_commit_transaction(trans, root);
337 if (ret)
338 return ret;
339 } else if (PTR_ERR(trans) != -ENOENT) {
340 return PTR_ERR(trans);
341 }
342
343 /* the disk copy procedure reuses the scrub code */ 330 /* the disk copy procedure reuses the scrub code */
344 mutex_lock(&fs_info->volume_mutex); 331 mutex_lock(&fs_info->volume_mutex);
345 ret = btrfs_dev_replace_find_srcdev(root, args->start.srcdevid, 332 ret = btrfs_dev_replace_find_srcdev(root, args->start.srcdevid,
@@ -356,6 +343,19 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
356 if (ret) 343 if (ret)
357 return ret; 344 return ret;
358 345
346 /*
347 * Here we commit the transaction to make sure commit_total_bytes
348 * of all the devices are updated.
349 */
350 trans = btrfs_attach_transaction(root);
351 if (!IS_ERR(trans)) {
352 ret = btrfs_commit_transaction(trans, root);
353 if (ret)
354 return ret;
355 } else if (PTR_ERR(trans) != -ENOENT) {
356 return PTR_ERR(trans);
357 }
358
359 btrfs_dev_replace_lock(dev_replace); 359 btrfs_dev_replace_lock(dev_replace);
360 switch (dev_replace->replace_state) { 360 switch (dev_replace->replace_state) {
361 case BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED: 361 case BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED: