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

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 28 16:07:50 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-06-24 18:00:06 -0500 (Fri, 24 Jun 2005)
New Revision: 2429

Modified:
   trunk/fs/ocfs2/cluster/heartbeat.c
Log:
* Give heartbeat the ability to explicitly signal to other nodes that it's  
  going away on a region. This should avoid long waits for node down events 
  on other nodes during a clean shutdown.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-06-24 21:56:03 UTC (rev 2428)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-06-24 23:00:06 UTC (rev 2429)
@@ -421,7 +421,8 @@
 	return ret;
 }
 
-static inline void o2hb_prepare_block(struct o2hb_region *reg)
+static inline void o2hb_prepare_block(struct o2hb_region *reg,
+				      u64 generation)
 {
 	int node_num;
 	u64 cputime;
@@ -440,13 +441,13 @@
 
 	hb_block->hb_seq = cpu_to_le64(cputime);
 	hb_block->hb_node = node_num;
-	hb_block->hb_generation = cpu_to_le64(o2hb_generation);
+	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);
 
 	mlog(ML_HB_BIO, "our node generation = 0x%"MLFx64", cksum = 0x%x\n",
-	     cpu_to_le64(o2hb_generation), le32_to_cpu(hb_block->hb_cksum));
+	     cpu_to_le64(generation), le32_to_cpu(hb_block->hb_cksum));
 }
 
 static void o2hb_fire_callbacks(struct o2hb_callback *hbcall,
@@ -747,7 +748,7 @@
 		     "in our slot!\n", reg->hr_dev_name);
 
 	/* fill in the proper info for our next heartbeat */
-	o2hb_prepare_block(reg);
+	o2hb_prepare_block(reg, o2hb_generation);
 
 	/* And fire off the write. Note that we don't wait on this I/O
 	 * until later. */
@@ -785,8 +786,10 @@
  */
 static int o2hb_thread(void *data)
 {
+	int i, ret;
 	struct o2hb_region *reg = data;
-	int i;
+	struct bio *write_bio;
+	struct o2hb_bio_wait_ctxt write_wc;
 
 	mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread running\n");
 
@@ -802,6 +805,21 @@
 	for(i = 0; !reg->hr_unclean_stop && i < reg->hr_blocks; i++)
 		o2hb_shutdown_slot(&reg->hr_slots[i]);
 
+	/* Explicit down notification - avoid forcing the other nodes
+	 * to timeout on this region when we could just as easily
+	 * write a clear generation - thus indicating to them that
+	 * this node has left this region. 
+	 * 
+	 * XXX: Should we skip this on unclean_stop? */
+	o2hb_prepare_block(reg, 0);
+	ret = o2hb_issue_node_write(reg, &write_bio, &write_wc);
+	if (ret == 0) {
+		o2hb_wait_on_io(reg, &write_wc);
+		bio_put(write_bio);
+	} else {
+		mlog_errno(ret);
+	}
+
 	mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread exiting\n");
 
 	return 0;



More information about the Ocfs2-commits mailing list