aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2013-05-06 15:14:17 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-06-14 11:29:22 -0400
commit57254b6ebce4ceca02d9c8b615f6059c56c19238 (patch)
treea90b04313e8671e6846d09c0c14c7b08e16d0e65 /fs/btrfs/ioctl.c
parent1e8f915868c59be4d6e49d9aff928454a5d5d569 (diff)
Btrfs: add ioctl to wait for qgroup rescan completion
btrfs_qgroup_wait_for_completion waits until the currently running qgroup operation completes. It returns immediately when no rescan process is in progress. This is useful to automate things around the rescan process (e.g. testing). Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 0f81d67cdc8d..1e0dda1feefe 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3937,6 +3937,16 @@ static long btrfs_ioctl_quota_rescan_status(struct file *file, void __user *arg)
3937 return ret; 3937 return ret;
3938} 3938}
3939 3939
3940static long btrfs_ioctl_quota_rescan_wait(struct file *file, void __user *arg)
3941{
3942 struct btrfs_root *root = BTRFS_I(fdentry(file)->d_inode)->root;
3943
3944 if (!capable(CAP_SYS_ADMIN))
3945 return -EPERM;
3946
3947 return btrfs_qgroup_wait_for_completion(root->fs_info);
3948}
3949
3940static long btrfs_ioctl_set_received_subvol(struct file *file, 3950static long btrfs_ioctl_set_received_subvol(struct file *file,
3941 void __user *arg) 3951 void __user *arg)
3942{ 3952{
@@ -4179,6 +4189,8 @@ long btrfs_ioctl(struct file *file, unsigned int
4179 return btrfs_ioctl_quota_rescan(file, argp); 4189 return btrfs_ioctl_quota_rescan(file, argp);
4180 case BTRFS_IOC_QUOTA_RESCAN_STATUS: 4190 case BTRFS_IOC_QUOTA_RESCAN_STATUS:
4181 return btrfs_ioctl_quota_rescan_status(file, argp); 4191 return btrfs_ioctl_quota_rescan_status(file, argp);
4192 case BTRFS_IOC_QUOTA_RESCAN_WAIT:
4193 return btrfs_ioctl_quota_rescan_wait(file, argp);
4182 case BTRFS_IOC_DEV_REPLACE: 4194 case BTRFS_IOC_DEV_REPLACE:
4183 return btrfs_ioctl_dev_replace(root, argp); 4195 return btrfs_ioctl_dev_replace(root, argp);
4184 case BTRFS_IOC_GET_FSLABEL: 4196 case BTRFS_IOC_GET_FSLABEL: