[PVFS2-CVS] commit by neill in pvfs2/src/server: flush.sm

CVS commit program cvs at parl.clemson.edu
Tue Feb 17 11:58:58 EST 2004


Update of /projects/cvsroot/pvfs2/src/server
In directory parlweb:/tmp/cvs-serv4324/src/server

Modified Files:
	flush.sm 
Log Message:
- make flush only sync keyval spaces if metafile and only bstreams if datafiles
- some cleanups


Index: flush.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/flush.sm,v
diff -p -u -r1.7 -r1.8
--- flush.sm	19 Jan 2004 15:56:22 -0000	1.7
+++ flush.sm	17 Feb 2004 16:58:58 -0000	1.8
@@ -14,30 +14,54 @@
 #include "server-config.h"
 #include "pvfs2-server.h"
 
-static int flush_keyval_flush(PINT_server_op *s_op, job_status_s * js_p);
-static int flush_bstream_flush(PINT_server_op *s_op, job_status_s * js_p);
-static int flush_cleanup(PINT_server_op *s_op, job_status_s *ret);
-static int flush_check_error(PINT_server_op *s_op, job_status_s *js_p);
-void flush_init_state_machine(void);
-
-
 /*
- * todo:
- * if given a metafile, just do a keyval flush
- * if given a datafile, do just a bstream flush
+ * if given a metafile, do a keyval flush
+ * if given a datafile, do a bstream flush
  */
+enum
+{
+    FLUSH_KEYVAL  = 4,
+    FLUSH_BSTREAM = 5
+};
+
+static int flush_check_type(
+    PINT_server_op *s_op, job_status_s * js_p);
+static int flush_keyval_flush(
+    PINT_server_op *s_op, job_status_s * js_p);
+static int flush_bstream_flush(
+    PINT_server_op *s_op, job_status_s * js_p);
+static int flush_cleanup(
+    PINT_server_op *s_op, job_status_s *ret);
+static int flush_check_error(
+    PINT_server_op *s_op, job_status_s *js_p);
+void flush_init_state_machine(void);
+
 %%
 
-machine pvfs2_flush_sm(prelude, kflush, kflush_check_error, bflush, 
-	bflush_check_error, final_response, cleanup)
+machine pvfs2_flush_sm(prelude,
+                       flush_check_type,
+                       kflush,
+                       kflush_check_error,
+                       bflush, 
+                       bflush_check_error,
+                       final_response,
+                       cleanup)
 {
     state prelude
     {
 	jump pvfs2_prelude_sm;
-	success => kflush;
+	success => flush_check_type;
 	default => final_response;
     }
 
+    state flush_check_type
+    {
+	run flush_check_type;
+        FLUSH_KEYVAL => kflush;
+        FLUSH_BSTREAM => bflush;
+	default => cleanup;
+    }
+
     state kflush
     {
 	run flush_keyval_flush;
@@ -47,7 +71,6 @@ machine pvfs2_flush_sm(prelude, kflush, 
     state kflush_check_error
     {
 	run flush_check_error;
-	success => bflush;
 	default => final_response;
     }
 
@@ -77,6 +100,24 @@ machine pvfs2_flush_sm(prelude, kflush, 
 }
 
 %%
+
+static int flush_check_type(PINT_server_op *s_op, job_status_s * js_p)
+{
+    PINT_STATE_DEBUG("flush_check_type");
+
+    js_p->error_code = 0;
+
+    if (s_op->attr.objtype == PVFS_TYPE_METAFILE)
+    {
+        js_p->error_code = FLUSH_KEYVAL;
+    }
+    else if (s_op->attr.objtype == PVFS_TYPE_DATAFILE)
+    {
+        js_p->error_code = FLUSH_BSTREAM;
+    }
+    return 1;
+}
+
 /*
  * Function: flush_keyval_flush
  *
@@ -90,7 +131,6 @@ machine pvfs2_flush_sm(prelude, kflush, 
  * Synopsys: send a keyval flush request to storage
  *
  */
-
 static int flush_keyval_flush(PINT_server_op *s_op, job_status_s * js_p)
 {
     int ret;
@@ -98,14 +138,15 @@ static int flush_keyval_flush(PINT_serve
 
     PINT_STATE_DEBUG("kflush");
 
-    ret = job_trove_keyval_flush(s_op->req->u.flush.fs_id,
-	    s_op->req->u.flush.handle,
-	    s_op->req->u.flush.flags,
-	    s_op,
-	    0,
-	    js_p,
-	    &i,
-	    server_job_context);
+    ret = job_trove_keyval_flush(
+        s_op->req->u.flush.fs_id,
+        s_op->req->u.flush.handle,
+        s_op->req->u.flush.flags,
+        s_op,
+        0,
+        js_p,
+        &i,
+        server_job_context);
 
     return (ret);
 }
@@ -116,16 +157,18 @@ static int flush_keyval_flush(PINT_serve
  * bstream spaces. ( if there is neither a bstream nor a keyval associated with
  * a handle, then i'm not sure how we should handle this... )
  */
-
 static int flush_check_error(PINT_server_op *s_op, job_status_s *js_p)
 {
     PINT_STATE_DEBUG("{k,b}check_error")
+
     if (js_p->error_code == -TROVE_ENOENT)
-	js_p->error_code = 0;
-    return (1);
+    {
+        gossip_err("failed to flush handle %Lu\n",
+                   s_op->req->u.flush.handle);
+    }
+    return 1;
 }
 
-
 /*
  * Function: flush_bstream_flush
  *
@@ -139,7 +182,6 @@ static int flush_check_error(PINT_server
  * Synopsys: send a bstream flush request to storage
  *
  */
-
 static int flush_bstream_flush(PINT_server_op *s_op, job_status_s * js_p)
 {
     int ret;
@@ -147,20 +189,19 @@ static int flush_bstream_flush(PINT_serv
 
     PINT_STATE_DEBUG("bflush");
 
-    ret = job_trove_bstream_flush(s_op->req->u.flush.fs_id,
-	    s_op->req->u.flush.handle,
-	    s_op->req->u.flush.flags,
-	    s_op,
-	    0,
-	    js_p,
-	    &i,
-	    server_job_context);
+    ret = job_trove_bstream_flush(
+        s_op->req->u.flush.fs_id,
+        s_op->req->u.flush.handle,
+        s_op->req->u.flush.flags,
+        s_op,
+        0,
+        js_p,
+        &i,
+        server_job_context);
 
     return (ret);
 }
 	    
-/* cleanup()
- */
 static int flush_cleanup(PINT_server_op *s_op, job_status_s *js_p)
 {
     PINT_STATE_DEBUG("cleanup");



More information about the PVFS2-CVS mailing list