aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2012-06-22 14:24:13 -0400
committerChris Mason <chris.mason@fusionio.com>2012-07-02 15:39:17 -0400
commit2b6ba629b5aac51e7099efbb43e2b403213aa7fb (patch)
tree0a36f4adb14a57fdf4ee1dafa957927b6a6f9203 /fs/btrfs/disk-io.c
parent68310a5e42f93c2242ec1836c3b18d531e0065e2 (diff)
Btrfs: resume balance on rw (re)mounts properly
This introduces btrfs_resume_balance_async(), which, given that restriper state was recovered earlier by btrfs_recover_balance(), resumes balance in btrfs-balance kthread. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 3a7961ba161e..8cc47103a32e 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2490,17 +2490,23 @@ retry_root_backup:
2490 goto fail_trans_kthread; 2490 goto fail_trans_kthread;
2491 } 2491 }
2492 2492
2493 if (!(sb->s_flags & MS_RDONLY)) { 2493 if (sb->s_flags & MS_RDONLY)
2494 down_read(&fs_info->cleanup_work_sem); 2494 return 0;
2495 err = btrfs_orphan_cleanup(fs_info->fs_root); 2495
2496 if (!err) 2496 down_read(&fs_info->cleanup_work_sem);
2497 err = btrfs_orphan_cleanup(fs_info->tree_root); 2497 if ((ret = btrfs_orphan_cleanup(fs_info->fs_root)) ||
2498 (ret = btrfs_orphan_cleanup(fs_info->tree_root))) {
2498 up_read(&fs_info->cleanup_work_sem); 2499 up_read(&fs_info->cleanup_work_sem);
2500 close_ctree(tree_root);
2501 return ret;
2502 }
2503 up_read(&fs_info->cleanup_work_sem);
2499 2504
2500 if (err) { 2505 ret = btrfs_resume_balance_async(fs_info);
2501 close_ctree(tree_root); 2506 if (ret) {
2502 return err; 2507 printk(KERN_WARNING "btrfs: failed to resume balance\n");
2503 } 2508 close_ctree(tree_root);
2509 return ret;
2504 } 2510 }
2505 2511
2506 return 0; 2512 return 0;