[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111205194539.GD7137@tux1.beaverton.ibm.com>
Date: Mon, 5 Dec 2011 11:45:39 -0800
From: "Darrick J. Wong" <djwong@...ibm.com>
To: "Ted Ts'o" <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 06/22] ext4: Calculate and verify inode checksums
On Mon, Dec 05, 2011 at 11:24:06AM -0500, Ted Ts'o wrote:
> On Mon, Nov 28, 2011 at 03:26:56PM -0800, Darrick J. Wong wrote:
> > + /* Precompute second piece of csum */
> > + if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
> > + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
> > + __u32 csum;
> > + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
> > + __le32 inum = cpu_to_le32(inode->i_ino);
> > + __le32 gen = cpu_to_le32(inode->i_generation);
> > + csum = ext4_chksum(sbi, sbi->s_uuid_csum, (__u8 *)&inum,
> > + sizeof(inum));
> > + ei->i_uuid_inum_csum = ext4_chksum(sbi, csum, (__u8 *)&gen,
> > + sizeof(gen));
> > + }
>
> Why do we include a copy of i_generation in the precomputed initial
> part of the checksum? Since i_generation is in the raw, on-disk
> version of the inode, what's the rationale for including it here? It
> shouldn't *hurt*, but it a few extra CPU cycles, and I'm not seeing
> how it helps.
i_uuid_inum_csum seeds crc32c for all the metadata objects that are attached to
an inode (extents, dir blocks, xattrs), not just the inode itself. That way
you can ensure that a piece of metadata corresponds to a specific incarnation
of an inode, not just any of the inode's incarnations since mkfs time.
--D
>
> - Ted
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists