[Ocfs2-tools-commits] mfasheh commits r920 - in trunk: libo2cb libo2cb/include libocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Jun 1 20:05:15 CDT 2005


Author: mfasheh
Signed-off-by: zab
Date: 2005-06-01 20:05:13 -0500 (Wed, 01 Jun 2005)
New Revision: 920

Added:
   trunk/libo2cb/include/ocfs2_heartbeat.h
Modified:
   trunk/libo2cb/include/o2cb.h
   trunk/libo2cb/include/ocfs2_nodemanager.h
   trunk/libo2cb/o2cb_abi.c
   trunk/libocfs2/heartbeat.c
Log:
* update tools to go with the module, svn r2354

* write the timeout values to our heartbeat configfs area.

* drop the default heartbeat node death misses to 10 (20 seconds with
  default timeout).

Signed-off-by: zab



Modified: trunk/libo2cb/include/o2cb.h
===================================================================
--- trunk/libo2cb/include/o2cb.h	2005-05-30 19:04:46 UTC (rev 919)
+++ trunk/libo2cb/include/o2cb.h	2005-06-02 01:05:13 UTC (rev 920)
@@ -44,9 +44,11 @@
 #if O2CB_FLAT_INCLUDES
 #include "o2cb_err.h"
 #include "ocfs2_nodemanager.h"
+#include "ocfs2_heartbeat.h"
 #else
 #include <o2cb/o2cb_err.h>
 #include <o2cb/ocfs2_nodemanager.h>
+#include <o2cb/ocfs2_heartbeat.h>
 #endif
 
 errcode_t o2cb_init(void);
@@ -72,6 +74,8 @@
 	int		r_block_bytes;
 	uint64_t	r_start_block;
 	uint64_t	r_blocks;
+	unsigned int	r_timeout_ms;
+	unsigned int	r_node_down_misses;
 };
 
 /* Expected use case for the region descriptor is to allocate it on

Added: trunk/libo2cb/include/ocfs2_heartbeat.h
===================================================================
--- trunk/libo2cb/include/ocfs2_heartbeat.h	2005-05-30 19:04:46 UTC (rev 919)
+++ trunk/libo2cb/include/ocfs2_heartbeat.h	2005-06-02 01:05:13 UTC (rev 920)
@@ -0,0 +1,39 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * ocfs2_heartbeat.h
+ *
+ * On-disk structures for ocfs2_heartbeat
+ *
+ * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#ifndef _OCFS2_HEARTBEAT_H
+#define _OCFS2_HEARTBEAT_H
+
+struct o2hb_disk_heartbeat_block {
+	__u64 hb_seq;
+	__u8  hb_node;
+	__u8  hb_pad1[3];
+	__u32 hb_cksum;
+};
+
+#define O2HB_DEFAULT_TIMEOUT_MS		2000
+#define O2HB_DEFAULT_NODE_DOWN_MISSES	10
+
+#endif /* _OCFS2_HEARTBEAT_H */

Modified: trunk/libo2cb/include/ocfs2_nodemanager.h
===================================================================
--- trunk/libo2cb/include/ocfs2_nodemanager.h	2005-05-30 19:04:46 UTC (rev 919)
+++ trunk/libo2cb/include/ocfs2_nodemanager.h	2005-06-02 01:05:13 UTC (rev 920)
@@ -28,7 +28,7 @@
 #ifndef _OCFS2_NODEMANAGER_H
 #define _OCFS2_NODEMANAGER_H
 
-#define NM_API_VERSION		2
+#define NM_API_VERSION		3
 
 #define NM_MAX_NODES		255
 #define NM_INVALID_NODE_NUM	255

Modified: trunk/libo2cb/o2cb_abi.c
===================================================================
--- trunk/libo2cb/o2cb_abi.c	2005-05-30 19:04:46 UTC (rev 919)
+++ trunk/libo2cb/o2cb_abi.c	2005-06-02 01:05:13 UTC (rev 920)
@@ -517,7 +517,9 @@
 					      const char *device_name,
 					      int block_bytes,
 					      uint64_t start_block,
-					      uint64_t blocks)
+					      uint64_t blocks,
+					      unsigned int timeout_ms,
+					      unsigned int dead_iter)
 {
 	char _fake_cluster_name[NAME_MAX];
 	char region_path[PATH_MAX];
@@ -616,6 +618,28 @@
 	if (err)
 		goto out_rmdir;
 
+	ret = snprintf(num_buf, NAME_MAX - 1, "%u", timeout_ms);
+	if (ret <= 0 || ret == PATH_MAX - 1) {
+		err = O2CB_ET_INTERNAL_FAILURE;
+		goto out_rmdir;
+	}
+
+	err = o2cb_set_region_attribute(cluster_name, region_name,
+					"timeout_ms", num_buf);
+	if (err)
+		goto out_rmdir;
+
+	ret = snprintf(num_buf, NAME_MAX - 1, "%u", dead_iter);
+	if (ret <= 0 || ret == PATH_MAX - 1) {
+		err = O2CB_ET_INTERNAL_FAILURE;
+		goto out_rmdir;
+	}
+
+	err = o2cb_set_region_attribute(cluster_name, region_name,
+					"dead_iter", num_buf);
+	if (err)
+		goto out_rmdir;
+
 	fd = open64(device_name, O_RDWR);
 	if (fd < 0) {
 		switch (errno) {
@@ -1019,7 +1043,9 @@
 					   desc->r_device_name,
 					   desc->r_block_bytes,
 					   desc->r_start_block,
-					   desc->r_blocks);
+					   desc->r_blocks,
+					   desc->r_timeout_ms,
+					   desc->r_node_down_misses);
 	if (ret && ret != O2CB_ET_REGION_EXISTS)
 		goto up;
 

Modified: trunk/libocfs2/heartbeat.c
===================================================================
--- trunk/libocfs2/heartbeat.c	2005-05-30 19:04:46 UTC (rev 919)
+++ trunk/libocfs2/heartbeat.c	2005-06-02 01:05:13 UTC (rev 920)
@@ -88,11 +88,13 @@
 	start_block = rec->e_blkno << block_bits;
 	start_block >>= sectsize_bits;
 
-	desc->r_name = fs->uuid_str;
-	desc->r_device_name = fs->fs_devname;
-	desc->r_block_bytes = sectsize;
-	desc->r_start_block = start_block;
-	desc->r_blocks = blocks;
+	desc->r_name			= fs->uuid_str;
+	desc->r_device_name		= fs->fs_devname;
+	desc->r_block_bytes		= sectsize;
+	desc->r_start_block		= start_block;
+	desc->r_blocks			= blocks;
+	desc->r_timeout_ms		= O2HB_DEFAULT_TIMEOUT_MS;
+	desc->r_node_down_misses	= O2HB_DEFAULT_NODE_DOWN_MISSES;
 
 leave:
 	if (buf)



More information about the Ocfs2-tools-commits mailing list