aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:49 -0500
committerIlya Dryomov <idryomov@gmail.com>2012-01-16 15:04:49 -0500
commitde322263d3a6d4ffd4ed7c4d0c6536e9497aec9b (patch)
tree26761c92c8d135aa62702562bae3337ccad9f74d /fs
parenta7e99c691af553fc15ac46a51f130b7c59a65f76 (diff)
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ioctl.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 60852217ce9a..85e546ffe3c7 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)
3106 ret = PTR_ERR(bargs); 3106 ret = PTR_ERR(bargs);
3107 goto out; 3107 goto out;
3108 } 3108 }
3109
3110 if (bargs->flags & BTRFS_BALANCE_RESUME) {
3111 if (!fs_info->balance_ctl) {
3112 ret = -ENOTCONN;
3113 goto out_bargs;
3114 }
3115
3116 bctl = fs_info->balance_ctl;
3117 spin_lock(&fs_info->balance_lock);
3118 bctl->flags |= BTRFS_BALANCE_RESUME;
3119 spin_unlock(&fs_info->balance_lock);
3120
3121 goto do_balance;
3122 }
3109 } else { 3123 } else {
3110 bargs = NULL; 3124 bargs = NULL;
3111 } 3125 }
@@ -3133,6 +3147,7 @@ static long btrfs_ioctl_balance(struct btrfs_root *root, void __user *arg)
3133 bctl->flags |= BTRFS_BALANCE_TYPE_MASK; 3147 bctl->flags |= BTRFS_BALANCE_TYPE_MASK;
3134 } 3148 }
3135 3149
3150do_balance:
3136 ret = btrfs_balance(bctl, bargs); 3151 ret = btrfs_balance(bctl, bargs);
3137 /* 3152 /*
3138 * bctl is freed in __cancel_balance or in free_fs_info if 3153 * bctl is freed in __cancel_balance or in free_fs_info if