From patchwork Wed Mar 7 00:02:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 145096 X-Patchwork-Delegate: tytso@mit.edu 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 521BBB6F98 for ; Wed, 7 Mar 2012 11:02:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031605Ab2CGACN (ORCPT ); Tue, 6 Mar 2012 19:02:13 -0500 Received: from e37.co.us.ibm.com ([32.97.110.158]:55133 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031593Ab2CGACN (ORCPT ); Tue, 6 Mar 2012 19:02:13 -0500 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Mar 2012 17:02:12 -0700 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Mar 2012 17:02:11 -0700 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id D12BDC90050 for ; Tue, 6 Mar 2012 19:02:09 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q27027oe3358960 for ; Tue, 6 Mar 2012 19:02:08 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q275WvWi017145 for ; Wed, 7 Mar 2012 00:33:00 -0500 Received: from elm3b70.beaverton.ibm.com (elm3b70.beaverton.ibm.com [9.47.67.70]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q275WuHM017025; Wed, 7 Mar 2012 00:32:56 -0500 Subject: [PATCH 39/54] mke2fs: Write new group descriptors with the appropriate checksum To: Andreas Dilger , Theodore Tso , "Darrick J. Wong" From: "Darrick J. Wong" Cc: Sunil Mushran , Amir Goldstein , Andi Kleen , Mingming Cao , Joel Becker , linux-ext4@vger.kernel.org, Coly Li Date: Tue, 06 Mar 2012 16:02:01 -0800 Message-ID: <20120307000200.11945.59962.stgit@elm3b70.beaverton.ibm.com> In-Reply-To: <20120306235720.11945.30629.stgit@elm3b70.beaverton.ibm.com> References: <20120306235720.11945.30629.stgit@elm3b70.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12030700-7408-0000-0000-00000342071C Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Update mke2fs to use the helper function to determine if group descriptors should have checksums calculated. Since metadata_csum supersedes uninit_bg, quietly drop uninit_bg if metadata_csum is set, so that older kernels don't get confused. Signed-off-by: Darrick J. Wong --- misc/mke2fs.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 92b80e9..61b332a 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -1936,6 +1936,13 @@ profile_error: if (extended_opts) parse_extended_opts(&fs_param, extended_opts); + /* Don't allow user to set both metadata_csum and uninit_bg bits. */ + if ((fs_param.s_feature_ro_compat & + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && + (fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) + fs_param.s_feature_ro_compat &= + ~EXT4_FEATURE_RO_COMPAT_GDT_CSUM; + /* Since sparse_super is the default, we would only have a problem * here if it was explicitly disabled. */ @@ -2048,7 +2055,8 @@ static int should_do_undo(const char *name) int csum_flag, force_undo; csum_flag = EXT2_HAS_RO_COMPAT_FEATURE(&fs_param, - EXT4_FEATURE_RO_COMPAT_GDT_CSUM); + EXT4_FEATURE_RO_COMPAT_GDT_CSUM | + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM); force_undo = get_int_from_profile(fs_types, "force_undo", 0); if (!force_undo && (!csum_flag || !lazy_itable_init)) return 0; @@ -2325,6 +2333,7 @@ int main (int argc, char *argv[]) (fs_param.s_feature_ro_compat & (EXT4_FEATURE_RO_COMPAT_HUGE_FILE|EXT4_FEATURE_RO_COMPAT_GDT_CSUM| EXT4_FEATURE_RO_COMPAT_DIR_NLINK| + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM| EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE))) fs->super->s_kbytes_written = 1; @@ -2472,8 +2481,7 @@ int main (int argc, char *argv[]) * inodes as unused; we want e2fsck to consider all * inodes as potentially containing recoverable data. */ - if (fs->super->s_feature_ro_compat & - EXT4_FEATURE_RO_COMPAT_GDT_CSUM) { + if (ext2fs_has_group_desc_csum(fs)) { for (i = 1; i < fs->group_desc_count; i++) ext2fs_bg_itable_unused_set(fs, i, 0); }