diff mbox

[32/37] libext2fs: Extend inode checksum to cover the EA block

Message ID 20110901003836.1176.13428.stgit@elm3c44.beaverton.ibm.com
State Superseded, archived
Headers show

Commit Message

Darrick J. Wong Sept. 1, 2011, 12:38 a.m. UTC
Now that e2fsprogs knows to read the entire s_inode_size, change the inode
checksum code to checksum the entire block.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
---
 lib/ext2fs/csum.c |    8 +-------
 1 files changed, 1 insertions(+), 7 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

Comments

Theodore Ts'o Sept. 14, 2011, 4:48 p.m. UTC | #1
On Wed, Aug 31, 2011 at 05:38:36PM -0700, Darrick J. Wong wrote:
> Now that e2fsprogs knows to read the entire s_inode_size, change the inode
> checksum code to checksum the entire block.
> 
> Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>

This should get folded into whatever patch actually starts
checksumming the inode.  There's no point keeping it separate.  Also
note that changes like this are problematic as we bisect the tree,
since the meaning of the fields change as we progess through time.
Although from a development perspective this may be the order in which
you did things, from a patch review perspective it's better if you
collapse functional changes together, especially when it relates to
"this is how we calculate this field in the
inode/superblock/whatever".

					- Ted
--
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 mbox

Patch

diff --git a/lib/ext2fs/csum.c b/lib/ext2fs/csum.c
index 4fe4b3d..dc87de3 100644
--- a/lib/ext2fs/csum.c
+++ b/lib/ext2fs/csum.c
@@ -478,14 +478,9 @@  __u32 ext2fs_inode_csum(ext2_filsys fs, ext2_ino_t inum,
 {
 	struct ext2_inode_large *desc = inode;
 	int offset = offsetof(struct ext2_inode_large, i_checksum);
-	int extra_size = inode->i_extra_isize;
 	size_t size = fs->super->s_inode_size;
 	__u32 crc = 0;
 
-	if (size < EXT2_GOOD_OLD_INODE_SIZE + extra_size)
-		printf("ERROR: inode %d size %d != extra_size %d!\n", inum,
-		       size, extra_size + EXT2_GOOD_OLD_INODE_SIZE);
-
 	if (fs->super->s_creator_os != EXT2_OS_LINUX)
 		return 0;
 
@@ -508,8 +503,7 @@  __u32 ext2fs_inode_csum(ext2_filsys fs, ext2_ino_t inum,
 	crc = crc32c_le(crc, (char *)&inum, sizeof(inum));
 	crc = crc32c_le(crc, (char *)desc, offset);
 	offset += sizeof(inode->i_checksum); /* skip checksum */
-	crc = crc32c_le(crc, (char *)desc + offset,
-			   EXT2_GOOD_OLD_INODE_SIZE + extra_size - offset);
+	crc = crc32c_le(crc, (char *)desc + offset, size - offset);
 	return crc;
 }