From mboxrd@z Thu Jan 1 00:00:00 1970 From: teigland@sourceware.org Date: 30 Nov 2006 19:49:37 -0000 Subject: [Cluster-devel] cluster/group/gfs_controld cpg.c Message-ID: <20061130194937.30505.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL5 Changes by: teigland at sourceware.org 2006-11-30 19:49:36 Modified files: group/gfs_controld: cpg.c Log message: From: Steven Dake We dispatch in the dispatch handler now instead of saving the data. Also we use dispatch all which will basically try to dispatch all messages possible in one go instead of only dispatching on each loop through poll. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.1&r2=1.9.2.2 --- cluster/group/gfs_controld/cpg.c 2006/11/20 21:10:28 1.9.2.1 +++ cluster/group/gfs_controld/cpg.c 2006/11/30 19:49:36 1.9.2.2 @@ -15,10 +15,6 @@ static cpg_handle_t daemon_handle; static struct cpg_name daemon_name; -static int got_msg; -static int saved_nodeid; -static int saved_len; -static char saved_data[MAX_MSGLEN]; int message_flow_control_on; void receive_journals(struct mountgroup *mg, char *buf, int len, int from); @@ -113,10 +109,7 @@ void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name, uint32_t nodeid, uint32_t pid, void *data, int data_len) { - saved_nodeid = nodeid; - saved_len = data_len; - memcpy(saved_data, data, data_len); - got_msg = 1; + do_deliver(nodeid, data, data_len); } void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, @@ -143,11 +136,14 @@ } if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) { + if (message_flow_control_on == 0) { + log_debug("flow control on"); + } message_flow_control_on = 1; - log_debug("flow control on"); } else { - if (message_flow_control_on) + if (message_flow_control_on) { log_debug("flow control off"); + } message_flow_control_on = 0; } } @@ -156,20 +152,12 @@ { cpg_error_t error; - got_msg = 0; - saved_len = 0; - saved_nodeid = 0; - memset(saved_data, 0, sizeof(saved_data)); - - error = cpg_dispatch(daemon_handle, CPG_DISPATCH_ONE); + error = cpg_dispatch(daemon_handle, CPG_DISPATCH_ALL); if (error != CPG_OK) { log_error("cpg_dispatch error %d", error); return -1; } - if (got_msg) - do_deliver(saved_nodeid, saved_data, saved_len); - update_flow_control_status(); return 0;