From patchwork Sun Jun 24 14:22:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ma X-Patchwork-Id: 166885 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 DA67FB6FA1 for ; Mon, 25 Jun 2012 00:22:52 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752557Ab2FXOWv (ORCPT ); Sun, 24 Jun 2012 10:22:51 -0400 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:50019 "HELO oproxy5-pub.bluehost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753383Ab2FXOWu (ORCPT ); Sun, 24 Jun 2012 10:22:50 -0400 Received: (qmail 12283 invoked by uid 0); 24 Jun 2012 14:22:50 -0000 Received: from unknown (HELO box585.bluehost.com) (66.147.242.185) by cpoproxy2.bluehost.com with SMTP; 24 Jun 2012 14:22:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tao.ma; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=/zIdmrV/3AQSgtZynXuw7sfsd7MWYf9frX4fBfJL81E=; b=0C+wF5pKZ8ZhZSLtF2wh6DHw9imaxGMXhBlWd1WWk+U70Wwa1FIafh/fmyTU88/TAOTfylbVEspsYkstsvqFZW4wdvNxvgHEFXyKEIeWr7SFy7o0bRqU5/YaTGBhTyPK; Received: from [114.254.67.137] (port=34115 helo=tma-laptop1.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1SiniB-0007EM-PU; Sun, 24 Jun 2012 08:22:49 -0600 From: Tao Ma To: linux-ext4@vger.kernel.org Cc: "Darrick J. Wong" , "Theodore Ts'o" Subject: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation. Date: Sun, 24 Jun 2012 22:22:36 +0800 Message-Id: <1340547756-2932-1-git-send-email-tm@tao.ma> X-Mailer: git-send-email 1.7.5.4 X-Identified-User: {1390:box585.bluehost.com:colyli:tao.ma} {sentby:smtp auth 114.254.67.137 authed with tm@tao.ma} Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Tao Ma As I mentioned in the kernel part patch with the subject "ext4: Use s_csum_seed instead of i_csum_seed for xattr block csum", it is not easy for the kernel to use the proper inode csum seed. So always use the fs.csum_seed for the xattr block csum calculation. Cc: Darrick J. Wong Cc: "Theodore Ts'o" Signed-off-by: Tao Ma Acked-by: Darrick J. Wong --- lib/ext2fs/csum.c | 18 +++--------------- 1 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c index a7096d2..5ccbc1c 100644 --- a/lib/ext2fs/csum.c +++ b/lib/ext2fs/csum.c @@ -119,21 +119,9 @@ static errcode_t ext2fs_ext_attr_block_csum(ext2_filsys fs, ext2_ino_t inum, struct ext2_inode inode; hdr->h_checksum = 0; - if (ext2fs_le32_to_cpu(hdr->h_refcount) != 1) { - block = ext2fs_cpu_to_le64(block); - *crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block, - sizeof(block)); - } else { - retval = ext2fs_read_inode(fs, inum, &inode); - if (retval) - return retval; - inum = ext2fs_cpu_to_le32(inum); - gen = ext2fs_cpu_to_le32(inode.i_generation); - *crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&inum, - sizeof(inum)); - *crc = ext2fs_crc32c_le(*crc, (unsigned char *)&gen, - sizeof(gen)); - } + block = ext2fs_cpu_to_le64(block); + *crc = ext2fs_crc32c_le(fs->csum_seed, (unsigned char *)&block, + sizeof(block)); *crc = ext2fs_crc32c_le(*crc, (unsigned char *)buf, fs->blocksize); hdr->h_checksum = old_crc;