[Pvfs2-cvs] commit by bligon in pvfs2/src/proto: PINT-le-bytefield.c pvfs2-req-proto.h

CVS commit program cvs at parl.clemson.edu
Thu Apr 30 11:03:01 EDT 2009


Update of /projects/cvsroot/pvfs2/src/proto
In directory parlweb1:/tmp/cvs-serv320/src/proto

Modified Files:
      Tag: Orange-Branch
	PINT-le-bytefield.c pvfs2-req-proto.h 
Log Message:
Setting up Orange Branch


Index: PINT-le-bytefield.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/PINT-le-bytefield.c,v
diff -p -u -r1.58 -r1.58.10.1
--- PINT-le-bytefield.c	2 Feb 2009 18:55:43 -0000	1.58
+++ PINT-le-bytefield.c	30 Apr 2009 15:03:01 -0000	1.58.10.1
@@ -125,6 +125,14 @@ static void lebf_initialize(void)
 		/* can request a range of handles */
 		reqsize = extra_size_PVFS_servreq_create;
                 respsize = extra_size_PVFS_servresp_create;
+                break;
+            case PVFS_SERV_MIRROR:
+                 req.u.mirror.dist = &tmp_dist;
+                 reqsize = extra_size_PVFS_servreq_mirror;
+                 respsize = extra_size_PVFS_servresp_mirror;
+                 break;
+            case PVFS_SERV_IMM_COPIES:
+                 break;
 	    case PVFS_SERV_REMOVE:
 		/* nothing special, let normal encoding work */
 		break;
@@ -329,6 +337,9 @@ encode_common(struct PINT_encoded_msg *t
     /* this encoder always uses just one buffer */
     BF_ENCODE_TARGET_MSG_INIT(target_msg);
 
+    gossip_debug(GOSSIP_ENDECODE_DEBUG,"\tmaxsize:%d\tinitializing_sizes:%d\n"
+                                      ,maxsize,initializing_sizes);
+
     /* allocate the max size buffer to avoid the work of calculating it */
     buf = (initializing_sizes ? malloc(maxsize) :
            BMI_memalloc(target_msg->dest, maxsize, BMI_SEND));
@@ -366,6 +377,9 @@ static int lebf_encode_req(
     int ret = 0;
     char **p;
 
+    gossip_debug(GOSSIP_ENDECODE_DEBUG,"Executing lebf_encode_req...\n");
+    gossip_debug(GOSSIP_ENDECODE_DEBUG,"\treq->op:%d\n",req->op);
+
     ret = encode_common(target_msg, max_size_array[req->op].req);
 
     if (ret)
@@ -384,6 +398,7 @@ static int lebf_encode_req(
 	/* call standard function defined in headers */
 	CASE(PVFS_SERV_LOOKUP_PATH, lookup_path);
 	CASE(PVFS_SERV_CREATE, create);
+        CASE(PVFS_SERV_MIRROR, mirror);
         CASE(PVFS_SERV_UNSTUFF, unstuff);
 	CASE(PVFS_SERV_BATCH_CREATE, batch_create);
         CASE(PVFS_SERV_BATCH_REMOVE, batch_remove);
@@ -417,6 +432,7 @@ static int lebf_encode_req(
 	case PVFS_SERV_GETCONFIG:
         case PVFS_SERV_MGMT_NOOP:
 	case PVFS_SERV_PROTO_ERROR:
+        case PVFS_SERV_IMM_COPIES:
 	    /* nothing else */
 	    break;
 
@@ -489,6 +505,7 @@ static int lebf_encode_resp(
         CASE(PVFS_SERV_GETCONFIG, getconfig);
         CASE(PVFS_SERV_LOOKUP_PATH, lookup_path);
         CASE(PVFS_SERV_CREATE, create);
+        CASE(PVFS_SERV_MIRROR, mirror);
         CASE(PVFS_SERV_UNSTUFF, unstuff);
         CASE(PVFS_SERV_BATCH_CREATE, batch_create);
         CASE(PVFS_SERV_IO, io);
@@ -521,6 +538,7 @@ static int lebf_encode_resp(
         case PVFS_SERV_MGMT_NOOP:
         case PVFS_SERV_BATCH_REMOVE:
         case PVFS_SERV_PROTO_ERROR:
+        case PVFS_SERV_IMM_COPIES:
         case PVFS_SERV_MGMT_SETPARAM:
             /* nothing else */
             break;
@@ -588,6 +606,7 @@ static int lebf_decode_req(
 	/* call standard function defined in headers */
 	CASE(PVFS_SERV_LOOKUP_PATH, lookup_path);
 	CASE(PVFS_SERV_CREATE, create);
+        CASE(PVFS_SERV_MIRROR, mirror);
         CASE(PVFS_SERV_UNSTUFF, unstuff);
 	CASE(PVFS_SERV_BATCH_CREATE, batch_create);
         CASE(PVFS_SERV_BATCH_REMOVE, batch_remove);
@@ -620,6 +639,7 @@ static int lebf_decode_req(
 
 	case PVFS_SERV_GETCONFIG:
         case PVFS_SERV_MGMT_NOOP:
+        case PVFS_SERV_IMM_COPIES:
 	    /* nothing else */
 	    break;
 
@@ -683,6 +703,7 @@ static int lebf_decode_resp(
 	CASE(PVFS_SERV_GETCONFIG, getconfig);
 	CASE(PVFS_SERV_LOOKUP_PATH, lookup_path);
 	CASE(PVFS_SERV_CREATE, create);
+        CASE(PVFS_SERV_MIRROR, mirror);
         CASE(PVFS_SERV_UNSTUFF, unstuff);
 	CASE(PVFS_SERV_BATCH_CREATE, batch_create);
 	CASE(PVFS_SERV_IO, io);
@@ -715,6 +736,7 @@ static int lebf_decode_resp(
         case PVFS_SERV_FLUSH:
         case PVFS_SERV_MGMT_NOOP:
         case PVFS_SERV_PROTO_ERROR:
+        case PVFS_SERV_IMM_COPIES:
         case PVFS_SERV_MGMT_SETPARAM:
 	    /* nothing else */
 	    break;
@@ -797,6 +819,12 @@ static void lebf_decode_rel(struct PINT_
                 decode_free(req->u.small_io.file_req);
                 break;
 
+            case PVFS_SERV_MIRROR:
+		decode_free(req->u.mirror.dist);
+                decode_free(req->u.mirror.dst_handle);
+                decode_free(req->u.mirror.wcIndex);
+		break;
+
 	    case PVFS_SERV_MKDIR:
 		decode_free(req->u.mkdir.handle_extent_array.extent_array);
 		if (req->u.mkdir.attr.mask & PVFS_ATTR_META_DIST)
@@ -844,8 +872,9 @@ static void lebf_decode_rel(struct PINT_
             case PVFS_SERV_LISTEATTR:
             case PVFS_SERV_BATCH_REMOVE:
             case PVFS_SERV_UNSTUFF:
-		/* nothing to free */
-		break;
+            case PVFS_SERV_IMM_COPIES:
+              /*nothing to free*/
+                  break;
 	    case PVFS_SERV_INVALID:
 	    case PVFS_SERV_WRITE_COMPLETION:
 	    case PVFS_SERV_PERF_UPDATE:
@@ -931,15 +960,27 @@ static void lebf_decode_rel(struct PINT_
                             decode_free(resp->u.listattr.error);
                         if (resp->u.listattr.attr) {
                             for (i = 0; i < resp->u.listattr.nhandles; i++) {
-                                if (resp->u.listattr.attr[i].mask & PVFS_ATTR_META_DIST)
-                                    decode_free(resp->u.listattr.attr[i].u.meta.dist);
-                                if (resp->u.listattr.attr[i].mask & PVFS_ATTR_META_DFILES)
-                                    decode_free(resp->u.listattr.attr[i].u.meta.dfile_array);
+                             if (resp->u.listattr.attr[i].mask &
+                                      PVFS_ATTR_META_DIST)
+                              decode_free(resp->u.listattr.attr[i].u.meta.dist);
+                             if (resp->u.listattr.attr[i].mask &
+                                      PVFS_ATTR_META_DFILES)
+                              decode_free(
+                                 resp->u.listattr.attr[i].u.meta.dfile_array
+                              );
                             }
                             decode_free(resp->u.listattr.attr);
                         }
                         break;
                     }
+
+                case PVFS_SERV_MIRROR:
+                   {
+                      decode_free(resp->u.mirror.bytes_written);
+                      decode_free(resp->u.mirror.write_status_code);
+                      break;
+                   }
+
                 case PVFS_SERV_GETCONFIG:
                 case PVFS_SERV_REMOVE:
                 case PVFS_SERV_MGMT_REMOVE_OBJECT:
@@ -962,9 +1003,9 @@ static void lebf_decode_rel(struct PINT_
                 case PVFS_SERV_WRITE_COMPLETION:
                 case PVFS_SERV_PROTO_ERROR:
                 case PVFS_SERV_BATCH_REMOVE:
-                    /* nothing to free */
-                    break;
-
+                case PVFS_SERV_IMM_COPIES:
+                  /*nothing to free */
+                   break;
                 case PVFS_SERV_INVALID:
                 case PVFS_SERV_PERF_UPDATE:
                 case PVFS_SERV_PRECREATE_POOL_REFILLER:

Index: pvfs2-req-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/pvfs2-req-proto.h,v
diff -p -u -r1.159 -r1.159.8.1
--- pvfs2-req-proto.h	19 Feb 2009 16:19:21 -0000	1.159
+++ pvfs2-req-proto.h	30 Apr 2009 15:03:01 -0000	1.159.8.1
@@ -79,6 +79,8 @@ enum PVFS_server_op
     PVFS_SERV_BATCH_REMOVE = 36,
     PVFS_SERV_PRECREATE_POOL_REFILLER = 37, /* not a real protocol request */
     PVFS_SERV_UNSTUFF = 38,
+    PVFS_SERV_MIRROR = 39,
+    PVFS_SERV_IMM_COPIES = 40,
     /* leave this entry last */
     PVFS_SERV_NUM_OPS
 };
@@ -894,6 +896,116 @@ endecode_fields_3_struct(
 #define extra_size_PVFS_servresp_getconfig \
     (PVFS_REQ_LIMIT_CONFIG_FILE_BYTES)
 
+/* mirror ******************************************************/
+/* - copies a datahandle owned by the local server to a data-  */
+/*   handle on a remote server. There could be multiple desti- */
+/*   nation data handles. dst_count tells us how many there    */
+/*   are.                                                      */
+struct PVFS_servreq_mirror
+{
+    PVFS_handle src_handle;
+    PVFS_handle *dst_handle;
+    PVFS_fs_id  fs_id;
+    PINT_dist   *dist;
+    uint32_t    bsize;
+    uint32_t    src_server_nr;
+    uint32_t    *wcIndex;
+    uint32_t     dst_count;
+    enum PVFS_flowproto_type flow_type;
+    enum PVFS_encoding_type encoding;
+};
+
+#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
+#define encode_PVFS_servreq_mirror(pptr,x) do {      \
+   encode_PVFS_handle(pptr,&(x)->src_handle);        \
+   encode_PVFS_fs_id(pptr,&(x)->fs_id);              \
+   encode_PINT_dist(pptr,&(x)->dist);                \
+   encode_uint32_t(pptr,&(x)->bsize);                \
+   encode_uint32_t(pptr,&(x)->src_server_nr);        \
+   encode_uint32_t(pptr,&(x)->dst_count);            \
+   encode_enum(pptr,&(x)->flow_type);                \
+   encode_enum(pptr,&(x)->encoding);                 \
+   int i;                                            \
+   for (i=0; i<(x)->dst_count; i++)                  \
+   {                                                 \
+       encode_PVFS_handle(pptr,&(x)->dst_handle[i]); \
+       encode_uint32_t(pptr,&(x)->wcIndex[i]);       \
+   }                                                 \
+} while (0)
+
+#define decode_PVFS_servreq_mirror(pptr,x) do {          \
+   decode_PVFS_handle(pptr,&(x)->src_handle);            \
+   decode_PVFS_fs_id(pptr,&(x)->fs_id);                  \
+   decode_PINT_dist(pptr,&(x)->dist);                    \
+   decode_uint32_t(pptr,&(x)->bsize);                    \
+   decode_uint32_t(pptr,&(x)->src_server_nr);            \
+   decode_uint32_t(pptr,&(x)->dst_count);                \
+   decode_enum(pptr,&(x)->flow_type);                    \
+   decode_enum(pptr,&(x)->encoding);                     \
+   (x)->dst_handle = decode_malloc((x)->dst_count *      \
+                                   sizeof(PVFS_handle)); \
+   (x)->wcIndex = decode_malloc((x)->dst_count *         \
+                               sizeof(uint32_t));        \
+   int i;                                                \
+   for (i=0; i<(x)->dst_count; i++)                      \
+   {                                                     \
+       decode_PVFS_handle(pptr,&(x)->dst_handle[i]);     \
+       decode_uint32_t(pptr,&(x)->wcIndex[i]);           \
+   }                                                     \
+} while (0)
+#endif
+
+#define extra_size_PVFS_servreq_mirror \
+   ( (sizeof(PVFS_handle) * PVFS_REQ_LIMIT_HANDLES_COUNT) + \
+     (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) )
+
+/*Response to mirror request.  Identifies the number of bytes written and the */
+/*status of that write for each source-destination handle pair. (Source is    */
+/*always the same for each pair.)                                             */
+struct PVFS_servresp_mirror
+{
+    PVFS_handle src_handle;
+    uint32_t src_server_nr;
+    uint32_t *bytes_written;
+    uint32_t *write_status_code;
+    uint32_t dst_count;
+};
+
+#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
+#define encode_PVFS_servresp_mirror(pptr,x) do {         \
+   encode_PVFS_handle(pptr,&(x)->src_handle);            \
+   encode_uint32_t(pptr,&(x)->src_server_nr);            \
+   encode_uint32_t(pptr,&(x)->dst_count);                \
+   int i;                                                \
+   for (i=0; i<(x)->dst_count; i++)                      \
+   {                                                     \
+       encode_uint32_t(pptr,&(x)->bytes_written[i]);     \
+       encode_uint32_t(pptr,&(x)->write_status_code[i]); \
+   }                                                     \
+} while (0)
+
+#define decode_PVFS_servresp_mirror(pptr,x) do {            \
+  decode_PVFS_handle(pptr,&(x)->src_handle);                \
+  decode_uint32_t(pptr,&(x)->src_server_nr);                \
+  decode_uint32_t(pptr,&(x)->dst_count);                    \
+  (x)->bytes_written     = decode_malloc((x)->dst_count *   \
+                                         sizeof(uint32_t)); \
+  (x)->write_status_code = decode_malloc((x)->dst_count *   \
+                                         sizeof(uint32_t)); \
+  int i;                                                    \
+  for (i=0; i<(x)->dst_count; i++ )                         \
+  {                                                         \
+      decode_uint32_t(pptr,&(x)->bytes_written[i]);         \
+      decode_uint32_t(pptr,&(x)->write_status_code[i]);     \
+  }                                                         \
+} while (0)
+#endif
+
+#define extra_size_PVFS_servresp_mirror \
+  ( (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) + \
+    (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) )
+
+
 /* truncate ****************************************************/
 /* - resizes an existing datafile */
 
@@ -1713,6 +1825,7 @@ struct PVFS_server_req
 
     union
     {
+        struct PVFS_servreq_mirror mirror;
         struct PVFS_servreq_create create;
         struct PVFS_servreq_unstuff unstuff;
         struct PVFS_servreq_batch_create batch_create;
@@ -1775,6 +1888,7 @@ struct PVFS_server_resp
     PVFS_error status;
     union
     {
+        struct PVFS_servresp_mirror mirror;
         struct PVFS_servresp_create create;
         struct PVFS_servresp_unstuff unstuff;
         struct PVFS_servresp_batch_create batch_create;



More information about the Pvfs2-cvs mailing list