From patchwork Sat Jan 7 08:33:54 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: 134790 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 6D988B6F74 for ; Sat, 7 Jan 2012 19:34:22 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754235Ab2AGIeF (ORCPT ); Sat, 7 Jan 2012 03:34:05 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:51302 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754772Ab2AGIeD (ORCPT ); Sat, 7 Jan 2012 03:34:03 -0500 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Jan 2012 03:34:02 -0500 Received: from d01relay03.pok.ibm.com (9.56.227.235) by e3.ny.us.ibm.com (192.168.1.103) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 7 Jan 2012 03:33:57 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q078XvOT285626 for ; Sat, 7 Jan 2012 03:33:57 -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 q078XtJo004804 for ; Sat, 7 Jan 2012 03:33:56 -0500 Received: from elm3c44.beaverton.ibm.com (elm3c44.beaverton.ibm.com [9.47.69.44]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q078XsoV004759; Sat, 7 Jan 2012 03:33:54 -0500 Subject: [PATCH 09/51] 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: Sat, 07 Jan 2012 00:33:54 -0800 Message-ID: <20120107083354.25788.49388.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> References: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 x-cbid: 12010708-8974-0000-0000-000004F85D31 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 f2d7c81..7888a2f 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -305,6 +305,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; @@ -350,6 +371,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) @@ -869,7 +896,7 @@ static __u32 ok_features[3] = { #ifdef CONFIG_QUOTA EXT4_FEATURE_RO_COMPAT_QUOTA| #endif - 0 + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM };