[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/server: precreate-pool-refiller.sm final-response.sm module.mk.in prelude.sm pvfs2-server.c pvfs2-server.h

CVS commit program cvs at parl.clemson.edu
Wed Jan 30 15:26:34 EST 2008


Update of /projects/cvsroot/pvfs2-1/src/server
In directory parlweb1:/tmp/cvs-serv27690/src/server

Modified Files:
      Tag: small-file-branch
	final-response.sm module.mk.in prelude.sm pvfs2-server.c 
	pvfs2-server.h 
Added Files:
      Tag: small-file-branch
	precreate-pool-refiller.sm 
Log Message:
stubbed in state machine to handle refilling precreate pools


--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ precreate-pool-refiller.sm	2008-01-30 15:26:34.000000000 -0500
@@ -0,0 +1,101 @@
+/* 
+ * (C) 2001 Clemson University and The University of Chicago 
+ *
+ * See COPYING in top-level directory.
+ */
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/time.h>
+
+#include "pvfs2-server.h"
+#include "pint-perf-counter.h"
+#include "server-config.h"
+
+%%
+
+machine pvfs2_precreate_pool_refiller_sm
+{
+	state wait_for_threshold 
+	{
+		run wait_for_threshold_fn;
+		success => setup_batch_create;
+		default => error;
+	}
+
+	state setup_batch_create 
+	{
+		run setup_batch_create_fn;
+		success => wait_for_threshold;
+		default => error;
+	}
+
+        state error
+        {
+                run error_fn;
+                default => terminate;
+        }
+}
+
+%%
+
+/* wait_for_threshold_fn()
+ *
+ * TODO: properly comment this
+ */
+static PINT_sm_action wait_for_threshold_fn(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    job_id_t tmp_id;
+
+    gossip_debug(GOSSIP_SERVER_DEBUG, "TMP: pretenting to wait for the pool to get low (15 sec).\n");
+
+    return(job_req_sched_post_timer(15000,
+	smcb,
+	0,
+	js_p,
+	&tmp_id,
+	server_job_context));
+}
+
+/* setup_batch_create_fn()
+ *
+ * TODO: properly comment
+ */
+static PINT_sm_action setup_batch_create_fn(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+    gossip_debug(GOSSIP_SERVER_DEBUG, "TMP: I would like to get precreated handles from %s and put store them in %llu.\n", 
+        s_op->u.precreate_pool_refiller.host,
+        s_op->u.precreate_pool_refiller.pool_handle);
+
+    js_p->error_code = 0;
+    return(1);
+}
+
+
+/* error_fn()
+ *
+ * TODO: properly comment
+ */
+static PINT_sm_action error_fn(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    return (server_state_machine_complete(smcb));
+}
+
+/*
+ * Local variables:
+ *  mode: c
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ft=c ts=8 sts=4 sw=4 expandtab
+ */
+

Index: final-response.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/final-response.sm,v
diff -p -u -r1.36.6.2 -r1.36.6.3
--- final-response.sm	24 Jan 2008 21:15:16 -0000	1.36.6.2
+++ final-response.sm	30 Jan 2008 20:26:33 -0000	1.36.6.3
@@ -212,7 +212,9 @@ static const struct {
     { PVFS_SERV_LISTEATTR, "PVFS_SERV_LISTEATTR" },
     { PVFS_SERV_SMALL_IO, "PVFS_SERV_SMALL_IO" },  
     { PVFS_SERV_LISTATTR, "PVFS_SERV_LISTATTR" },  /* 34 */
-    { PVFS_SERV_BATCH_CREATE, "PVFS_SERV_BATCH_CREATE" } /* 35 */
+    { PVFS_SERV_BATCH_CREATE, "PVFS_SERV_BATCH_CREATE" }, /* 35 */
+    { PVFS_SERV_PRECREATE_POOL_REFILLER, 
+        "PVFS_SERV_PRECREATE_POOL_REFILLER" } /* 36 */
 };
 
 static void PINT_gossip_err_server_resp(
@@ -273,6 +275,9 @@ static void PINT_gossip_err_server_resp(
                         break;
                     case PVFS_TYPE_DIRDATA:
                         gossip_err("DIRDATA [ n/a ]\n");
+                        break;
+                    case PVFS_TYPE_INTERNAL:
+                        gossip_err("INTERNAL [ n/a ]\n");
                         break;
                     case PVFS_TYPE_NONE:
                         gossip_err("NONE [ n/a ]\n");

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/module.mk.in,v
diff -p -u -r1.52.6.2 -r1.52.6.3
--- module.mk.in	24 Jan 2008 21:34:41 -0000	1.52.6.2
+++ module.mk.in	30 Jan 2008 20:26:33 -0000	1.52.6.3
@@ -42,7 +42,8 @@ ifdef BUILD_SERVER
 		$(DIR)/del-eattr.c \
 		$(DIR)/list-eattr.c \
 		$(DIR)/unexpected.c \
-		$(DIR)/stuffed-create.c
+		$(DIR)/stuffed-create.c \
+		$(DIR)/precreate-pool-refiller.c
 
 	# c files that should be added to server library
 	SERVERSRC += \

Index: prelude.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/prelude.sm,v
diff -p -u -r1.72.2.2 -r1.72.2.3
--- prelude.sm	28 Jan 2008 21:16:20 -0000	1.72.2.2
+++ prelude.sm	30 Jan 2008 20:26:33 -0000	1.72.2.3
@@ -292,6 +292,7 @@ static void get_fs_intent(struct PVFS_se
         case PVFS_SERV_MGMT_EVENT_MON:
         case PVFS_SERV_MGMT_PERF_MON:
         case PVFS_SERV_PERF_UPDATE:
+        case PVFS_SERV_PRECREATE_POOL_REFILLER:
         case PVFS_SERV_MGMT_NOOP:
         case PVFS_SERV_WRITE_COMPLETION:
         case PVFS_SERV_GETCONFIG:

Index: pvfs2-server.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/pvfs2-server.c,v
diff -p -u -r1.246.6.4 -r1.246.6.5
--- pvfs2-server.c	29 Jan 2008 20:33:14 -0000	1.246.6.4
+++ pvfs2-server.c	30 Jan 2008 20:26:33 -0000	1.246.6.5
@@ -164,6 +164,8 @@ static int precreate_pool_setup_server(c
     PVFS_handle* pool_handle);
 static int precreate_pool_register_server(const char* host, PVFS_fs_id fsid,
     PVFS_handle pool_handle);
+static int precreate_pool_launch_refiller(const char* host, PVFS_fs_id fsid,
+    PVFS_handle pool_handle);
 
 static QLIST_HEAD(precreate_pool_list);
 struct precreate_pool
@@ -437,7 +439,14 @@ struct PINT_server_req_params PINT_serve
         "stuffed_create",
         PINT_SERVER_CHECK_NONE,
         PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_stuffed_create_sm}
+        &pvfs2_stuffed_create_sm},
+
+    /* 37 */
+    {PVFS_SERV_PRECREATE_POOL_REFILLER,
+        "precreate_pool_refiller",
+        PINT_SERVER_CHECK_INVALID,
+        PINT_SERVER_ATTRIBS_REQUIRED,
+        &pvfs2_precreate_pool_refiller_sm}
 };
 
 struct server_configuration_s *PINT_get_server_config(void)
@@ -2281,6 +2290,16 @@ static int precreate_pool_initialize(voi
                     gossip_err("Error: precreate_pool_initialize failed to register pool for %s\n", server_config.host_id);
                     return(ret);
                 }
+
+                /* launch sm to take care of refilling */
+                ret = precreate_pool_launch_refiller(cur_alias->bmi_address,
+                    cur_fs->coll_id, pool_handle);
+                if(ret < 0)
+                {
+                    gossip_err("Error: precreate_pool_initialize failed to launch refiller SM for %s\n", server_config.host_id);
+                    /* TODO: how to clean up here? */
+                    return(ret);
+                }
             }
             cur_h = PINT_llist_next(cur_h);
         }
@@ -2495,6 +2514,43 @@ static int precreate_pool_register_serve
 
     /* stash the info where we can search and find it later */
     qlist_add(&tmp_pool->list_link, &precreate_pool_list);
+
+    return(0);
+}
+
+static int precreate_pool_launch_refiller(const char* host, PVFS_fs_id fsid,
+    PVFS_handle pool_handle)
+{
+    struct PINT_smcb *tmp_smcb = NULL;
+    struct PINT_server_op *s_op;
+    int ret;
+
+    /* allocate smcb */
+    ret = server_state_machine_alloc_noreq(PVFS_SERV_PRECREATE_POOL_REFILLER,
+        &(tmp_smcb));
+    if (ret < 0)
+    {
+        return(ret);
+    }
+
+    s_op = PINT_sm_frame(tmp_smcb, PINT_FRAME_CURRENT);
+    s_op->u.precreate_pool_refiller.host = strdup(host);
+    if(!s_op->u.precreate_pool_refiller.host)
+    {
+        PINT_smcb_free(tmp_smcb);
+        return(ret);
+    }
+    s_op->u.precreate_pool_refiller.pool_handle = pool_handle;
+    s_op->u.precreate_pool_refiller.fsid = fsid;
+
+    /* start sm */
+    ret = server_state_machine_start_noreq(tmp_smcb);
+    if (ret < 0)
+    {
+        free(s_op->u.precreate_pool_refiller.host);
+        PINT_smcb_free(tmp_smcb);
+        return(ret);
+    }
 
     return(0);
 }

Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/pvfs2-server.h,v
diff -p -u -r1.147.8.3 -r1.147.8.4
--- pvfs2-server.h	29 Jan 2008 20:33:14 -0000	1.147.8.3
+++ pvfs2-server.h	30 Jan 2008 20:26:34 -0000	1.147.8.4
@@ -235,6 +235,13 @@ struct PINT_server_mgmt_remove_dirent_op
     PVFS_handle dirdata_handle;
 };
 
+struct PINT_server_precreate_pool_refiller_op
+{
+    PVFS_handle pool_handle;
+    PVFS_fs_id fsid;
+    char* host;
+};
+
 struct PINT_server_mgmt_get_dirdata_op
 {
     PVFS_handle dirdata_handle;
@@ -385,6 +392,8 @@ typedef struct PINT_server_op
 	struct PINT_server_mkdir_op mkdir;
         struct PINT_server_mgmt_remove_dirent_op mgmt_remove_dirent;
         struct PINT_server_mgmt_get_dirdata_op mgmt_get_dirdata_handle;
+        struct PINT_server_precreate_pool_refiller_op
+            precreate_pool_refiller;
     } u;
 
 } PINT_server_op;
@@ -445,6 +454,7 @@ extern struct PINT_state_machine_s pvfs2
 extern struct PINT_state_machine_s pvfs2_list_eattr_sm;
 extern struct PINT_state_machine_s pvfs2_list_eattr_list_sm;
 extern struct PINT_state_machine_s pvfs2_stuffed_create_sm;
+extern struct PINT_state_machine_s pvfs2_precreate_pool_refiller_sm;
 
 /* nested state machines */
 extern struct PINT_state_machine_s pvfs2_get_attr_work_sm;



More information about the Pvfs2-cvs mailing list