[Pvfs2-cvs] commit by slang in pvfs2/src/client/sysint: client-state-machine.c sys-getattr.sm sys-lookup.sm

CVS commit program cvs at parl.clemson.edu
Thu Nov 9 19:51:47 EST 2006


Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv27390/src/client/sysint

Modified Files:
      Tag: WALT3
	client-state-machine.c sys-getattr.sm sys-lookup.sm 
Log Message:
removed state-machine-fns.h since its no longer in use.

fixed getattr and lookup isys calls to handle immediate completion cases (ncache and acache).

fixed up the state machine code to do better type checking of return codes
and handle termination properly from client_state_machine_post.


Index: client-state-machine.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/client-state-machine.c,v
diff -p -u -r1.79.4.19 -r1.79.4.20
--- client-state-machine.c	9 Nov 2006 15:52:49 -0000	1.79.4.19
+++ client-state-machine.c	10 Nov 2006 00:51:47 -0000	1.79.4.20
@@ -333,6 +333,9 @@ int client_state_machine_terminate(
   that you manually issued (with a PVFS_isys* or PVFS_imgmt* call),
   you need to call PINT_sys_release on your own when the operation
   completes.
+
+  If the posted operation completes immediately, post will return 0,
+  and set the op_id to -1
 */
 
 /** Adds a state machine into the list of machines that are being
@@ -343,6 +346,7 @@ PVFS_error PINT_client_state_machine_pos
     PVFS_sys_op_id *op_id,
     void *user_ptr /* in */)
 {
+    PINT_sm_action sm_ret;
     PVFS_error ret = -PVFS_EINVAL;
     job_status_s js;
     int pvfs_sys_op = PINT_smcb_op(smcb);
@@ -374,21 +378,33 @@ PVFS_error PINT_client_state_machine_pos
       start state machine and continue advancing while we're getting
       immediate completions
     */
-    ret = PINT_state_machine_start(smcb, &js);
+    sm_ret = PINT_state_machine_start(smcb, &js);
+    assert(SM_ACTION_ISVALID(sm_ret));
+
+    if(sm_ret < 0)
+    {
+        /* state machine code failed */
+        return sm_ret;
+    }
 
     if (PINT_smcb_complete(smcb))
     {
+        assert(sm_ret == SM_ACTION_TERMINATE);
+
+        PINT_sys_release(sm_p->sys_op_id);
+        *op_id = -1;
+
         gossip_debug(
             GOSSIP_CLIENT_DEBUG, "Posted %s (%lld) "
                     "(ran to termination)(%d)\n",
                     PINT_client_get_name_str(pvfs_sys_op),
                     (op_id ? *op_id : -1),
                     js.error_code);
-
-        ret = js.error_code;
     }
     else
     {
+        assert(sm_ret == SM_ACTION_DEFERRED);
+
         gossip_debug(
             GOSSIP_CLIENT_DEBUG, "Posted %s (%lld) "
                     "(waiting for test)(%d)\n",
@@ -396,7 +412,7 @@ PVFS_error PINT_client_state_machine_pos
                     (op_id ? *op_id : -1),
                     ret);
     }
-    return ret;
+    return js.error_code;
 }
 
 PVFS_error PINT_client_state_machine_release(

Index: sys-getattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-getattr.sm,v
diff -p -u -r1.99.2.14 -r1.99.2.15
--- sys-getattr.sm	3 Nov 2006 18:46:17 -0000	1.99.2.14
+++ sys-getattr.sm	10 Nov 2006 00:51:47 -0000	1.99.2.15
@@ -255,7 +255,7 @@ PVFS_error PVFS_sys_getattr(
     const PVFS_credentials *credentials,
     PVFS_sysresp_getattr *resp_p)
 {
-    PVFS_error ret = -PVFS_EINVAL, error = 0;
+    PVFS_error ret, error;
     PVFS_sys_op_id op_id;
 
     gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_sys_getattr entered\n");
@@ -265,20 +265,26 @@ PVFS_error PVFS_sys_getattr(
     if (ret)
     {
         PVFS_perror_gossip("PVFS_isys_getattr call", ret);
-        error = ret;
+        return ret;
     }
-    else
+
+    if(op_id != -1)
     {
+        /* did not complete immediately, so we wait */
+
         ret = PVFS_sys_wait(op_id, "getattr", &error);
         if (ret)
         {
             PVFS_perror_gossip("PVFS_sys_wait call", ret);
-            error = ret;
         }
+        if(error)
+        {
+            ret = error;
+        }
+        PINT_sys_release(op_id);
     }
 
-    PINT_sys_release(op_id);
-    return error;
+    return ret;
 }
 
 

Index: sys-lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-lookup.sm,v
diff -p -u -r1.62.4.15 -r1.62.4.16
--- sys-lookup.sm	3 Nov 2006 18:46:18 -0000	1.62.4.15
+++ sys-lookup.sm	10 Nov 2006 00:51:47 -0000	1.62.4.16
@@ -534,7 +534,7 @@ PVFS_error PVFS_sys_ref_lookup(
     PVFS_sysresp_lookup *resp,
     int32_t follow_link)
 {
-    PVFS_error ret = -PVFS_EINVAL, error = 0;
+    PVFS_error ret, error;
     PVFS_sys_op_id op_id;
 
     gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_sys_ref_lookup entered\n");
@@ -546,20 +546,25 @@ PVFS_error PVFS_sys_ref_lookup(
     if (ret)
     {
         PVFS_perror_gossip("PVFS_isys_ref_lookup call", ret);
-        error = ret;
+        return ret;
     }
-    else
+
+    if(op_id != -1)
     {
+        /* did not complete immediately, so we wait */
         ret = PVFS_sys_wait(op_id, "lookup", &error);
         if (ret)
         {
             PVFS_perror_gossip("PVFS_sys_wait call", ret);
-            error = ret;
         }
+        if(error)
+        {
+            ret = error;
+        }
+        PINT_sys_release(op_id);
     }
 
-    PINT_sys_release(op_id);
-    return error;
+    return ret;
 }
 
 /** Dereference a path string relative to the root directory.



More information about the Pvfs2-cvs mailing list