@@ -4572,6 +4572,12 @@ static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
case BTRFS_QUOTA_CTL_DISABLE:
ret = btrfs_quota_disable(trans, root->fs_info);
break;
+ case BTRFS_QUOTA_CTL_STATUS:
+ ret = btrfs_quota_status(trans, root->fs_info, sa);
+ if (!ret)
+ if (copy_to_user(arg, sa, sizeof(*sa)))
+ ret = -EFAULT;
+ break;
default:
ret = -EINVAL;
break;
@@ -993,6 +993,20 @@ out:
return ret;
}
+int btrfs_quota_status(struct btrfs_trans_handle *trans,
+ struct btrfs_fs_info *fs_info,
+ struct btrfs_ioctl_quota_ctl_args *sa)
+{
+ int ret = 0;
+
+ if (fs_info->quota_enabled)
+ sa->status |= BTRFS_QUOTA_STATUS_QUOTA_ENABLED;
+ else
+ sa->status &= ~BTRFS_QUOTA_STATUS_QUOTA_ENABLED;
+
+ return ret;
+}
+
static void qgroup_dirty(struct btrfs_fs_info *fs_info,
struct btrfs_qgroup *qgroup)
{
@@ -62,6 +62,9 @@ int btrfs_quota_enable(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info);
int btrfs_quota_disable(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info);
+int btrfs_quota_status(struct btrfs_trans_handle *trans,
+ struct btrfs_fs_info *fs_info,
+ struct btrfs_ioctl_quota_ctl_args *sa);
int btrfs_qgroup_rescan(struct btrfs_fs_info *fs_info);
void btrfs_qgroup_rescan_resume(struct btrfs_fs_info *fs_info);
int btrfs_qgroup_wait_for_completion(struct btrfs_fs_info *fs_info);
@@ -423,6 +423,9 @@ struct btrfs_ioctl_get_dev_stats {
#define BTRFS_QUOTA_CTL_ENABLE 1
#define BTRFS_QUOTA_CTL_DISABLE 2
#define BTRFS_QUOTA_CTL_RESCAN__NOTUSED 3
+#define BTRFS_QUOTA_CTL_STATUS 4
+
+#define BTRFS_QUOTA_STATUS_QUOTA_ENABLED 1
struct btrfs_ioctl_quota_ctl_args {
__u64 cmd;
__u64 status;