[Ocfs2-commits] mfasheh commits r2174 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Apr 25 20:58:52 CDT 2005


Author: mfasheh
Signed-off-by: jlbec
Date: 2005-04-25 20:58:50 -0500 (Mon, 25 Apr 2005)
New Revision: 2174

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
   trunk/fs/ocfs2/cluster/ocfs2_heartbeat.h
Log:
* clean out some unused stuff in ocfs2_heartbeat.h

* fix up the disk struct:
   -rename time to hb_seq
   -add hb_node
   -add hb_cksum

* stamp our local node # in the hb_node field when we update our stamp.
  hb_cksum is a placeholder for now.         
  
Signed-off-by: jlbec



Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-26 00:59:11 UTC (rev 2173)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-26 01:58:50 UTC (rev 2174)
@@ -106,7 +106,7 @@
 };
 
 struct hb_disk_slot {
-	hb_disk_heartbeat_block *ds_raw_block;
+	struct hb_disk_heartbeat_block *ds_raw_block;
 	u8			ds_node_num;
 	unsigned long		ds_last_time;
 	u16			ds_equal_samples;
@@ -398,7 +398,7 @@
 {
 	int node_num, ret;
 	struct hb_disk_slot *slot;
-	hb_disk_heartbeat_block *hb_block;
+	struct hb_disk_heartbeat_block *hb_block;
 
 	node_num = nm_this_node();
 
@@ -408,7 +408,7 @@
 	if (slot->ds_last_time) {
 		hb_block = slot->ds_raw_block;
 
-		if (le64_to_cpu(hb_block->time) != slot->ds_last_time)
+		if (le64_to_cpu(hb_block->hb_seq) != slot->ds_last_time)
 			ret = 0;
 	}
 
@@ -420,18 +420,19 @@
 	int node_num;
 	u64 cputime;
 	struct hb_disk_slot *slot;
-	hb_disk_heartbeat_block *hb_block;
+	struct hb_disk_heartbeat_block *hb_block;
 
 	node_num = nm_this_node();
 	slot = &reg->hr_slots[node_num];
 
-	hb_block = (hb_disk_heartbeat_block *) slot->ds_raw_block;
+	hb_block = (struct hb_disk_heartbeat_block *) slot->ds_raw_block;
 	memset(hb_block, 0, reg->hr_hb_block_bytes);
 	/* TODO: time stuff */
 	cputime = OCFS_CURRENT_SECONDS;
 	if (!cputime)
 		cputime = 1;
-	hb_block->time = cpu_to_le64(cputime);
+	hb_block->hb_seq = cpu_to_le64(cputime);
+	hb_block->hb_node = node_num;
 }
 
 static void hb_fire_callbacks(struct hb_callback *hbcall,
@@ -548,7 +549,7 @@
 	struct hb_node_event event = 
 		{ .hn_item = LIST_HEAD_INIT(event.hn_item), };
 	struct nm_node *node;
-	hb_disk_heartbeat_block *hb_block = slot->ds_raw_block;
+	struct hb_disk_heartbeat_block *hb_block = slot->ds_raw_block;
 	u64 cputime;
 
 	/* Is this correct? Do we assume that the node doesn't exist
@@ -559,7 +560,7 @@
 
 	/* we don't care if these wrap.. the state transitions below
 	 * clear at the right places */
-	cputime = le64_to_cpu(hb_block->time);
+	cputime = le64_to_cpu(hb_block->hb_seq);
 	if (slot->ds_last_time != cputime)
 		slot->ds_changed_samples++;
 	else
@@ -1025,7 +1026,7 @@
 			BUG_ON((j + last_slot) >= reg->hr_blocks);
 
 			slot = &reg->hr_slots[j + last_slot];
-			slot->ds_raw_block = (hb_disk_heartbeat_block *) raw;
+			slot->ds_raw_block = (struct hb_disk_heartbeat_block *) raw;
 
 			raw += reg->hr_hb_block_bytes;
 		}

Modified: trunk/fs/ocfs2/cluster/ocfs2_heartbeat.h
===================================================================
--- trunk/fs/ocfs2/cluster/ocfs2_heartbeat.h	2005-04-26 00:59:11 UTC (rev 2173)
+++ trunk/fs/ocfs2/cluster/ocfs2_heartbeat.h	2005-04-26 01:58:50 UTC (rev 2174)
@@ -3,8 +3,7 @@
  *
  * ocfs2_heartbeat.h
  *
- * Describes the interface between userspace and the kernel for the
- * ocfs2_heartbeat module.
+ * On-disk structures for ocfs2_heartbeat
  *
  * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
  *
@@ -27,11 +26,11 @@
 #ifndef _OCFS2_HEARTBEAT_H
 #define _OCFS2_HEARTBEAT_H
 
-#define CLUSTER_DISK_UUID_LEN      32      // 16 byte binary == 32 char hex string
+struct hb_disk_heartbeat_block {
+	__u64 hb_seq;
+	__u8  hb_node;
+	__u8  hb_pad1[3];
+	__u32 hb_cksum;
+};
 
-typedef struct _hb_disk_heartbeat_block
-{
-	__u64 time;
-} hb_disk_heartbeat_block;
-
 #endif /* _OCFS2_HEARTBEAT_H */



More information about the Ocfs2-commits mailing list