[Pvfs2-developers] Fwd: [Pvfs2-cvs] commit by walt in pvfs2-1/src/common/misc: module.mk.in msgpairarray.sm state-machine.h

Sam Lang slang at mcs.anl.gov
Wed Jul 19 11:51:05 EDT 2006


Hi Walt,

I like the state machine debug mode that shows the status and error  
code.  That makes debugging errors quite a bit easier.  This might be  
feature creep, but I guess the next step is to print the name of the  
state or error code instead of the number.  Is that easy to change in  
the statecomp code?  I know all the status codes are defined in  
the .sm, but I'm not sure if the parser keeps track of them.  It  
would be one more thing to add to the union as well :-).

-sam

Begin forwarded message:

> From: CVS commit program <cvs at parl.clemson.edu>
> Date: July 16, 2006 4:42:58 PM CDT
> To: pvfs2-cvs at beowulf-underground.org
> Subject: [Pvfs2-cvs] commit by walt in pvfs2-1/src/common/misc:  
> module.mk.in msgpairarray.sm state-machine.h
> Reply-To: pvfs2-internal at beowulf-underground.org
>
> Update of /projects/cvsroot/pvfs2-1/src/common/misc
> In directory parlweb1:/tmp/cvs-serv4099/src/common/misc
>
> Modified Files:
>       Tag: WALT3
> 	module.mk.in msgpairarray.sm state-machine.h
> Log Message:
> Everything compiles.   Crap!  Now I have to see if it runs!!!
>
>
> Index: module.mk.in
> ===================================================================
> RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/module.mk.in,v
> diff -p -u -r1.26.10.1 -r1.26.10.2
> --- module.mk.in	12 Jul 2006 20:17:48 -0000	1.26.10.1
> +++ module.mk.in	16 Jul 2006 21:42:57 -0000	1.26.10.2
> @@ -11,8 +11,8 @@ LIBSRC += $(DIR)/server-config.c \
>  	  $(DIR)/pint-perf-counter.c \
>  	  $(DIR)/pint-event.c \
>  	  $(DIR)/pint-cached-config.c \
> -	  $(DIR)/msgpairarray.c \
>  	  $(DIR)/pint-util.c \
> +	  $(DIR)/msgpairarray.c \
>  	  $(DIR)/realpath.c \
>  	  $(DIR)/tcache.c \
>  	  $(DIR)/state-machine-fns.c
> @@ -26,7 +26,6 @@ SERVERSRC += $(DIR)/server-config.c \
>  	     $(DIR)/pint-perf-counter.c \
>  	     $(DIR)/pint-event.c \
>  	     $(DIR)/pint-cached-config.c \
> -	     $(DIR)/msgpairarray.c \
>  	     $(DIR)/pint-util.c \
>  	     $(DIR)/tcache.c \
>  		  $(DIR)/state-machine-fns.c
>
> Index: msgpairarray.sm
> ===================================================================
> RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/msgpairarray.sm,v
> diff -p -u -r1.35 -r1.35.4.1
> --- msgpairarray.sm	30 May 2006 22:34:06 -0000	1.35
> +++ msgpairarray.sm	16 Jul 2006 21:42:57 -0000	1.35.4.1
> @@ -51,16 +51,16 @@ enum
>      MSGPAIRS_RETRY = 191
>  };
>
> -static int msgpairarray_init(
> -    PARENT_SM *sm_p, job_status_s *js_p);
> -static int msgpairarray_post(
> -    PARENT_SM *sm_p, job_status_s *js_p);
> -static int msgpairarray_post_retry(
> -    PARENT_SM *sm_p, job_status_s *js_p);
> -static int msgpairarray_complete(
> -    PARENT_SM *sm_p, job_status_s *js_p);
> -static int msgpairarray_completion_fn(
> -    PARENT_SM *sm_p, job_status_s *js_p);
> +static PINT_sm_action  msgpairarray_init(
> +        struct PINT_smcb *smcp, job_status_s *js_p);
> +static PINT_sm_action  msgpairarray_post(
> +        struct PINT_smcb *smcp, job_status_s *js_p);
> +static PINT_sm_action  msgpairarray_post_retry(
> +        struct PINT_smcb *smcp, job_status_s *js_p);
> +static PINT_sm_action  msgpairarray_complete(
> +        struct PINT_smcb *smcp, job_status_s *js_p);
> +static PINT_sm_action  msgpairarray_completion_fn(
> +        struct PINT_smcb *smcp, job_status_s *js_p);
>
>  %%
>
> @@ -107,14 +107,15 @@ nested machine pvfs2_msgpairarray_sm(
>
>  %%
>
> -static int msgpairarray_init(PARENT_SM *sm_p,
> -                             job_status_s *js_p)
> +static PINT_sm_action msgpairarray_init(
> +        struct PINT_smcb *smcb, job_status_s *js_p)
>  {
> +    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb,  
> PINT_FRAME_CURRENT);
>      int i = 0;
>      PINT_sm_msgpair_state *msg_p = NULL;
>
>      gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state:  
> init "
> -                 "(%d msgpair(s))\n", sm_p, sm_p->msgarray_count);
> +                 "(%d msgpair(s))\n", smcb, sm_p->msgarray_count);
>
>      assert(sm_p->msgarray_count > 0);
>
> @@ -135,7 +136,7 @@ static int msgpairarray_init(PARENT_SM *
>          msg_p->retry_count = 0;
>          msg_p->complete = 0;
>      }
> -    return 1;
> +    return SM_ACTION_COMPLETE;
>  }
>
>  /* msgpairarray_post()
> @@ -156,9 +157,10 @@ static int msgpairarray_init(PARENT_SM *
>   * (7) stores job ids for later matching
>   *
>   */
> -static int msgpairarray_post(PARENT_SM *sm_p,
> -                             job_status_s *js_p)
> +static PINT_sm_action msgpairarray_post(
> +        struct PINT_smcb *smcb, job_status_s *js_p)
>  {
> +    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb,  
> PINT_FRAME_CURRENT);
>      int ret = -PVFS_EINVAL, i = 0, tmp = 0;
>      struct server_configuration_s *server_config = NULL;
>      PVFS_msg_tag_t session_tag;
> @@ -170,7 +172,7 @@ static int msgpairarray_post(PARENT_SM *
>
>      gossip_debug(
>          GOSSIP_MSGPAIR_DEBUG, "%s: sm %p "
> -        "%d total message(s) with %d incomplete\n", __func__, sm_p,
> +        "%d total message(s) with %d incomplete\n", __func__, smcb,
>          sm_p->msgarray_count * 2, num_incomplete_msgpairs * 2);
>
>      js_p->error_code = 0;
> @@ -244,7 +246,7 @@ static int msgpairarray_post(PARENT_SM *
>                  }
>                  gossip_lerr("msgpairarray_post: PINT_encode failed 
> \n");
>                  js_p->error_code = ret;
> -                return 1;
> +                return SM_ACTION_COMPLETE;
>              }
>
>              /* calculate max response msg size and allocate space */
> @@ -257,7 +259,7 @@ static int msgpairarray_post(PARENT_SM *
>              if (msg_p->encoded_resp_p == NULL)
>              {
>                  js_p->error_code = -PVFS_ENOMEM;
> -                return 1;
> +                return SM_ACTION_COMPLETE;
>              }
>              local_enc_and_alloc = 1;
>          }
> @@ -265,7 +267,7 @@ static int msgpairarray_post(PARENT_SM *
>          session_tag = PINT_util_get_next_tag();
>
>          gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d: "
> -                     "posting recv\n", __func__, sm_p, i);
> +                     "posting recv\n", __func__, smcb, i);
>
>          /* post receive of response; job_id stored in recv_id */
>          ret = job_bmi_recv(msg_p->svr_addr,
> @@ -273,7 +275,7 @@ static int msgpairarray_post(PARENT_SM *
>                             msg_p->max_resp_sz,
>                             session_tag,
>                             BMI_PRE_ALLOC,
> -                           sm_p,
> +                           smcb,
>                             i,
>                             &msg_p->recv_status,
>                             &msg_p->recv_id,
> @@ -334,7 +336,7 @@ static int msgpairarray_post(PARENT_SM *
>          assert(ret == 0);
>
>          gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d: "
> -                     "posting send\n", __func__, sm_p, i);
> +                     "posting send\n", __func__, smcb, i);
>
>          /* post send of request; job_id stored in send_id */
>          ret = job_bmi_send_list(msg_p->encoded_req.dest,
> @@ -345,7 +347,7 @@ static int msgpairarray_post(PARENT_SM *
>                                  session_tag,
>                                  msg_p->encoded_req.buffer_type,
>                                  1,
> -                                sm_p,
> +                                smcb,
>                                  sm_p->msgarray_count+i,
>                                  &msg_p->send_status,
>                                  &msg_p->send_id,
> @@ -392,35 +394,37 @@ static int msgpairarray_post(PARENT_SM *
>           * cases); jump straight to final completion function.
>           */
>           js_p->error_code = MSGPAIRS_COMPLETE;
> -         return 1;
> +         return SM_ACTION_COMPLETE;
>      }
>
>      /* we are still waiting on operations to complete, next state
>       * transition will handle them
>       */
> -    return 0;
> +    return SM_ACTION_DEFERED;
>  }
>
> -static int msgpairarray_post_retry(PARENT_SM *sm_p,
> -                                   job_status_s *js_p)
> +static PINT_sm_action msgpairarray_post_retry(
> +        struct PINT_smcb *smcb, job_status_s *js_p)
>  {
> +    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb,  
> PINT_FRAME_CURRENT);
>      job_id_t tmp_id;
>
>      gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p, wait %d ms\n",
> -      __func__, sm_p, sm_p->msgarray_params.retry_delay);
> +      __func__, smcb, sm_p->msgarray_params.retry_delay);
>
>      return job_req_sched_post_timer(
>          sm_p->msgarray_params.retry_delay,
> -        sm_p, 0, js_p, &tmp_id,
> +        smcb, 0, js_p, &tmp_id,
>          sm_p->msgarray_params.job_context);
>  }
>
> -static int msgpairarray_complete(PARENT_SM *sm_p,
> -                                 job_status_s *js_p)
> +static PINT_sm_action msgpairarray_complete(
> +        struct PINT_smcb *smcb, job_status_s *js_p)
>  {
> +    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb,  
> PINT_FRAME_CURRENT);
>      gossip_debug(GOSSIP_MSGPAIR_DEBUG,
>        "%s: sm %p status_user_tag %d msgarray_count %d\n",
> -      __func__, sm_p, (int) js_p->status_user_tag, sm_p- 
> >msgarray_count);
> +      __func__, smcb, (int) js_p->status_user_tag, sm_p- 
> >msgarray_count);
>
>
>      /* match operation with something in the msgpair array */
> @@ -471,7 +475,7 @@ static int msgpairarray_complete(PARENT_
>      /* decrement comp_ct until all operations have completed */
>      if (--sm_p->msgarray_params.comp_ct > 0)
>      {
> -        return 0;
> +        return SM_ACTION_DEFERED;
>      }
>
>      assert(sm_p->msgarray_params.comp_ct == 0);
> @@ -479,12 +483,13 @@ static int msgpairarray_complete(PARENT_
>                   "  msgpairarray: all operations complete\n");
>
>      js_p->error_code = MSGPAIRS_COMPLETE;
> -    return 1;
> +    return SM_ACTION_COMPLETE;
>  }
>
> -static int msgpairarray_completion_fn(PARENT_SM *sm_p,
> -                                      job_status_s *js_p)
> +static PINT_sm_action msgpairarray_completion_fn(
> +        struct PINT_smcb *smcb, job_status_s *js_p)
>  {
> +    struct PINT_client_sm *sm_p = PINT_sm_frame(smcb,  
> PINT_FRAME_CURRENT);
>      int ret = -PVFS_EINVAL, i = 0;
>      int need_retry = 0;
>      struct PINT_decoded_msg decoded_resp;
> @@ -498,7 +503,7 @@ static int msgpairarray_completion_fn(PA
>      js_p->error_code = 0;
>
>      gossip_debug(GOSSIP_MSGPAIR_DEBUG, "(%p) msgpairarray state: "
> -                 "completion_fn\n", sm_p);
> +                 "completion_fn\n", smcb);
>
>      for (i = 0; i < sm_p->msgarray_count; i++)
>      {
> @@ -551,7 +556,7 @@ static int msgpairarray_completion_fn(PA
>               * a per message pair basis.  Also store some non-zero
>               * (failure) value in js_p->error_code if we see one.
>               */
> -            msg_p->op_status = msg_p->comp_fn(sm_p, resp_p, i);
> +            msg_p->op_status = msg_p->comp_fn(smcb, resp_p, i);
>              if (msg_p->op_status != 0)
>              {
>                  js_p->error_code = msg_p->op_status;
> @@ -588,7 +593,7 @@ static int msgpairarray_completion_fn(PA
>          {
>              PVFS_perror_gossip("Failed to free msgpair resources",  
> ret);
>              js_p->error_code = ret;
> -            return 1;
> +            return SM_ACTION_COMPLETE;
>          }
>
>          msg_p->encoded_resp_p = NULL;
> @@ -601,7 +606,7 @@ static int msgpairarray_completion_fn(PA
>          msg_p->complete = 1;
>
>          gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d "
> -                     "marked complete\n", __func__, sm_p, i);
> +                     "marked complete\n", __func__, smcb, i);
>      }
>
>      if (need_retry) {
> @@ -665,7 +670,7 @@ static int msgpairarray_completion_fn(PA
>
>          }
>      }
> -    return 1;
> +    return SM_ACTION_COMPLETE;
>  }
>
>  / 
> *********************************************************************
>
> Index: state-machine.h
> ===================================================================
> RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/state-machine.h,v
> diff -p -u -r1.12.4.6 -r1.12.4.7
> --- state-machine.h	15 Jul 2006 17:06:07 -0000	1.12.4.6
> +++ state-machine.h	16 Jul 2006 21:42:57 -0000	1.12.4.7
> @@ -9,6 +9,7 @@
>
>  #include <state-machine-values.h>
>  #include "job.h"
> +#include "msgpairarray.h"
>
>  /* STATE-MACHINE.H
>   *
>
> _______________________________________________
> Pvfs2-cvs mailing list
> Pvfs2-cvs at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-cvs
>



More information about the Pvfs2-developers mailing list