From: "Darrick J. Wong" Subject: [PATCH 29/47] tune2fs: Rewrite extended attribute block checksums Date: Sat, 08 Oct 2011 00:36:20 -0700 Message-ID: <20111008073620.17888.50060.stgit@elm3c44.beaverton.ibm.com> References: <20111008073315.17888.22132.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 e36.co.us.ibm.com ([32.97.110.154]:57102 "EHLO e36.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750873Ab1JHHjN (ORCPT ); Sat, 8 Oct 2011 03:39:13 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e36.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p987WL8A013108 for ; Sat, 8 Oct 2011 01:32:21 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p987aMOv165862 for ; Sat, 8 Oct 2011 01:36:22 -0600 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 p987aLHg009917 for ; Sat, 8 Oct 2011 01:36:22 -0600 In-Reply-To: <20111008073315.17888.22132.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 5e3db9d..b2c9e32 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(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); }