From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: [PATCH 1/8] vfs: Move noop_backing_dev_info check from sync into writeback Date: Fri, 6 Jan 2012 00:46:19 +0100 Message-ID: <1325807186-3397-2-git-send-email-jack@suse.cz> References: <1325807186-3397-1-git-send-email-jack@suse.cz> Cc: Christoph Hellwig , Al Viro , Jan Kara To: linux-fsdevel@vger.kernel.org Return-path: Received: from cantor2.suse.de ([195.135.220.15]:39322 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932968Ab2AEXq4 (ORCPT ); Thu, 5 Jan 2012 18:46:56 -0500 In-Reply-To: <1325807186-3397-1-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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. Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara --- fs/fs-writeback.c | 5 +++++ fs/sync.c | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 73c3992..2447206 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1242,6 +1242,8 @@ void writeback_inodes_sb_nr(struct super_block *sb, .reason = reason, }; + 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); @@ -1322,6 +1324,9 @@ void sync_inodes_sb(struct super_block *sb) .reason = WB_REASON_SYNC, }; + /* 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 101b8ef..878d721 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -30,13 +30,6 @@ */ static int __sync_filesystem(struct super_block *sb, int wait) { - /* - * 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; - if (sb->s_qcop && sb->s_qcop->quota_sync) sb->s_qcop->quota_sync(sb, -1, wait); -- 1.7.1