From: Jan Kara Subject: [PATCH 6/6] vfs: Avoid unnecessary WB_SYNC_NONE writeback during sys_sync and reorder sync passes Date: Fri, 7 Oct 2011 22:40:55 +0200 Message-ID: <1318020055-4450-7-git-send-email-jack@suse.cz> References: <1318020055-4450-1-git-send-email-jack@suse.cz> Cc: Curt Wohlgemuth , linux-fsdevel@vger.kernel.org, Al Viro , Jan Kara To: Christoph Hellwig Return-path: Received: from cantor2.suse.de ([195.135.220.15]:35904 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758145Ab1JGUlL (ORCPT ); Fri, 7 Oct 2011 16:41:11 -0400 In-Reply-To: <1318020055-4450-1-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: wakeup_flusher_threads(0) will queue work doing complete writeback for each flusher thread. Thus there is not much point in submitting another work doing full inode WB_SYNC_NONE writeback by writeback_inodes_sb(). After this change it does not make sense to call nonblocking ->sync_fs and block device flush before calling sync_inodes_sb() because wakeup_flusher_threads() is completely asynchronous and thus these functions would be called in parallel with inode writeback running which will effectively void any work they do. So we move sync_inodes_sb() call before these two functions. Signed-off-by: Jan Kara --- fs/sync.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/fs/sync.c b/fs/sync.c index 7c55c5d..02ba2a5 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -133,10 +133,9 @@ SYSCALL_DEFINE0(sync) int nowait = 0, wait = 1; wakeup_flusher_threads(0); - iterate_supers(sync_inodes_one_sb, &nowait); + iterate_supers(sync_inodes_one_sb, &wait); iterate_supers(sync_fs_one_sb, &nowait); sync_all_bdevs(nowait); - iterate_supers(sync_inodes_one_sb, &wait); iterate_supers(sync_fs_one_sb, &wait); sync_all_bdevs(wait); if (unlikely(laptop_mode)) -- 1.7.1