[PVFS2-CVS]
commit by slang in pvfs2/src/common/misc: msgpairarray.h
msgpairarray.sm pvfs2-debug.c state-machine-fns.h state-machine.h
CVS commit program
cvs at parl.clemson.edu
Fri Nov 4 02:14:14 EST 2005
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb:/tmp/cvs-serv6522/src/common/misc
Modified Files:
Tag: slang-sio-branch
msgpairarray.h msgpairarray.sm pvfs2-debug.c
state-machine-fns.h state-machine.h
Log Message:
small I/O changes in sio branch for now
Index: msgpairarray.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.h,v
diff -p -u -r1.10 -r1.10.16.1
--- msgpairarray.h 28 Mar 2005 18:32:02 -0000 1.10
+++ msgpairarray.h 4 Nov 2005 07:14:13 -0000 1.10.16.1
@@ -42,9 +42,6 @@ typedef struct PINT_sm_msgpair_state_s
/* don't use this -- internal msgpairarray use only */
int retry_count;
- /* comp_fn called after successful reception and decode of
- * respone, if the msgpair state machine is used for processing.
- */
int (* comp_fn)(void *sm_p, struct PVFS_server_resp *resp_p, int i);
/* server address */
@@ -94,6 +91,12 @@ typedef struct PINT_sm_msgpair_params_s
/* helper functions */
+
+int PINT_msgpairarray_init(
+ PINT_sm_msgpair_state ** msgpairarray,
+ int count);
+
+void PINT_msgpairarray_destroy(PINT_sm_msgpair_state * msgpairarray);
int PINT_serv_decode_resp(
PVFS_fs_id fs_id,
Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.29 -r1.29.6.1
--- msgpairarray.sm 13 Jul 2005 15:45:53 -0000 1.29
+++ msgpairarray.sm 4 Nov 2005 07:14:14 -0000 1.29.6.1
@@ -510,6 +510,8 @@ static int msgpairarray_completion_fn(PA
if (msg_p->op_status != 0)
{
+ PVFS_perror_gossip("msgpair failed, will retry:", msg_p->op_status);
+
++need_retry;
continue;
}
@@ -642,6 +644,29 @@ static int msgpairarray_completion_fn(PA
/*********************************************************************
* helper functions used in conjunction with state machine defined above
*/
+
+int PINT_msgpairarray_init(
+ PINT_sm_msgpair_state ** msgpairarray,
+ int count)
+{
+ *msgpairarray = (PINT_sm_msgpair_state *)malloc(
+ count * sizeof(PINT_sm_msgpair_state));
+ if(!*msgpairarray)
+ {
+ return -PVFS_ENOMEM;
+ }
+ memset(*msgpairarray, 0, (count * sizeof(PINT_sm_msgpair_state)));
+
+ return 0;
+}
+
+/* we pass in a pointer to the array so that we can set it to NULL */
+void PINT_msgpairarray_destroy(
+ PINT_sm_msgpair_state * msgpairarray)
+{
+ free(msgpairarray);
+}
+
int PINT_serv_decode_resp(PVFS_fs_id fs_id,
void *encoded_resp_p,
struct PINT_decoded_msg *decoded_resp_p,
Index: pvfs2-debug.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-debug.c,v
diff -p -u -r1.33 -r1.33.2.1
--- pvfs2-debug.c 27 Oct 2005 18:43:08 -0000 1.33
+++ pvfs2-debug.c 4 Nov 2005 07:14:14 -0000 1.33.2.1
@@ -72,6 +72,7 @@ static __keyword_mask_t s_keyword_mask_m
{ "access", GOSSIP_ACCESS_DEBUG },
{ "access_detail", GOSSIP_ACCESS_DETAIL_DEBUG },
{ "listeattr", GOSSIP_LISTEATTR_DEBUG },
+ { "sm", GOSSIP_STATE_MACHINE_DEBUG },
{ "verbose", (__DEBUG_ALL & ~GOSSIP_REQ_SCHED_DEBUG)},
{ "none", GOSSIP_NO_DEBUG },
{ "all", __DEBUG_ALL }
Index: state-machine-fns.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/state-machine-fns.h,v
diff -p -u -r1.17 -r1.17.2.1
--- state-machine-fns.h 25 Oct 2005 18:00:57 -0000 1.17
+++ state-machine-fns.h 4 Nov 2005 07:14:14 -0000 1.17.2.1
@@ -10,6 +10,7 @@
#include <assert.h>
#include "gossip.h"
+#include "pvfs2-debug.h"
/* STATE-MACHINE-FNS.H
*
@@ -112,6 +113,7 @@ static inline int PINT_state_machine_nex
} while (loc->flag == SM_RETURN);
s->current_state = loc->next_state;
+ s->current_state += 2;
/* To do nested states, we check to see if the next state is
@@ -127,6 +129,7 @@ static inline int PINT_state_machine_nex
* cross-structure dependency that I couldn't handle any more. -- Rob
*/
s->current_state = ((struct PINT_state_machine_s *) s->current_state->nested_machine)->state_machine;
+ s->current_state += 2;
}
/* skip over the flag so that we point to the function for the next
@@ -134,12 +137,40 @@ static inline int PINT_state_machine_nex
*/
s->current_state += 1;
+ gossip_debug(GOSSIP_STATE_MACHINE_DEBUG, "[SM Entering]: %s:%s\n",
+ /* skip pvfs2_ */
+ ((s->current_state - 2)->parent_machine->name + 6),
+ (s->current_state - 3)->state_name);
+
retval = (s->current_state->state_action)(s,r);
+ gossip_debug(GOSSIP_STATE_MACHINE_DEBUG, "[SM Exiting]: %s:%s\n",
+ /* skip pvfs2_ */
+ ((s->current_state - 2)->parent_machine->name + 6),
+ (s->current_state - 3)->state_name);
+
/* return to the while loop in pvfs2-server.c */
return retval;
}
+static inline int PINT_state_machine_invoke(
+ struct PINT_OP_STATE *s, job_status_s *r)
+{
+ int retval;
+ gossip_debug(GOSSIP_STATE_MACHINE_DEBUG, "[SM Entering]: %s:%s\n",
+ /* skip pvfs2_ */
+ ((s->current_state - 2)->parent_machine->name + 6),
+ (s->current_state - 3)->state_name);
+
+ retval = (s->current_state->state_action)(s,r);
+
+ gossip_debug(GOSSIP_STATE_MACHINE_DEBUG, "[SM Exiting]: %s:%s\n",
+ /* skip pvfs2_ */
+ ((s->current_state - 2)->parent_machine->name + 6),
+ (s->current_state - 3)->state_name);
+ return retval;
+}
+
/* Function: PINT_state_machine_locate(void)
Params:
Returns: Pointer to the start of the state machine indicated by
@@ -160,6 +191,7 @@ static union PINT_state_array_values *PI
if (PINT_OP_STATE_GET_MACHINE(s_op->op) != NULL)
{
current_tmp = PINT_OP_STATE_GET_MACHINE(s_op->op)->state_machine;
+ current_tmp += 2;
/* handle the case in which the first state points to a nested
* machine, rather than a simple function
*/
@@ -167,7 +199,9 @@ static union PINT_state_array_values *PI
{
PINT_push_state(s_op, current_tmp);
current_tmp += 1;
- current_tmp = ((struct PINT_state_machine_s *)current_tmp->nested_machine)->state_machine;
+ current_tmp = ((struct PINT_state_machine_s *)
+ current_tmp->nested_machine)->state_machine;
+ current_tmp += 2;
}
/* this returns a pointer to a "PINT_state_array_values"
Index: state-machine.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/state-machine.h,v
diff -p -u -r1.10 -r1.10.18.1
--- state-machine.h 28 Jul 2004 14:32:37 -0000 1.10
+++ state-machine.h 4 Nov 2005 07:14:14 -0000 1.10.18.1
@@ -45,6 +45,8 @@
union PINT_state_array_values
{
+ char *state_name;
+ struct PINT_state_machine_s *parent_machine;
int (*state_action)(struct PINT_OP_STATE *, job_status_s *);
int return_value;
int flag;
More information about the PVFS2-CVS
mailing list