From patchwork Tue Mar 20 14:41:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 147799 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9CB84B6EE6 for ; Wed, 21 Mar 2012 01:42:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760064Ab2CTOlq (ORCPT ); Tue, 20 Mar 2012 10:41:46 -0400 Received: from mga01.intel.com ([192.55.52.88]:29409 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760260Ab2CTOlo (ORCPT ); Tue, 20 Mar 2012 10:41:44 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 20 Mar 2012 07:41:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="141907442" Received: from blue.fi.intel.com (HELO np.fi.intel.com) ([10.237.72.50]) by fmsmga002.fm.intel.com with ESMTP; 20 Mar 2012 07:41:23 -0700 From: Artem Bityutskiy To: Ted Tso Cc: Ext4 Mailing List , Linux FS Maling List , Linux Kernel Maling List Subject: [PATCH v1 9/9] ext4: introduce own superblock dirty flag Date: Tue, 20 Mar 2012 16:41:29 +0200 Message-Id: <1332254489-2300-10-git-send-email-dedekind1@gmail.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1332254489-2300-1-git-send-email-dedekind1@gmail.com> References: <1332254489-2300-1-git-send-email-dedekind1@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Artem Bityutskiy We finally do not need VFS's 's_dirt' flag in ext4 - introduce our own 's_dirty' flag instead. Note: the final goal is to get rid of the 'sync_supers()' kernel thread which wakes up every 5 seconds and even if there is nothing to do. Thus, we are pushing superblock management from VFS down to file-systems. Signed-off-by: Artem Bityutskiy --- fs/ext4/ext4.h | 1 + fs/ext4/super.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 87e8376..be15b2d 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1158,6 +1158,7 @@ struct ext4_sb_info { u32 s_hash_seed[4]; int s_def_hash_version; int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ + int s_dirty; struct percpu_counter s_freeclusters_counter; struct percpu_counter s_freeinodes_counter; struct percpu_counter s_dirs_counter; diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 64f3a6a..e24dec2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -824,7 +824,7 @@ static void ext4_put_super(struct super_block *sb) EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); es->s_state = cpu_to_le16(sbi->s_mount_state); } - if (sb->s_dirt || !(sb->s_flags & MS_RDONLY)) + if (sbi->s_dirty || !(sb->s_flags & MS_RDONLY)) ext4_commit_super(sb, 1); if (sbi->s_proc) { @@ -4140,7 +4140,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) if (!sbh || block_device_ejected(sb)) return error; - sb->s_dirt = 0; + sbi->s_dirty = 0; /* * Make sure we first mark the superblock as clean and then start * writing it out. @@ -4225,7 +4225,7 @@ static void write_super(struct work_struct *work) kfree(sbwork); smp_rmb(); - if (!sb->s_dirt) + if (!EXT4_SB(sb)->s_dirty) return; lock_super(sb); @@ -4241,9 +4241,9 @@ void __ext4_mark_super_dirty(struct super_block *sb) /* Make sure we see 's_dirt' changes ASAP */ smp_rmb(); - if (sb->s_dirt == 1) + if (sbi->s_dirty == 1) return; - sb->s_dirt = 1; + sbi->s_dirty = 1; /* Make other CPUs see the 's_dirt' change as soon as possible */ smp_wmb(); @@ -4254,7 +4254,7 @@ void __ext4_mark_super_dirty(struct super_block *sb) * trouble anyway, and the SB will be written out on unmount or * we may be luckier next time it is marked as dirty. */ - sb->s_dirt = 2; + sbi->s_dirty = 2; return; }