aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-02-16 03:44:51 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:24 -0500
commit8c4e4acd660a09e571a71583b5bbe1eee700c9ad (patch)
tree05d1208e70d96dfa6857dbb84de7f3554a721992
parentc988afb5fa3fc450207c3dfc0ce535f4bfdae4d1 (diff)
quota: clean up Q_XQUOTASYNC
Currently Q_XQUOTASYNC calls into the quota_sync method, but XFS does something entirely different in it than the rest of the filesystems. xfs_quota which calls Q_XQUOTASYNC expects an asynchronous data writeout to flush delayed allocations, while the "VFS" quota support wants to flush changes to the quota file. So make Q_XQUOTASYNC call into the writeback code directly and make the quota_sync method optional as XFS doesn't need in the sense expected by the rest of the quota code. GFS2 was using limited XFS-style quota and has a quota_sync method fitting neither the style used by vfs_quota_sync nor xfs_fs_quota_sync. I left it in for now as per discussion with Steve it expects to be called from the sync path this way. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/quota/quota.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_quotaops.c15
-rw-r--r--include/linux/quotaops.h2
3 files changed, 8 insertions, 20 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index d0efe302b1c1..3d31228082ea 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -18,6 +18,7 @@
18#include <linux/capability.h> 18#include <linux/capability.h>
19#include <linux/quotaops.h> 19#include <linux/quotaops.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/writeback.h>
21#include <net/netlink.h> 22#include <net/netlink.h>
22#include <net/genetlink.h> 23#include <net/genetlink.h>
23 24
@@ -52,7 +53,7 @@ void sync_quota_sb(struct super_block *sb, int type)
52{ 53{
53 int cnt; 54 int cnt;
54 55
55 if (!sb->s_qcop->quota_sync) 56 if (!sb->s_qcop || !sb->s_qcop->quota_sync)
56 return; 57 return;
57 58
58 sb->s_qcop->quota_sync(sb, type); 59 sb->s_qcop->quota_sync(sb, type);
@@ -318,9 +319,11 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
318 case Q_XGETQUOTA: 319 case Q_XGETQUOTA:
319 return quota_getxquota(sb, type, id, addr); 320 return quota_getxquota(sb, type, id, addr);
320 case Q_XQUOTASYNC: 321 case Q_XQUOTASYNC:
321 if (!sb->s_qcop->quota_sync) 322 /* caller already holds s_umount */
322 return -ENOSYS; 323 if (sb->s_flags & MS_RDONLY)
323 return sb->s_qcop->quota_sync(sb, type); 324 return -EROFS;
325 writeback_inodes_sb(sb);
326 return 0;
324 default: 327 default:
325 return -EINVAL; 328 return -EINVAL;
326 } 329 }
diff --git a/fs/xfs/linux-2.6/xfs_quotaops.c b/fs/xfs/linux-2.6/xfs_quotaops.c
index 3d4a0c84d634..07d67c624922 100644
--- a/fs/xfs/linux-2.6/xfs_quotaops.c
+++ b/fs/xfs/linux-2.6/xfs_quotaops.c
@@ -44,20 +44,6 @@ xfs_quota_type(int type)
44} 44}
45 45
46STATIC int 46STATIC int
47xfs_fs_quota_sync(
48 struct super_block *sb,
49 int type)
50{
51 struct xfs_mount *mp = XFS_M(sb);
52
53 if (sb->s_flags & MS_RDONLY)
54 return -EROFS;
55 if (!XFS_IS_QUOTA_RUNNING(mp))
56 return -ENOSYS;
57 return -xfs_sync_data(mp, 0);
58}
59
60STATIC int
61xfs_fs_get_xstate( 47xfs_fs_get_xstate(
62 struct super_block *sb, 48 struct super_block *sb,
63 struct fs_quota_stat *fqs) 49 struct fs_quota_stat *fqs)
@@ -151,7 +137,6 @@ xfs_fs_set_xquota(
151} 137}
152 138
153const struct quotactl_ops xfs_quotactl_operations = { 139const struct quotactl_ops xfs_quotactl_operations = {
154 .quota_sync = xfs_fs_quota_sync,
155 .get_xstate = xfs_fs_get_xstate, 140 .get_xstate = xfs_fs_get_xstate,
156 .set_xstate = xfs_fs_set_xstate, 141 .set_xstate = xfs_fs_set_xstate,
157 .get_xquota = xfs_fs_get_xquota, 142 .get_xquota = xfs_fs_get_xquota,
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index a529d86e7e73..69d26bc0f884 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -22,7 +22,7 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
22void sync_quota_sb(struct super_block *sb, int type); 22void sync_quota_sb(struct super_block *sb, int type);
23static inline void writeout_quota_sb(struct super_block *sb, int type) 23static inline void writeout_quota_sb(struct super_block *sb, int type)
24{ 24{
25 if (sb->s_qcop->quota_sync) 25 if (sb->s_qcop && sb->s_qcop->quota_sync)
26 sb->s_qcop->quota_sync(sb, type); 26 sb->s_qcop->quota_sync(sb, type);
27} 27}
28 28