[Ocfs2-commits] zab commits r2505 - branches/endian-safe/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Aug 11 19:22:05 CDT 2005


Author: zab
Date: 2005-08-11 19:22:04 -0500 (Thu, 11 Aug 2005)
New Revision: 2505

Modified:
   branches/endian-safe/fs/ocfs2/cluster/heartbeat.c
Log:
o the arguments and return of crc_le are cpu-endian, only the data
  bytes are little endian


Modified: branches/endian-safe/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- branches/endian-safe/fs/ocfs2/cluster/heartbeat.c	2005-08-11 20:52:40 UTC (rev 2504)
+++ branches/endian-safe/fs/ocfs2/cluster/heartbeat.c	2005-08-12 00:22:04 UTC (rev 2505)
@@ -401,10 +401,11 @@
 	return status;
 }
 
-static __le32 o2hb_compute_block_crc_le(struct o2hb_region *reg,
-				struct o2hb_disk_heartbeat_block *hb_block)
+static u32 o2hb_compute_block_crc_le(struct o2hb_region *reg,
+				     struct o2hb_disk_heartbeat_block *hb_block)
 {
-	__le32 old_cksum, ret;
+	__le32 old_cksum;
+	u32 ret;
 
 	/* We want to compute the block crc with a 0 value in the
 	 * hb_cksum field. Save it off here and replace after the
@@ -412,7 +413,6 @@
 	old_cksum = hb_block->hb_cksum;
 	hb_block->hb_cksum = 0;
 
-	/* XXX sigh, sparse warns here because crc32_le() doesn't use __le */
 	ret = crc32_le(0, (unsigned char *) hb_block, reg->hr_block_bytes);
 
 	hb_block->hb_cksum = old_cksum;
@@ -423,13 +423,12 @@
 static int o2hb_verify_crc(struct o2hb_region *reg,
 			   struct o2hb_disk_heartbeat_block *hb_block)
 {
-	__le32 computed;
-	u32 read;
+	u32 read, computed;
 
 	read = le32_to_cpu(hb_block->hb_cksum);
 	computed = o2hb_compute_block_crc_le(reg, hb_block);
 
-	return read == le32_to_cpu(computed);
+	return read == computed;
 }
 
 /* We want to make sure that nobody is heartbeating on top of us --
@@ -478,7 +477,8 @@
 	hb_block->hb_generation = cpu_to_le64(generation);
 
 	/* This step must always happen last! */
-	hb_block->hb_cksum = o2hb_compute_block_crc_le(reg, hb_block);
+	hb_block->hb_cksum = cpu_to_le32(o2hb_compute_block_crc_le(reg,
+								   hb_block));
 
 	mlog(ML_HB_BIO, "our node generation = 0x%"MLFx64", cksum = 0x%x\n",
 	     cpu_to_le64(generation), le32_to_cpu(hb_block->hb_cksum));



More information about the Ocfs2-commits mailing list