]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/xfs/xfs_quotaops.c
quota: Split ->set_xstate callback into two
[karo-tx-linux.git] / fs / xfs / xfs_quotaops.c
index a226203fa46ad6b1db971b1fb252be81fb3d43bc..6923905ab33d973eb30206dd97c247eafffbd2f4 100644 (file)
@@ -64,19 +64,10 @@ xfs_fs_get_xstatev(
        return xfs_qm_scall_getqstatv(mp, fqs);
 }
 
-STATIC int
-xfs_fs_set_xstate(
-       struct super_block      *sb,
-       unsigned int            uflags,
-       int                     op)
+static unsigned int
+xfs_quota_flags(unsigned int uflags)
 {
-       struct xfs_mount        *mp = XFS_M(sb);
-       unsigned int            flags = 0;
-
-       if (sb->s_flags & MS_RDONLY)
-               return -EROFS;
-       if (!XFS_IS_QUOTA_RUNNING(mp))
-               return -ENOSYS;
+       unsigned int flags = 0;
 
        if (uflags & FS_QUOTA_UDQ_ACCT)
                flags |= XFS_UQUOTA_ACCT;
@@ -91,16 +82,39 @@ xfs_fs_set_xstate(
        if (uflags & FS_QUOTA_PDQ_ENFD)
                flags |= XFS_PQUOTA_ENFD;
 
-       switch (op) {
-       case Q_XQUOTAON:
-               return xfs_qm_scall_quotaon(mp, flags);
-       case Q_XQUOTAOFF:
-               if (!XFS_IS_QUOTA_ON(mp))
-                       return -EINVAL;
-               return xfs_qm_scall_quotaoff(mp, flags);
-       }
+       return flags;
+}
+
+STATIC int
+xfs_quota_enable(
+       struct super_block      *sb,
+       unsigned int            uflags)
+{
+       struct xfs_mount        *mp = XFS_M(sb);
+
+       if (sb->s_flags & MS_RDONLY)
+               return -EROFS;
+       if (!XFS_IS_QUOTA_RUNNING(mp))
+               return -ENOSYS;
+
+       return xfs_qm_scall_quotaon(mp, xfs_quota_flags(uflags));
+}
+
+STATIC int
+xfs_quota_disable(
+       struct super_block      *sb,
+       unsigned int            uflags)
+{
+       struct xfs_mount        *mp = XFS_M(sb);
+
+       if (sb->s_flags & MS_RDONLY)
+               return -EROFS;
+       if (!XFS_IS_QUOTA_RUNNING(mp))
+               return -ENOSYS;
+       if (!XFS_IS_QUOTA_ON(mp))
+               return -EINVAL;
 
-       return -EINVAL;
+       return xfs_qm_scall_quotaoff(mp, xfs_quota_flags(uflags));
 }
 
 STATIC int
@@ -166,7 +180,8 @@ xfs_fs_set_dqblk(
 const struct quotactl_ops xfs_quotactl_operations = {
        .get_xstatev            = xfs_fs_get_xstatev,
        .get_xstate             = xfs_fs_get_xstate,
-       .set_xstate             = xfs_fs_set_xstate,
+       .quota_enable           = xfs_quota_enable,
+       .quota_disable          = xfs_quota_disable,
        .rm_xquota              = xfs_fs_rm_xquota,
        .get_dqblk              = xfs_fs_get_dqblk,
        .set_dqblk              = xfs_fs_set_dqblk,