[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111205163329.GC32031@thunk.org>
Date: Mon, 5 Dec 2011 11:33:29 -0500
From: Ted Ts'o <tytso@....edu>
To: "Darrick J. Wong" <djwong@...ibm.com>
Cc: Andreas Dilger <adilger.kernel@...ger.ca>,
Sunil Mushran <sunil.mushran@...cle.com>,
Martin K Petersen <martin.petersen@...cle.com>,
Greg Freemyer <greg.freemyer@...il.com>,
Amir Goldstein <amir73il@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andi Kleen <andi@...stfloor.org>,
Mingming Cao <cmm@...ibm.com>,
Joel Becker <jlbec@...lplan.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-ext4@...r.kernel.org, Coly Li <colyli@...il.com>
Subject: Re: [PATCH 07/22] ext4: Create bitmap checksum helper functions
On Mon, Nov 28, 2011 at 03:27:03PM -0800, Darrick J. Wong wrote:
> +static __u32 ext4_bitmap_csum(struct super_block *sb, ext4_group_t group,
> + struct buffer_head *bh, int sz)
> +{
> + __u32 csum;
> + struct ext4_sb_info *sbi = EXT4_SB(sb);
> +
> + group = cpu_to_le32(group);
> + csum = ext4_chksum(sbi, sbi->s_uuid_csum, (__u8 *)&group,
> + sizeof(group));
> + csum = ext4_chksum(sbi, csum, (__u8 *)bh->b_data, sz);
> +
> + return csum;
> +}
Note: it's strictly speaking not necessary to mix in the group and
s_csum_seed here. It's useful for the inode table blocks (ITB's)
because the checksum for a particular ITB is located *in* the ITB
itself. So if an ITB gets written to the wrong place, and in
particular, on top of another ITB, we want to be able to know which
cloned copy was written to the wrong place on disk.
But in the case of the inode and block allocation bitmaps, the
checksums are stored in the block group descriptors; so if the bitmap
is written to the wrong place (and on top of another bitmap), the
checksum will fail to verify, independent of whether we've mixed in
the fs-specific csum seed and the group number.
So I'd suggest dropping this, which will shave a few cycles off of the
checksum calculation, and it will also simplify the code since we
won't need this particular function.
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists