summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-05-19 07:16:41 -0400
committerJan Kara <jack@suse.cz>2010-05-24 14:06:40 +0200
commit0f0dd62fddcbd0f6830ed8ef3d3426ccc46b9250 (patch)
tree295ac31b109f78873cb191867603943d8562ead0 /fs
parentc79d967de3741ceb60c5bbbf1b6f97eab9a89838 (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')
-rw-r--r--fs/ext2/super.c7
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/ext4/super.c8
-rw-r--r--fs/jfs/super.c8
-rw-r--r--fs/ocfs2/super.c14
-rw-r--r--fs/quota/dquot.c77
-rw-r--r--fs/reiserfs/super.c8
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/ufs/super.c8
9 files changed, 61 insertions, 83 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 73346de9af5c..318ebc58bb7b 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1250,9 +1250,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
es->s_mtime = cpu_to_le32(get_seconds());
spin_unlock(&sbi->s_lock);
- err = vfs_dq_off(sb, 1);
- if (err < 0 && err != -ENOSYS) {
- err = -EBUSY;
+ err = dquot_suspend(sb, -1);
+ if (err < 0) {
spin_lock(&sbi->s_lock);
goto restore_opts;
}
@@ -1281,7 +1280,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
ext2_write_super(sb);
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
}
return 0;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index d0f8837b6255..9d5e582b514a 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2598,11 +2598,9 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
}
if (*flags & MS_RDONLY) {
- err = vfs_dq_off(sb, 1);
- if (err < 0 && err != -ENOSYS) {
- err = -EBUSY;
+ err = dquot_suspend(sb, -1);
+ if (err < 0)
goto restore_opts;
- }
/*
* First of all, the unconditional stuff we have to do
@@ -2672,7 +2670,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
unlock_kernel();
if (enable_quota)
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
return 0;
restore_opts:
sb->s_flags = old_sb_flags;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fb1e191d0fa9..08d31101eb05 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3631,11 +3631,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
}
if (*flags & MS_RDONLY) {
- err = vfs_dq_off(sb, 1);
- if (err < 0 && err != -ENOSYS) {
- err = -EBUSY;
+ err = dquot_suspend(sb, -1);
+ if (err < 0)
goto restore_opts;
- }
/*
* First of all, the unconditional stuff we have to do
@@ -3722,7 +3720,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
unlock_super(sb);
unlock_kernel();
if (enable_quota)
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
return 0;
restore_opts:
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 5329d66a9704..b8a07d4c108e 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -401,14 +401,14 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
sb->s_flags &= ~MS_RDONLY;
unlock_kernel();
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
return ret;
}
if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
- rc = vfs_dq_off(sb, 1);
- if (rc < 0 && rc != -ENOSYS) {
+ rc = dquot_suspend(sb, -1);
+ if (rc < 0) {
unlock_kernel();
- return -EBUSY;
+ return rc;
}
rc = jfs_umount_rw(sb);
JFS_SBI(sb)->flag = flag;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 66f9984a983c..0773873d590a 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -879,18 +879,14 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
continue;
if (unsuspend)
- status = vfs_quota_enable(
- sb_dqopt(sb)->files[type],
- type, QFMT_OCFS2,
- DQUOT_SUSPENDED);
+ status = dquot_resume(sb, type);
else {
struct ocfs2_mem_dqinfo *oinfo;
/* Cancel periodic syncing before suspending */
oinfo = sb_dqinfo(sb, type)->dqi_priv;
cancel_delayed_work_sync(&oinfo->dqi_sync_work);
- status = vfs_quota_disable(sb, type,
- DQUOT_SUSPENDED);
+ status = dquot_suspend(sb, type);
}
if (status < 0)
break;
@@ -958,8 +954,8 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
/* Turn off quotas. This will remove all dquot structures from
* memory and so they will be automatically synced to global
* quota files */
- vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED |
- DQUOT_LIMITS_ENABLED);
+ dquot_disable(sb, type, DQUOT_USAGE_ENABLED |
+ DQUOT_LIMITS_ENABLED);
if (!inode)
continue;
iput(inode);
@@ -989,7 +985,7 @@ static int ocfs2_quota_off(struct super_block *sb, int type, int remount)
if (remount)
return 0; /* Ignore now and handle later in
* ocfs2_remount() */
- return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED);
+ return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
}
static const struct quotactl_ops ocfs2_quotactl_ops = {
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);
/*
* Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
*/
-int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)
+int dquot_disable(struct super_block *sb, int type, unsigned int flags)
{
int cnt, ret = 0;
struct quota_info *dqopt = sb_dqopt(sb);
@@ -1995,14 +1995,16 @@ put_inodes:
}
return ret;
}
-EXPORT_SYMBOL(vfs_quota_disable);
+EXPORT_SYMBOL(dquot_disable);
int vfs_quota_off(struct super_block *sb, int type, int remount)
{
- return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED :
- (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED));
+ BUG_ON(remount);
+ return dquot_disable(sb, type,
+ DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
}
EXPORT_SYMBOL(vfs_quota_off);
+
/*
* Turn quotas on on a device
*/
@@ -2120,34 +2122,41 @@ out_fmt:
}
/* Reenable quotas on remount RW */
-static int vfs_quota_on_remount(struct super_block *sb, int type)
+int dquot_resume(struct super_block *sb, int type)
{
struct quota_info *dqopt = sb_dqopt(sb);
struct inode *inode;
- int ret;
+ int ret = 0, cnt;
unsigned int flags;
- mutex_lock(&dqopt->dqonoff_mutex);
- if (!sb_has_quota_suspended(sb, type)) {
+ for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
+ if (type != -1 && cnt != type)
+ continue;
+
+ mutex_lock(&dqopt->dqonoff_mutex);
+ if (!sb_has_quota_suspended(sb, cnt)) {
+ mutex_unlock(&dqopt->dqonoff_mutex);
+ continue;
+ }
+ inode = dqopt->files[cnt];
+ dqopt->files[cnt] = NULL;
+ spin_lock(&dq_state_lock);
+ flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
+ DQUOT_LIMITS_ENABLED,
+ cnt);
+ dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, cnt);
+ spin_unlock(&dq_state_lock);
mutex_unlock(&dqopt->dqonoff_mutex);
- return 0;
- }
- inode = dqopt->files[type];
- dqopt->files[type] = NULL;
- spin_lock(&dq_state_lock);
- flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
- DQUOT_LIMITS_ENABLED, type);
- dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type);
- spin_unlock(&dq_state_lock);
- mutex_unlock(&dqopt->dqonoff_mutex);
- flags = dquot_generic_flag(flags, type);
- ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id,
- flags);
- iput(inode);
+ flags = dquot_generic_flag(flags, cnt);
+ ret = vfs_load_quota_inode(inode, cnt,
+ dqopt->info[cnt].dqi_fmt_id, flags);
+ iput(inode);
+ }
return ret;
}
+EXPORT_SYMBOL(dquot_resume);
int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
struct path *path)
@@ -2172,8 +2181,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
struct path path;
int error;
- if (remount)
- return vfs_quota_on_remount(sb, type);
+ BUG_ON(remount);
error = kern_path(name, LOOKUP_FOLLOW, &path);
if (!error) {
@@ -2196,8 +2204,8 @@ int vfs_quota_enable(struct inode *inode, int type, int format_id,
struct quota_info *dqopt = sb_dqopt(sb);
/* Just unsuspend quotas? */
- if (flags & DQUOT_SUSPENDED)
- return vfs_quota_on_remount(sb, type);
+ BUG_ON(flags & DQUOT_SUSPENDED);
+
if (!flags)
return 0;
/* Just updating flags needed? */
@@ -2263,23 +2271,6 @@ out:
}
EXPORT_SYMBOL(vfs_quota_on_mount);
-/* Wrapper to turn on quotas when remounting rw */
-int vfs_dq_quota_on_remount(struct super_block *sb)
-{
- int cnt;
- int ret = 0, err;
-
- if (!sb->s_qcop || !sb->s_qcop->quota_on)
- return -ENOSYS;
- for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
- err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
- if (err < 0 && !ret)
- ret = err;
- }
- return ret;
-}
-EXPORT_SYMBOL(vfs_dq_quota_on_remount);
-
static inline qsize_t qbtos(qsize_t blocks)
{
return blocks << QIF_DQBLKSIZE_BITS;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 49a8ba02bc17..5dad5a2707bc 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1243,11 +1243,9 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
/* it is read-only already */
goto out_ok;
- err = vfs_dq_off(s, 1);
- if (err < 0 && err != -ENOSYS) {
- err = -EBUSY;
+ err = dquot_suspend(s, -1);
+ if (err < 0)
goto out_err;
- }
/* try to remount file system with read-only permissions */
if (sb_umount_state(rs) == REISERFS_VALID_FS
@@ -1302,7 +1300,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
s->s_dirt = 0;
if (!(*mount_flags & MS_RDONLY)) {
- vfs_dq_quota_on_remount(s);
+ dquot_resume(s, -1);
finish_unfinished(s);
reiserfs_xattr_init(s, *mount_flags);
}
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 9ab4e259404b..b154c41a7a9a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -590,15 +590,13 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
if (*flags & MS_RDONLY) {
udf_close_lvid(sb);
- error = vfs_dq_off(sb, 1);
- if (error < 0 && error != -ENOSYS)
- error = -EBUSY;
+ error = dquot_suspend(sb, -1);
} else {
udf_open_lvid(sb);
/* mark the fs r/w for quota activity */
sb->s_flags &= ~MS_RDONLY;
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
}
out_unlock:
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index be1f7b05bc28..495fdc1df7eb 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1291,11 +1291,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
* fs was mouted as rw, remounting ro
*/
if (*mount_flags & MS_RDONLY) {
- err = vfs_dq_off(sb, 1);
- if (err < 0 && err != -ENOSYS) {
+ err = dquot_suspend(sb, -1);
+ if (err < 0) {
unlock_super(sb);
unlock_kernel();
- return -EBUSY;
+ return err;
}
ufs_put_super_internal(sb);
@@ -1343,7 +1343,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
unlock_super(sb);
unlock_kernel();
if (enable_quota)
- vfs_dq_quota_on_remount(sb);
+ dquot_resume(sb, -1);
return 0;
}