From: "Darrick J. Wong" Subject: [PATCH 30/51] tune2fs: Rewrite extended attribute block checksums Date: Sat, 07 Jan 2012 00:36:08 -0800 Message-ID: <20120107083608.25788.1106.stgit@elm3c44.beaverton.ibm.com> References: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: Sunil Mushran , Amir Goldstein , Andi Kleen , Mingming Cao , Joel Becker , linux-ext4@vger.kernel.org, Coly Li To: Andreas Dilger , Theodore Tso , "Darrick J. Wong" Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:50855 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619Ab2AGIgY (ORCPT ); Sat, 7 Jan 2012 03:36:24 -0500 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 7 Jan 2012 01:36:23 -0700 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q078aBcs116754 for ; Sat, 7 Jan 2012 01:36:11 -0700 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q078a9tQ029506 for ; Sat, 7 Jan 2012 01:36:11 -0700 In-Reply-To: <20120107083256.25788.41238.stgit@elm3c44.beaverton.ibm.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: When enabling metadata checksums, rewrite separate extended attribute blocks. Signed-off-by: Darrick J. Wong --- misc/tune2fs.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 801e6ea..2ae436e 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -610,9 +610,11 @@ static void rewrite_inodes(ext2_filsys fs) { int length = EXT2_INODE_SIZE(fs->super); struct ext2_inode *inode; + char *ea_buf; ext2_inode_scan scan; errcode_t retval; ext2_ino_t ino; + blk64_t file_acl_block; if (fs->super->s_creator_os != EXT2_OS_LINUX) return; @@ -629,6 +631,12 @@ static void rewrite_inodes(ext2_filsys fs) exit(1); } + retval = ext2fs_get_mem(fs->blocksize, &ea_buf); + if (retval) { + com_err("set_csum", retval, "while allocating memory"); + exit(1); + } + do { retval = ext2fs_get_next_inode_full(scan, &ino, inode, length); if (retval) { @@ -659,9 +667,27 @@ static void rewrite_inodes(ext2_filsys fs) exit(1); } } + + file_acl_block = ext2fs_file_acl_block(fs, inode); + if (!file_acl_block) + continue; + retval = ext2fs_read_ext_attr3(fs, file_acl_block, ea_buf, ino); + if (retval) { + com_err("rewrite_eablock", retval, + "while rewriting extended attribute"); + exit(1); + } + retval = ext2fs_write_ext_attr3(fs, file_acl_block, ea_buf, + ino); + if (retval) { + com_err("rewrite_eablock", retval, + "while rewriting extended attribute"); + exit(1); + } } while (ino); ext2fs_free_mem(&inode); + ext2fs_free_mem(&ea_buf); ext2fs_close_inode_scan(scan); }