From: Jan Kara <jack@suse.cz>
To: linux-fsdevel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
Curt Wohlgemuth <curtw@google.com>,
Al Viro <viro@ZenIV.linux.org.uk>, Jan Kara <jack@suse.cz>
Subject: [PATCH 2/5] vfs: Move noop_backing_dev_info check from sync into writeback
Date: Wed, 27 Jul 2011 00:38:03 +0200 [thread overview]
Message-ID: <1311719886-1130-3-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1311719886-1130-1-git-send-email-jack@suse.cz>
In principle, a filesystem may want to have ->sync_fs() called during sync(1)
although it does not have a bdi (i.e. s_bdi is set to noop_backing_dev_info).
Only writeback code really needs bdi set to something reasonable. So move the
checks where they are more logical.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/fs-writeback.c | 6 ++++++
fs/sync.c | 9 +--------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 0f015a0..82a876b 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1194,6 +1194,9 @@ void writeback_inodes_sb_nr(struct super_block *sb, unsigned long nr)
.nr_pages = nr,
};
+ /* Nothing to do? */
+ if (sb->s_bdi == &noop_backing_dev_info)
+ return;
WARN_ON(!rwsem_is_locked(&sb->s_umount));
bdi_queue_work(sb->s_bdi, &work);
wait_for_completion(&done);
@@ -1272,6 +1275,9 @@ void sync_inodes_sb(struct super_block *sb)
.done = &done,
};
+ /* Nothing to do? */
+ if (sb->s_bdi == &noop_backing_dev_info)
+ return;
WARN_ON(!rwsem_is_locked(&sb->s_umount));
bdi_queue_work(sb->s_bdi, &work);
diff --git a/fs/sync.c b/fs/sync.c
index f8f21d9..2f5bd52 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -63,13 +63,6 @@ int sync_filesystem(struct super_block *sb)
if (sb->s_flags & MS_RDONLY)
return 0;
- /*
- * This should be safe, as we require bdi backing to actually
- * write out data in the first place.
- */
- if (sb->s_bdi == &noop_backing_dev_info)
- return 0;
-
__sync_filesystem(sb, 0);
ret = __sync_blockdev(sb->s_bdev, 0);
if (ret < 0)
@@ -82,7 +75,7 @@ EXPORT_SYMBOL_GPL(sync_filesystem);
static void sync_one_sb(struct super_block *sb, void *arg)
{
/* Avoid read-only filesystems and filesystems without backing device */
- if (!(sb->s_flags & MS_RDONLY) && sb->s_bdi != &noop_backing_dev_info)
+ if (!(sb->s_flags & MS_RDONLY))
__sync_filesystem(sb, *(int *)arg);
}
/*
--
1.7.1
next prev parent reply other threads:[~2011-07-26 22:38 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 22:38 [PATCH 0/5 v2] Improve sync(2) handling Jan Kara
2011-07-26 22:38 ` [PATCH 1/5] vfs: Make sync(1) writeout also block device inodes Jan Kara
2011-07-27 9:44 ` Christoph Hellwig
2011-07-28 20:13 ` Jan Kara
2011-07-26 22:38 ` Jan Kara [this message]
2011-07-27 9:44 ` [PATCH 2/5] vfs: Move noop_backing_dev_info check from sync into writeback Christoph Hellwig
2011-07-26 22:38 ` [PATCH 3/5] quota: Split dquot_quota_sync() to writeback and cache flushing part Jan Kara
2011-07-27 8:26 ` Steven Whitehouse
2011-07-27 9:45 ` Christoph Hellwig
2011-07-26 22:38 ` [PATCH 4/5] quota: Move quota syncing to ->sync_fs method Jan Kara
2011-07-27 8:32 ` Steven Whitehouse
2011-07-27 9:46 ` Christoph Hellwig
2011-07-27 13:44 ` Dave Kleikamp
2011-07-26 22:38 ` [PATCH 5/5] vfs: Avoid unnecessary WB_SYNC_NONE writeback during sync(1) Jan Kara
2011-07-27 9:52 ` Christoph Hellwig
2011-07-28 17:42 ` Jan Kara
2011-07-28 20:37 ` Christoph Hellwig
2011-07-28 21:20 ` Curt Wohlgemuth
2011-07-29 11:09 ` Christoph Hellwig
2011-09-28 15:00 ` [PATCH 0/5 v2] Improve sync(2) handling Christoph Hellwig
2011-10-06 22:20 ` Jan Kara
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=1311719886-1130-3-git-send-email-jack@suse.cz \
--to=jack@suse.cz \
--cc=curtw@google.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--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).