diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-05-19 07:16:41 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-05-24 08:06:40 -0400 |
commit | 0f0dd62fddcbd0f6830ed8ef3d3426ccc46b9250 (patch) | |
tree | 295ac31b109f78873cb191867603943d8562ead0 /fs/quota | |
parent | c79d967de3741ceb60c5bbbf1b6f97eab9a89838 (diff) |
quota: kill the vfs_dq_off and vfs_dq_quota_on_remount wrappers
Instead of having wrappers in the VFS namespace export the dquot_suspend
and dquot_resume helpers directly. Also rename vfs_quota_disable to
dquot_disable while we're at it.
[Jan Kara: Moved dquot_suspend to quotaops.h and made it inline]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 655a4c52b8c3..cf972283e474 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -1865,7 +1865,7 @@ EXPORT_SYMBOL(dquot_file_open); | |||
1865 | /* | 1865 | /* |
1866 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) | 1866 | * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) |
1867 | */ | 1867 | */ |
1868 | int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags) | 1868 | int dquot_disable(struct super_block *sb, int type, unsigned int flags) |
1869 | { | 1869 | { |
1870 | int cnt, ret = 0; | 1870 | int cnt, ret = 0; |
1871 | struct quota_info *dqopt = sb_dqopt(sb); | 1871 | struct quota_info *dqopt = sb_dqopt(sb); |
@@ -1995,14 +1995,16 @@ put_inodes: | |||
1995 | } | 1995 | } |
1996 | return ret; | 1996 | return ret; |
1997 | } | 1997 | } |
1998 | EXPORT_SYMBOL(vfs_quota_disable); | 1998 | EXPORT_SYMBOL(dquot_disable); |
1999 | 1999 | ||
2000 | int vfs_quota_off(struct super_block *sb, int type, int remount) | 2000 | int vfs_quota_off(struct super_block *sb, int type, int remount) |
2001 | { | 2001 | { |
2002 | return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED : | 2002 | BUG_ON(remount); |
2003 | (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED)); | 2003 | return dquot_disable(sb, type, |
2004 | DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | ||
2004 | } | 2005 | } |
2005 | EXPORT_SYMBOL(vfs_quota_off); | 2006 | EXPORT_SYMBOL(vfs_quota_off); |
2007 | |||
2006 | /* | 2008 | /* |
2007 | * Turn quotas on on a device | 2009 | * Turn quotas on on a device |
2008 | */ | 2010 | */ |
@@ -2120,34 +2122,41 @@ out_fmt: | |||
2120 | } | 2122 | } |
2121 | 2123 | ||
2122 | /* Reenable quotas on remount RW */ | 2124 | /* Reenable quotas on remount RW */ |
2123 | static int vfs_quota_on_remount(struct super_block *sb, int type) | 2125 | int dquot_resume(struct super_block *sb, int type) |
2124 | { | 2126 | { |
2125 | struct quota_info *dqopt = sb_dqopt(sb); | 2127 | struct quota_info *dqopt = sb_dqopt(sb); |
2126 | struct inode *inode; | 2128 | struct inode *inode; |
2127 | int ret; | 2129 | int ret = 0, cnt; |
2128 | unsigned int flags; | 2130 | unsigned int flags; |
2129 | 2131 | ||
2130 | mutex_lock(&dqopt->dqonoff_mutex); | 2132 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
2131 | if (!sb_has_quota_suspended(sb, type)) { | 2133 | if (type != -1 && cnt != type) |
2134 | continue; | ||
2135 | |||
2136 | mutex_lock(&dqopt->dqonoff_mutex); | ||
2137 | if (!sb_has_quota_suspended(sb, cnt)) { | ||
2138 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
2139 | continue; | ||
2140 | } | ||
2141 | inode = dqopt->files[cnt]; | ||
2142 | dqopt->files[cnt] = NULL; | ||
2143 | spin_lock(&dq_state_lock); | ||
2144 | flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | | ||
2145 | DQUOT_LIMITS_ENABLED, | ||
2146 | cnt); | ||
2147 | dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, cnt); | ||
2148 | spin_unlock(&dq_state_lock); | ||
2132 | mutex_unlock(&dqopt->dqonoff_mutex); | 2149 | mutex_unlock(&dqopt->dqonoff_mutex); |
2133 | return 0; | ||
2134 | } | ||
2135 | inode = dqopt->files[type]; | ||
2136 | dqopt->files[type] = NULL; | ||
2137 | spin_lock(&dq_state_lock); | ||
2138 | flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | | ||
2139 | DQUOT_LIMITS_ENABLED, type); | ||
2140 | dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type); | ||
2141 | spin_unlock(&dq_state_lock); | ||
2142 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
2143 | 2150 | ||
2144 | flags = dquot_generic_flag(flags, type); | 2151 | flags = dquot_generic_flag(flags, cnt); |
2145 | ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id, | 2152 | ret = vfs_load_quota_inode(inode, cnt, |
2146 | flags); | 2153 | dqopt->info[cnt].dqi_fmt_id, flags); |
2147 | iput(inode); | 2154 | iput(inode); |
2155 | } | ||
2148 | 2156 | ||
2149 | return ret; | 2157 | return ret; |
2150 | } | 2158 | } |
2159 | EXPORT_SYMBOL(dquot_resume); | ||
2151 | 2160 | ||
2152 | int vfs_quota_on_path(struct super_block *sb, int type, int format_id, | 2161 | int vfs_quota_on_path(struct super_block *sb, int type, int format_id, |
2153 | struct path *path) | 2162 | struct path *path) |
@@ -2172,8 +2181,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name, | |||
2172 | struct path path; | 2181 | struct path path; |
2173 | int error; | 2182 | int error; |
2174 | 2183 | ||
2175 | if (remount) | 2184 | BUG_ON(remount); |
2176 | return vfs_quota_on_remount(sb, type); | ||
2177 | 2185 | ||
2178 | error = kern_path(name, LOOKUP_FOLLOW, &path); | 2186 | error = kern_path(name, LOOKUP_FOLLOW, &path); |
2179 | if (!error) { | 2187 | if (!error) { |
@@ -2196,8 +2204,8 @@ int vfs_quota_enable(struct inode *inode, int type, int format_id, | |||
2196 | struct quota_info *dqopt = sb_dqopt(sb); | 2204 | struct quota_info *dqopt = sb_dqopt(sb); |
2197 | 2205 | ||
2198 | /* Just unsuspend quotas? */ | 2206 | /* Just unsuspend quotas? */ |
2199 | if (flags & DQUOT_SUSPENDED) | 2207 | BUG_ON(flags & DQUOT_SUSPENDED); |
2200 | return vfs_quota_on_remount(sb, type); | 2208 | |
2201 | if (!flags) | 2209 | if (!flags) |
2202 | return 0; | 2210 | return 0; |
2203 | /* Just updating flags needed? */ | 2211 | /* Just updating flags needed? */ |
@@ -2263,23 +2271,6 @@ out: | |||
2263 | } | 2271 | } |
2264 | EXPORT_SYMBOL(vfs_quota_on_mount); | 2272 | EXPORT_SYMBOL(vfs_quota_on_mount); |
2265 | 2273 | ||
2266 | /* Wrapper to turn on quotas when remounting rw */ | ||
2267 | int vfs_dq_quota_on_remount(struct super_block *sb) | ||
2268 | { | ||
2269 | int cnt; | ||
2270 | int ret = 0, err; | ||
2271 | |||
2272 | if (!sb->s_qcop || !sb->s_qcop->quota_on) | ||
2273 | return -ENOSYS; | ||
2274 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | ||
2275 | err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1); | ||
2276 | if (err < 0 && !ret) | ||
2277 | ret = err; | ||
2278 | } | ||
2279 | return ret; | ||
2280 | } | ||
2281 | EXPORT_SYMBOL(vfs_dq_quota_on_remount); | ||
2282 | |||
2283 | static inline qsize_t qbtos(qsize_t blocks) | 2274 | static inline qsize_t qbtos(qsize_t blocks) |
2284 | { | 2275 | { |
2285 | return blocks << QIF_DQBLKSIZE_BITS; | 2276 | return blocks << QIF_DQBLKSIZE_BITS; |