From: Jan Kara <jack@suse.cz>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
linux-fsdevel@vger.kernel.org,
Christoph Hellwig <hch@infradead.org>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@lst.de>, Jan Kara <jack@suse.cz>
Subject: [PATCH 7/8] quota: cleanup dquota sync functions (version 4)
Date: Mon, 27 Apr 2009 16:43:54 +0200 [thread overview]
Message-ID: <1240843435-1786-8-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1240843435-1786-1-git-send-email-jack@suse.cz>
From: Christoph Hellwig <hch@lst.de>
Currently the VFS calls vfs_dq_sync to sync out disk quotas for a given
superblock. This is a small wrapper around sync_dquots which for the
case of a non-NULL superblock is a small wrapper around quota_sync_sb.
Just make quota_sync_sb global (rename it to sync_quota_sb) and call it
directly. Also call it directly for those cases in quota.c that have a
superblock and leave sync_dquots purely an iterator over sync_quota_sb and
remove it's superblock argument.
To make this nicer move the check for the lack of a quota_sync method
from the callers into sync_quota_sb.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/quota/quota.c | 23 ++++++++++++-----------
fs/sync.c | 2 +-
include/linux/quotaops.h | 11 +++--------
3 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index b7f5a46..5edb20d 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -159,10 +159,13 @@ static int check_quotactl_valid(struct super_block *sb, int type, int cmd,
return error;
}
-static void quota_sync_sb(struct super_block *sb, int type)
+void sync_quota_sb(struct super_block *sb, int type)
{
int cnt;
+ if (!sb->s_qcop->quota_sync)
+ return;
+
sb->s_qcop->quota_sync(sb, type);
if (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE)
@@ -192,16 +195,11 @@ static void quota_sync_sb(struct super_block *sb, int type)
mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
}
-void sync_dquots(struct super_block *sb, int type)
+static void sync_dquots(int type)
{
+ struct super_block *sb;
int cnt;
- if (sb) {
- if (sb->s_qcop->quota_sync)
- quota_sync_sb(sb, type);
- return;
- }
-
spin_lock(&sb_lock);
restart:
list_for_each_entry(sb, &super_blocks, s_list) {
@@ -222,8 +220,8 @@ restart:
sb->s_count++;
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
- if (sb->s_root && sb->s_qcop->quota_sync)
- quota_sync_sb(sb, type);
+ if (sb->s_root)
+ sync_quota_sb(sb, type);
up_read(&sb->s_umount);
spin_lock(&sb_lock);
if (__put_super_and_need_restart(sb))
@@ -301,7 +299,10 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
return sb->s_qcop->set_dqblk(sb, type, id, &idq);
}
case Q_SYNC:
- sync_dquots(sb, type);
+ if (sb)
+ sync_quota_sb(sb, type);
+ else
+ sync_dquots(type);
return 0;
case Q_XQUOTAON:
diff --git a/fs/sync.c b/fs/sync.c
index c3ef04e..4914f0a 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -26,7 +26,7 @@
*/
static int __sync_filesystem(struct super_block *sb, int wait)
{
- vfs_dq_sync(sb);
+ sync_quota_sb(sb, -1);
sync_inodes_sb(sb, wait);
lock_super(sb);
if (sb->s_dirt && sb->s_op->write_super)
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 36353d9..047310f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -20,7 +20,7 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
/*
* declaration of quota_function calls in kernel.
*/
-void sync_dquots(struct super_block *sb, int type);
+void sync_quota_sb(struct super_block *sb, int type);
int dquot_initialize(struct inode *inode, int type);
int dquot_drop(struct inode *inode);
@@ -253,12 +253,7 @@ static inline void vfs_dq_free_inode(struct inode *inode)
inode->i_sb->dq_op->free_inode(inode, 1);
}
-/* The following two functions cannot be called inside a transaction */
-static inline void vfs_dq_sync(struct super_block *sb)
-{
- sync_dquots(sb, -1);
-}
-
+/* Cannot be called inside a transaction */
static inline int vfs_dq_off(struct super_block *sb, int remount)
{
int ret = -ENOSYS;
@@ -334,7 +329,7 @@ static inline void vfs_dq_free_inode(struct inode *inode)
{
}
-static inline void vfs_dq_sync(struct super_block *sb)
+static inline void sync_quota_sb(struct super_block *sb, int type)
{
}
--
1.6.0.2
next prev parent reply other threads:[~2009-04-27 14:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 14:43 [PATCH 0/8] Sync fixes and cleanups (version 4) Jan Kara
2009-04-27 14:43 ` [PATCH 1/8] vfs: Fix sys_sync() and fsync_super() reliability " Jan Kara
2009-04-27 19:38 ` Andrew Morton
2009-04-28 11:56 ` Jan Kara
2009-04-27 14:43 ` [PATCH 2/8] vfs: Call ->sync_fs() even if s_dirt is 0 " Jan Kara
2009-04-27 14:43 ` [PATCH 3/8] vfs: Make __fsync_super() a static function " Jan Kara
2009-04-27 14:43 ` [PATCH 4/8] vfs: Make sys_sync() use fsync_super() " Jan Kara
2009-04-27 14:43 ` [PATCH 5/8] vfs: Move syncing code from super.c to sync.c " Jan Kara
2009-04-27 14:43 ` [PATCH 6/8] vfs: Rename fsync_super() to sync_filesystem() " Jan Kara
2009-04-27 14:43 ` Jan Kara [this message]
2009-04-27 14:43 ` [PATCH 8/8] quota: Introduce writeout_quota_sb() " Jan Kara
2009-04-27 17:36 ` [PATCH 0/8] Sync fixes and cleanups " Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1240843435-1786-8-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=trond.myklebust@fys.uio.no \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).