[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/gfs_controld cpg.c lock_dlm.h main.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2006-09-08 22:44:33

Modified files:
	group/gfs_controld: cpg.c lock_dlm.h main.c 

Log message:
	- minor change to the delay we add between each cpg_mcast retry
	- set scheduler to RR priority 2 for gfs_controld

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.13&r2=1.14

--- cluster/group/gfs_controld/cpg.c	2006/08/09 19:35:26	1.6
+++ cluster/group/gfs_controld/cpg.c	2006/09/08 22:44:33	1.7
@@ -183,7 +183,7 @@
 	return fd;
 }
 
-static int _send_message(cpg_handle_t h, void *buf, int len)
+static int _send_message(cpg_handle_t h, void *buf, int len, int type)
 {
 	struct iovec iov;
 	cpg_error_t error;
@@ -195,23 +195,30 @@
  retry:
 	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
 	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("cpg_mcast_joined error %d", error);
 		retries++;
-		if (retries > 3)
-			sleep(1);
+		usleep(1000);
+		if (!(retries % 100))
+			log_error("cpg_mcast_joined retry %d %s",
+				   retries, msg_name(type));
 		goto retry;
 	}
 	if (error != CPG_OK) {
-		log_error("cpg_mcast_joined error %d handle %llx", error, h);
+		log_error("cpg_mcast_joined error %d handle %llx %s",
+			  error, h, msg_name(type));
 		return -1;
 	}
 
+	if (retries)
+		log_debug("cpg_mcast_joined retried %d %s",
+			  retries, msg_name(type));
+
 	return 0;
 }
 
 int send_group_message(struct mountgroup *mg, int len, char *buf)
 {
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
+	int type = hd->type;
 
 	hd->version[0]	= cpu_to_le16(GDLM_VER_MAJOR);
 	hd->version[1]	= cpu_to_le16(GDLM_VER_MINOR);
@@ -221,6 +228,6 @@
 	hd->to_nodeid	= cpu_to_le32(hd->to_nodeid);
 	memcpy(hd->name, mg->name, strlen(mg->name));
 	
-	return _send_message(daemon_handle, buf, len);
+	return _send_message(daemon_handle, buf, len, type);
 }
 
--- cluster/group/gfs_controld/lock_dlm.h	2006/08/31 19:13:02	1.17
+++ cluster/group/gfs_controld/lock_dlm.h	2006/09/08 22:44:33	1.18
@@ -23,6 +23,7 @@
 #include <errno.h>
 #include <time.h>
 #include <syslog.h>
+#include <sched.h>
 #include <asm/types.h>
 #include <sys/socket.h>
 #include <sys/poll.h>
--- cluster/group/gfs_controld/main.c	2006/08/31 19:13:02	1.13
+++ cluster/group/gfs_controld/main.c	2006/09/08 22:44:33	1.14
@@ -594,6 +594,24 @@
 	}
 }
 
+void set_scheduler(void)
+{
+	struct sched_param sched_param;
+	int rv;
+
+	rv = sched_get_priority_max(SCHED_RR);
+	if (rv != -1) {
+		sched_param.sched_priority = 2;
+		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
+		if (rv == -1)
+			log_error("could not set SCHED_RR priority %d err %d",
+				   sched_param.sched_priority, errno);
+	} else {
+		log_error("could not get maximum scheduler priority err %d",
+			  errno);
+	}
+}
+
 int main(int argc, char **argv)
 {
 	prog_name = argv[0];
@@ -605,6 +623,8 @@
 	if (!daemon_debug_opt)
 		daemonize();
 
+	set_scheduler();
+
 	return loop();
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]