From 56906eb2f8639dc0a83c8b89fcc2b4ef3bb26ff1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 3 May 2011 15:57:34 +1000 Subject: [PATCH] FORMAT CHANGE use crc32 for cluster head rather than toy checksum Signed-off-by: NeilBrown --- lib/lafs_cluster_flush.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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); } -- 2.39.5