diff options
Diffstat (limited to 'fs/xfs/xfs_quotaops.c')
| -rw-r--r-- | fs/xfs/xfs_quotaops.c | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index 7542bbeca6a1..6923905ab33d 100644 --- a/fs/xfs/xfs_quotaops.c +++ b/fs/xfs/xfs_quotaops.c | |||
| @@ -64,19 +64,10 @@ xfs_fs_get_xstatev( | |||
| 64 | return xfs_qm_scall_getqstatv(mp, fqs); | 64 | return xfs_qm_scall_getqstatv(mp, fqs); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | STATIC int | 67 | static unsigned int |
| 68 | xfs_fs_set_xstate( | 68 | xfs_quota_flags(unsigned int uflags) |
| 69 | struct super_block *sb, | ||
| 70 | unsigned int uflags, | ||
| 71 | int op) | ||
| 72 | { | 69 | { |
| 73 | struct xfs_mount *mp = XFS_M(sb); | 70 | unsigned int flags = 0; |
| 74 | unsigned int flags = 0; | ||
| 75 | |||
| 76 | if (sb->s_flags & MS_RDONLY) | ||
| 77 | return -EROFS; | ||
| 78 | if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp)) | ||
| 79 | return -ENOSYS; | ||
| 80 | 71 | ||
| 81 | if (uflags & FS_QUOTA_UDQ_ACCT) | 72 | if (uflags & FS_QUOTA_UDQ_ACCT) |
| 82 | flags |= XFS_UQUOTA_ACCT; | 73 | flags |= XFS_UQUOTA_ACCT; |
| @@ -91,16 +82,39 @@ xfs_fs_set_xstate( | |||
| 91 | if (uflags & FS_QUOTA_PDQ_ENFD) | 82 | if (uflags & FS_QUOTA_PDQ_ENFD) |
| 92 | flags |= XFS_PQUOTA_ENFD; | 83 | flags |= XFS_PQUOTA_ENFD; |
| 93 | 84 | ||
| 94 | switch (op) { | 85 | return flags; |
| 95 | case Q_XQUOTAON: | 86 | } |
| 96 | return xfs_qm_scall_quotaon(mp, flags); | 87 | |
| 97 | case Q_XQUOTAOFF: | 88 | STATIC int |
| 98 | if (!XFS_IS_QUOTA_ON(mp)) | 89 | xfs_quota_enable( |
| 99 | return -EINVAL; | 90 | struct super_block *sb, |
| 100 | return xfs_qm_scall_quotaoff(mp, flags); | 91 | unsigned int uflags) |
| 101 | } | 92 | { |
| 93 | struct xfs_mount *mp = XFS_M(sb); | ||
| 94 | |||
| 95 | if (sb->s_flags & MS_RDONLY) | ||
| 96 | return -EROFS; | ||
| 97 | if (!XFS_IS_QUOTA_RUNNING(mp)) | ||
| 98 | return -ENOSYS; | ||
| 99 | |||
| 100 | return xfs_qm_scall_quotaon(mp, xfs_quota_flags(uflags)); | ||
| 101 | } | ||
| 102 | |||
| 103 | STATIC int | ||
| 104 | xfs_quota_disable( | ||
| 105 | struct super_block *sb, | ||
| 106 | unsigned int uflags) | ||
| 107 | { | ||
| 108 | struct xfs_mount *mp = XFS_M(sb); | ||
| 109 | |||
| 110 | if (sb->s_flags & MS_RDONLY) | ||
| 111 | return -EROFS; | ||
| 112 | if (!XFS_IS_QUOTA_RUNNING(mp)) | ||
| 113 | return -ENOSYS; | ||
| 114 | if (!XFS_IS_QUOTA_ON(mp)) | ||
| 115 | return -EINVAL; | ||
| 102 | 116 | ||
| 103 | return -EINVAL; | 117 | return xfs_qm_scall_quotaoff(mp, xfs_quota_flags(uflags)); |
| 104 | } | 118 | } |
| 105 | 119 | ||
| 106 | STATIC int | 120 | STATIC int |
| @@ -131,7 +145,7 @@ STATIC int | |||
| 131 | xfs_fs_get_dqblk( | 145 | xfs_fs_get_dqblk( |
| 132 | struct super_block *sb, | 146 | struct super_block *sb, |
| 133 | struct kqid qid, | 147 | struct kqid qid, |
| 134 | struct fs_disk_quota *fdq) | 148 | struct qc_dqblk *qdq) |
| 135 | { | 149 | { |
| 136 | struct xfs_mount *mp = XFS_M(sb); | 150 | struct xfs_mount *mp = XFS_M(sb); |
| 137 | 151 | ||
| @@ -141,14 +155,14 @@ xfs_fs_get_dqblk( | |||
| 141 | return -ESRCH; | 155 | return -ESRCH; |
| 142 | 156 | ||
| 143 | return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid), | 157 | return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid), |
| 144 | xfs_quota_type(qid.type), fdq); | 158 | xfs_quota_type(qid.type), qdq); |
| 145 | } | 159 | } |
| 146 | 160 | ||
| 147 | STATIC int | 161 | STATIC int |
| 148 | xfs_fs_set_dqblk( | 162 | xfs_fs_set_dqblk( |
| 149 | struct super_block *sb, | 163 | struct super_block *sb, |
| 150 | struct kqid qid, | 164 | struct kqid qid, |
| 151 | struct fs_disk_quota *fdq) | 165 | struct qc_dqblk *qdq) |
| 152 | { | 166 | { |
| 153 | struct xfs_mount *mp = XFS_M(sb); | 167 | struct xfs_mount *mp = XFS_M(sb); |
| 154 | 168 | ||
| @@ -160,13 +174,14 @@ xfs_fs_set_dqblk( | |||
| 160 | return -ESRCH; | 174 | return -ESRCH; |
| 161 | 175 | ||
| 162 | return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid), | 176 | return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid), |
| 163 | xfs_quota_type(qid.type), fdq); | 177 | xfs_quota_type(qid.type), qdq); |
| 164 | } | 178 | } |
| 165 | 179 | ||
| 166 | const struct quotactl_ops xfs_quotactl_operations = { | 180 | const struct quotactl_ops xfs_quotactl_operations = { |
| 167 | .get_xstatev = xfs_fs_get_xstatev, | 181 | .get_xstatev = xfs_fs_get_xstatev, |
| 168 | .get_xstate = xfs_fs_get_xstate, | 182 | .get_xstate = xfs_fs_get_xstate, |
| 169 | .set_xstate = xfs_fs_set_xstate, | 183 | .quota_enable = xfs_quota_enable, |
| 184 | .quota_disable = xfs_quota_disable, | ||
| 170 | .rm_xquota = xfs_fs_rm_xquota, | 185 | .rm_xquota = xfs_fs_rm_xquota, |
| 171 | .get_dqblk = xfs_fs_get_dqblk, | 186 | .get_dqblk = xfs_fs_get_dqblk, |
| 172 | .set_dqblk = xfs_fs_set_dqblk, | 187 | .set_dqblk = xfs_fs_set_dqblk, |
