diff options
author | Jan Kara <jack@suse.cz> | 2014-10-08 09:56:21 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2015-01-30 06:49:40 -0500 |
commit | 38e478c4489a845a5e8baf7849c286af5fed5b66 (patch) | |
tree | f001a8e58e17e32d3969ad3069621919ea4b9dcf /fs/xfs | |
parent | 1cd6b7be92016538ea1f2a8e1f955e9b974d93ea (diff) |
quota: Split ->set_xstate callback into two
Split ->set_xstate callback into two callbacks - one for turning quotas
on (->quota_enable) and one for turning quotas off (->quota_disable). That
way we don't have to pass quotactl command into the callback which seems
cleaner.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_quotaops.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c index a226203fa46a..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 (!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 |
@@ -166,7 +180,8 @@ xfs_fs_set_dqblk( | |||
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, |