diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2012-01-16 20:04:49 (GMT) |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2012-01-16 20:04:49 (GMT) |
commit | de322263d3a6d4ffd4ed7c4d0c6536e9497aec9b (patch) | |
tree | 26761c92c8d135aa62702562bae3337ccad9f74d | |
parent | a7e99c691af553fc15ac46a51f130b7c59a65f76 (diff) | |
download | linux-fsl-qoriq-de322263d3a6d4ffd4ed7c4d0c6536e9497aec9b.tar.xz |
Btrfs: allow for resuming restriper after it was paused
Recognize BTRFS_BALANCE_RESUME flag passed from userspace. We use the
same heuristics used when recovering balance after a crash to try to
start where we left off last time.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r-- | fs/btrfs/ioctl.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6085221..85e546f 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3106,6 +3106,20 @@ static long btrfs_ioctl_balance(struct btrfs_root *root, void __user *arg) ret = PTR_ERR(bargs); goto out; } + + if (bargs->flags & BTRFS_BALANCE_RESUME) { + if (!fs_info->balance_ctl) { + ret = -ENOTCONN; + goto out_bargs; + } + + bctl = fs_info->balance_ctl; + spin_lock(&fs_info->balance_lock); + bctl->flags |= BTRFS_BALANCE_RESUME; + spin_unlock(&fs_info->balance_lock); + + goto do_balance; + } } else { bargs = NULL; } @@ -3133,6 +3147,7 @@ static long btrfs_ioctl_balance(struct btrfs_root *root, void __user *arg) bctl->flags |= BTRFS_BALANCE_TYPE_MASK; } +do_balance: ret = btrfs_balance(bctl, bargs); /* * bctl is freed in __cancel_balance or in free_fs_info if |