From: NeilBrown Date: Tue, 3 May 2011 05:57:34 +0000 (+1000) Subject: FORMAT CHANGE use crc32 for cluster head rather than toy checksum X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=56906eb2f8639dc0a83c8b89fcc2b4ef3bb26ff1;p=lafs-utils.git FORMAT CHANGE use crc32 for cluster head rather than toy checksum Signed-off-by: NeilBrown --- diff --git a/lib/lafs_cluster_flush.c b/lib/lafs_cluster_flush.c index 63d34f0..ac31718 100644 --- a/lib/lafs_cluster_flush.c +++ b/lib/lafs_cluster_flush.c @@ -224,15 +224,10 @@ static void cluster_incdesc(struct lafs_cluster *wc, struct descriptor *desc_sta int lafs_calc_cluster_csum(struct cluster_head *head) { unsigned int oldcsum = head->checksum; - unsigned long long newcsum = 0; unsigned long csum; - int i; - unsigned int *superc = (unsigned int *) head; - head->checksum = 0; - for (i = 0; i < __le16_to_cpu(head->Hlength)/4; i++) - newcsum += __le32_to_cpu(superc[i]); - csum = (newcsum & 0xffffffff) + (newcsum>>32); + head->checksum = 0; + csum = crc32(0, (uint32_t *)head, __le16_to_cpu(head->Hlength)); head->checksum = oldcsum; return __cpu_to_le32(csum); }