From patchwork Tue Mar 6 23:58:18 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: 145068 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 C4D8CB6F98 for ; Wed, 7 Mar 2012 10:58:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932709Ab2CFX63 (ORCPT ); Tue, 6 Mar 2012 18:58:29 -0500 Received: from e36.co.us.ibm.com ([32.97.110.154]:54988 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932700Ab2CFX62 (ORCPT ); Tue, 6 Mar 2012 18:58:28 -0500 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Mar 2012 16:58:28 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 6 Mar 2012 16:58:25 -0700 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 7A36D19D804A for ; Tue, 6 Mar 2012 16:58:19 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q26NwOeN083746 for ; Tue, 6 Mar 2012 16:58:24 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q26NwMSa011847 for ; Tue, 6 Mar 2012 16:58:24 -0700 Received: from elm3b70.beaverton.ibm.com (elm3b70.beaverton.ibm.com [9.47.67.70]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q26NwLK1011811; Tue, 6 Mar 2012 16:58:21 -0700 Subject: [PATCH 09/54] mke2fs: Allow metadata checksums to be turned on at mkfs time 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 15:58:18 -0800 Message-ID: <20120306235818.11945.39199.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: 12030623-3352-0000-0000-00000326097E Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Write out reserved inodes with full checksums when writing out a zeroed table. Signed-off-by: Darrick J. Wong --- misc/mke2fs.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 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 d80c0b2..28485e3 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -306,6 +306,27 @@ _("Warning: the backup superblock/group descriptors at block %u contain\n" ext2fs_badblocks_list_iterate_end(bb_iter); } +static void write_reserved_inodes(ext2_filsys fs) +{ + errcode_t retval; + ext2_ino_t ino; + struct ext2_inode *inode; + + retval = ext2fs_get_mem(EXT2_INODE_SIZE(fs->super), &inode); + if (retval) { + com_err("inode_init", retval, + "while allocating memory"); + exit(1); + } + bzero(inode, EXT2_INODE_SIZE(fs->super)); + + for (ino = 1; ino < EXT2_FIRST_INO(fs->super); ino++) + ext2fs_write_inode_full(fs, ino, inode, + EXT2_INODE_SIZE(fs->super)); + + ext2fs_free_mem(&inode); +} + static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed) { errcode_t retval; @@ -351,6 +372,12 @@ static void write_inode_tables(ext2_filsys fs, int lazy_flag, int itable_zeroed) ext2fs_zero_blocks2(0, 0, 0, 0, 0); ext2fs_numeric_progress_close(fs, &progress, _("done \n")); + + /* Reserved inodes must always have correct checksums */ + if (fs->super->s_creator_os == EXT2_OS_LINUX && + fs->super->s_feature_ro_compat & + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) + write_reserved_inodes(fs); } static void create_root_dir(ext2_filsys fs) @@ -870,7 +897,7 @@ static __u32 ok_features[3] = { #ifdef CONFIG_QUOTA EXT4_FEATURE_RO_COMPAT_QUOTA| #endif - 0 + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM };