Skip to contentSkip to conversation

cluster/cmirror/src clogd.c cluster.c cluster. ...

Cluster-devel [email protected] 1 participant 1 message Jan 23, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: jbrassow at sourceware.org 2008-01-23 21:21:06

Modified files:
cmirror/src : clogd.c cluster.c cluster.h functions.c local.c
local.h queues.c queues.h

Log message:
- better cleanup on exit
- pull rbtrees in favor of simple list until later

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/clogd.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.4&r2=1.1.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.10&r2=1.1.2.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/cluster.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/functions.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.9&r2=1.1.2.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/local.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.8&r2=1.1.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/local.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.1&r2=1.1.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/queues.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.3&r2=1.1.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror/src/queues.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.1.2.2&r2=1.1.2.3

cmirror/src/Attic/clogd.c +13 -0
@@ -30,6 +30,7 @@
 static void process_signals(void);
 static void daemonize(void);
 static void init_all(void);
+static void cleanup_all(void);
 
 int main(int argc, char *argv[])
 {
@@ -129,6 +130,7 @@
 
 	if (!r) {
 		LOG_DBG("No current cluster logs... safe to exit.");
+		cleanup_all();
 		exit(EXIT_SUCCESS);
 	}
 
@@ -247,3 +249,14 @@
 	}
 }
 
+/*
+ * cleanup_all
+ *
+ * Clean up before exiting
+ */
+static void cleanup_all(void)
+{
+	cleanup_local();
+	cleanup_cluster();
+	cleanup_queues();
+}
cmirror/src/Attic/cluster.c +12 -0
@@ -68,6 +68,9 @@
 	cpg_flow_control_state_t flow_control_state;
 	cpg_error_t error;
 	
+	/* FIXME: no flow control for now (cmirror should self regulate) */
+	return 0;
+
 	error = cpg_flow_control_state_get(handle, &flow_control_state);
 	if (error != CPG_OK) {
 		LOG_ERROR("Failed to get flow control state.  Reason: %d", error);
@@ -981,3 +984,12 @@
 	EXIT();
 	return 0;
 }
+
+void cleanup_cluster(void)
+{
+	SaAisErrorT err;
+
+	err = saCkptFinalize(ckpt_handle);
+	if (err != SA_AIS_OK)
+		LOG_ERROR("Failed to finalize checkpoint handle");
+}
cmirror/src/Attic/cluster.h +1 -0
@@ -2,6 +2,7 @@
 #define __CLUSTER_LOG_CLUSTER_DOT_H__
 
 int init_cluster(void);
+void cleanup_cluster(void);
 
 int create_cluster_cpg(char *str);
 int destroy_cluster_cpg(char *str);
cmirror/src/Attic/functions.c +38 -96

200 lines not on this page · raw message

cmirror/src/Attic/local.c +22 -1
@@ -16,6 +16,7 @@
 #include "local.h"
 
 static int cn_fd;  /* Connector (netlink) socket fd */
+static int request_array[20];  /* for request counting (debugging) */
 
 static int kernel_recv_helper(void *data, int in_size)
 {
@@ -143,7 +144,8 @@
  */
 static int do_local_work(void *data)
 {
-	int r;
+	static int request_count = 0;
+	int r, i;
 	struct clog_tfr *tfr = NULL;
 
 	ENTER();
@@ -151,6 +153,12 @@
 	if (r)
 		return r;
 
+	request_array[tfr->request_type]++;
+	request_count++;
+	if (!(request_count % 10000))
+		for (i = 0; i < 20; i++)
+			LOG_PRINT("  %s: %d", RQ_TYPE(i), request_array[i]);
+
 	LOG_DBG("Request from kernel recieved [%s/%s/%llu]",
 		RQ_TYPE(tfr->request_type), SHORT_UUID(tfr->uuid),
 		(unsigned long long)tfr->seq);
@@ -287,6 +295,8 @@
 
 	ENTER();
 
+	memset(request_array, 0, sizeof(int)*20);
+
 	cn_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
 	if (cn_fd < 0) {
 		EXIT();
@@ -321,3 +331,14 @@
 	EXIT();
 	return 0;
 }
+
+/*
+ * cleanup_local
+ *
+ * Clean up before exiting
+ */
+void cleanup_local(void)
+{
+	links_unregister(cn_fd);
+	close(cn_fd);
+}
cmirror/src/Attic/local.h +1 -0
@@ -2,6 +2,7 @@
 #define __CLUSTER_LOG_LOCAL_DOT_H__
 
 int init_local(void);
+void cleanup_local(void);
 
 int kernel_send(struct clog_tfr *tfr);
 
cmirror/src/Attic/queues.c +11 -0
@@ -123,6 +123,17 @@
 }
 
 /*
+ * cleanup_queues
+ *
+ * Clean up before exiting
+ */
+void cleanup_queues(void)
+{
+	queue_dtr(cluster_queue);
+	queue_dtr(free_queue);
+}
+
+/*
  * queue_add_tail
  * @tfr: item to add
  * @q: receiving queue
cmirror/src/Attic/queues.h +1 -0
@@ -16,6 +16,7 @@
 extern struct queue *free_queue;
 
 int init_queues(void);
+void cleanup_queues(void);
 int queue_status(void);
 void queue_add_tail(struct clog_tfr *tfr, struct queue *q);
 void queue_add(struct clog_tfr *tfr, struct queue *q);