From: Tao Ma <tm@tao.ma>
To: linux-ext4@vger.kernel.org
Cc: "Darrick J. Wong" <djwong@us.ibm.com>, "Theodore Ts'o" <tytso@mit.edu>
Subject: [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation.
Date: Sun, 24 Jun 2012 22:22:36 +0800 [thread overview]
Message-ID: <1340547756-2932-1-git-send-email-tm@tao.ma> (raw)
From: Tao Ma <boyu.mt@taobao.com>
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 <djwong@us.ibm.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
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;
--
1.7.1
next reply other threads:[~2012-06-24 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-24 14:22 Tao Ma [this message]
2012-07-03 16:58 ` [PATCH] e2fsprogs/csum: Use fs.csum_seed for xattr block csum calculation Darrick J. Wong
2012-07-04 1:44 ` Tao Ma
2012-07-04 3:03 ` Darrick J. Wong
2012-09-03 3:15 ` Tao Ma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340547756-2932-1-git-send-email-tm@tao.ma \
--to=tm@tao.ma \
--cc=djwong@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).