[Pvfs2-cvs] commit by kunkel in pvfs2/src/common/misc: msgpairarray.h msgpairarray.sm pvfs2-hint.c state-machine-fns.h

CVS commit program cvs at parl.clemson.edu
Sat Aug 26 09:37:45 EDT 2006


Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv11028/src/common/misc

Modified Files:
      Tag: kunkel-branch
	msgpairarray.h msgpairarray.sm pvfs2-hint.c 
	state-machine-fns.h 
Log Message:
Migration of datafiles between different servers works. Uses msgpairray.sm,
transfers only one datafile between two servers and rewrites metadata.
Todo: Adaption of request scheduler to ensure that migration and write 
I/O do not happen concurrently on source dataserver.
Also allow users to specify command line parameter which supresses
transfer of pvfs2-hints.


Index: msgpairarray.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.h,v
diff -p -u -r1.11 -r1.11.18.1
--- msgpairarray.h	14 Dec 2005 21:50:19 -0000	1.11
+++ msgpairarray.h	26 Aug 2006 13:37:45 -0000	1.11.18.1
@@ -41,7 +41,7 @@ typedef struct PINT_sm_msgpair_state_s
 
     /* don't use this -- internal msgpairarray use only */
     int retry_count;
-
+    
     int (* comp_fn)(void *sm_p, struct PVFS_server_resp *resp_p, int i);
 
     /* server address */
@@ -51,6 +51,8 @@ typedef struct PINT_sm_msgpair_state_s
     struct PVFS_server_req req;
     struct PINT_encoded_msg encoded_req;
 
+    PVFS_msg_tag_t session_tag; /*can be prefilled to reuse the same session tag*/
+    
     /* the encoding type to use for the req */
     enum PVFS_encoding_type enc_type;
 
@@ -129,6 +131,63 @@ do {                                    
     gossip_err("***********************************************"    \
                "********************\n");                           \
 } while(0)
+
+
+#define PINT_init_msgpair(sm_p, msg_p)                         \
+do {                                                           \
+    msg_p = &sm_p->msgpair;                                    \
+    memset(msg_p, 0, sizeof(PINT_sm_msgpair_state));           \
+    if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))\
+    {                                                          \
+        free(sm_p->msgarray);                                  \
+        sm_p->msgarray = NULL;                                 \
+    }                                                          \
+    sm_p->msgarray = msg_p;                                    \
+    sm_p->msgarray_count = 1;                                  \
+} while(0)
+
+
+#define PINT_init_msgarray_params(msgarray_params_ptr, __fsid)     \
+do {                                                               \
+    PINT_sm_msgpair_params *mpp = msgarray_params_ptr;             \
+    struct server_configuration_s *server_config =                 \
+        PINT_get_server_config_struct(__fsid);                     \
+    mpp->job_context = pint_client_sm_context;                     \
+    if (server_config)                                             \
+    {                                                              \
+        mpp->job_timeout = server_config->client_job_bmi_timeout;  \
+        mpp->retry_limit = server_config->client_retry_limit;      \
+        mpp->retry_delay = server_config->client_retry_delay_ms;   \
+    }                                                              \
+    else                                                           \
+    {                                                              \
+        mpp->job_timeout = PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT;   \
+        mpp->retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT;       \
+        mpp->retry_delay = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT;    \
+    }                                                              \
+    PINT_put_server_config_struct(server_config);                  \
+} while(0)
+
+#define PINT_init_msgarray_params_server(msgarray_params_ptr)      \
+do {                                                               \
+    PINT_sm_msgpair_params *mpp = msgarray_params_ptr;             \
+    struct server_configuration_s *server_config =                 \
+        get_server_config_struct();                                \
+    mpp->job_context = server_job_context;                         \
+    if (server_config)                                             \
+    {                                                              \
+        mpp->job_timeout = server_config->client_job_bmi_timeout;  \
+        mpp->retry_limit = server_config->client_retry_limit;      \
+        mpp->retry_delay = server_config->client_retry_delay_ms;   \
+    }                                                              \
+    else                                                           \
+    {                                                              \
+        mpp->job_timeout = PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT;   \
+        mpp->retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT;       \
+        mpp->retry_delay = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT;    \
+    }                                                              \
+} while(0)
+
 
 #endif /* __MSGPAIRARRAY_H */
 

Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.35 -r1.35.6.1
--- msgpairarray.sm	30 May 2006 22:34:06 -0000	1.35
+++ msgpairarray.sm	26 Aug 2006 13:37:45 -0000	1.35.6.1
@@ -161,13 +161,13 @@ static int msgpairarray_post(PARENT_SM *
 {
     int ret = -PVFS_EINVAL, i = 0, tmp = 0;
     struct server_configuration_s *server_config = NULL;
-    PVFS_msg_tag_t session_tag;
+    PVFS_msg_tag_t * session_tag;
     PINT_sm_msgpair_state *msg_p = NULL;
     struct filesystem_configuration_s *cur_fs = NULL;
     int num_incomplete_msgpairs = (sm_p->msgarray_params.comp_ct / 2);
     int must_loop_encodings = 0;
     int local_enc_and_alloc = 0;
-
+    
     gossip_debug(
         GOSSIP_MSGPAIR_DEBUG, "%s: sm %p "
         "%d total message(s) with %d incomplete\n", __func__, sm_p,
@@ -262,16 +262,20 @@ static int msgpairarray_post(PARENT_SM *
             local_enc_and_alloc = 1;
         }
 
-        session_tag = PINT_util_get_next_tag();
+        session_tag = & msg_p->session_tag;
+        if ( *session_tag == 0)
+        {  
+            *session_tag = PINT_util_get_next_tag();
+        }
 
         gossip_debug(GOSSIP_MSGPAIR_DEBUG, "%s: sm %p msgpair %d: "
                      "posting recv\n", __func__, sm_p, i);
-
+bmi_recv:
         /* post receive of response; job_id stored in recv_id */
         ret = job_bmi_recv(msg_p->svr_addr,
                            msg_p->encoded_resp_p,
                            msg_p->max_resp_sz,
-                           session_tag,
+                           *session_tag,
                            BMI_PRE_ALLOC,
                            sm_p,
                            i,
@@ -295,7 +299,17 @@ static int msgpairarray_post(PARENT_SM *
         {
             /* it is impossible for this recv to complete at this point
              * without errors; we haven't sent the request yet!
+             * may it be in case of an retry operation that we got the 
+             *  answer in the meantime ?
              */
+            if ( msg_p->retry_flag == PVFS_MSGPAIR_RETRY && ret == 1)
+            {
+                /*
+                 * repost recv
+                 */
+                goto bmi_recv;   
+            }
+            
             assert(ret < 0 || msg_p->recv_status.error_code != 0);
             if (ret < 0)
             {
@@ -342,7 +356,7 @@ static int msgpairarray_post(PARENT_SM *
                                 msg_p->encoded_req.size_list,
                                 msg_p->encoded_req.list_count,
                                 msg_p->encoded_req.total_size,
-                                session_tag,
+                                *session_tag,
                                 msg_p->encoded_req.buffer_type,
                                 1,
                                 sm_p,

Index: pvfs2-hint.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/Attic/pvfs2-hint.c,v
diff -p -u -r1.1.2.6 -r1.1.2.7
--- pvfs2-hint.c	21 Aug 2006 18:58:07 -0000	1.1.2.6
+++ pvfs2-hint.c	26 Aug 2006 13:37:45 -0000	1.1.2.7
@@ -69,6 +69,10 @@ int PVFS_add_hint(
 /* Size: 4 for sentinel at the end, 8 + string size for each element,
  * type + length*/
 int32_t PINT_hint_calc_size(const PVFS_hint * hint){
+#ifdef NO_PVFS_HINT_SUPPORT    
+    return 0;
+#endif
+    
     int count = 4;
     PVFS_hint * act;
     for( act = (PVFS_hint *) hint ; act != NULL ; act = act->next_hint){
@@ -82,6 +86,10 @@ int32_t PINT_hint_calc_size(const PVFS_h
 
 
 int PINT_hint_encode(const PVFS_hint * hint, char * buffer, int * out_length, int max_length){
+#ifdef NO_PVFS_HINT_SUPPORT    
+    return 0;
+#endif    
+    
     PVFS_hint * act;
     char * start_buffer = buffer;
     const int32_t number_hint_types = NUMBER_HINT_TYPES;
@@ -110,6 +118,12 @@ int PINT_hint_encode(const PVFS_hint * h
  * out_hint must be NULL before running the function !
  */ 
 int PINT_hint_decode(PVFS_hint ** out_hint, const char * buffer, int * out_length){
+#ifdef NO_PVFS_HINT_SUPPORT    
+    * out_hint =  NULL;
+    * out_length = 0;
+    return 0;
+#endif    
+    
     PVFS_hint * hint = NULL;
     char * buff = (char *) buffer; 
     char * cur_hint;

Index: state-machine-fns.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/state-machine-fns.h,v
diff -p -u -r1.20 -r1.20.6.1
--- state-machine-fns.h	5 Jun 2006 19:57:26 -0000	1.20
+++ state-machine-fns.h	26 Aug 2006 13:37:45 -0000	1.20.6.1
@@ -12,6 +12,7 @@
 #include "gossip.h"
 #include "pvfs2-debug.h"
 
+
 /* STATE-MACHINE-FNS.H
  *
  * This file implements a small collection of functions used when
@@ -257,6 +258,10 @@ static inline void PINT_push_state(struc
     s->state_stack[s->stackptr++] = p;
 }
 
+
+#endif
+
+
 /*
  * Local variables:
  *  c-indent-level: 4
@@ -265,5 +270,3 @@ static inline void PINT_push_state(struc
  *
  * vim: ts=8 sts=4 sw=4 expandtab
  */
-
-#endif



More information about the Pvfs2-cvs mailing list