From patchwork Sat Oct 8 07:36:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 118454 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 DAB0DB70FF for ; Sat, 8 Oct 2011 18:39:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750994Ab1JHHjO (ORCPT ); Sat, 8 Oct 2011 03:39:14 -0400 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 Received: from elm3c44.beaverton.ibm.com ([9.47.69.44]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p987aK5H009894; Sat, 8 Oct 2011 01:36:20 -0600 Subject: [PATCH 29/47] tune2fs: Rewrite extended attribute block checksums 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, 08 Oct 2011 00:36:20 -0700 Message-ID: <20111008073620.17888.50060.stgit@elm3c44.beaverton.ibm.com> In-Reply-To: <20111008073315.17888.22132.stgit@elm3c44.beaverton.ibm.com> References: <20111008073315.17888.22132.stgit@elm3c44.beaverton.ibm.com> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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(-) -- 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/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); }