[Pvfs2-cvs] commit by slang in pvfs2/src/server: pvfs2-server-req.c chdirent.sm crdirent.sm create.sm del-eattr.sm event-mon.sm final-response.sm flush.sm get-attr.sm get-config.sm get-eattr.sm io.sm iterate-handles.sm job-timer.sm list-attr.sm list-eattr.sm lookup.sm mgmt-get-dirdata-handle.sm mgmt-remove-dirent.sm mgmt-remove-object.sm mkdir.sm module.mk.in noop.sm perf-mon.sm perf-update.sm prelude.sm proto-error.sm pvfs2-server.c pvfs2-server.h readdir.sm remove.sm rmdirent.sm set-attr.sm set-eattr.sm setparam.sm small-io.sm statfs.sm truncate.sm unexpected.sm

CVS commit program cvs at parl.clemson.edu
Mon Feb 11 12:25:30 EST 2008


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

Modified Files:
	chdirent.sm crdirent.sm create.sm del-eattr.sm event-mon.sm 
	final-response.sm flush.sm get-attr.sm get-config.sm 
	get-eattr.sm io.sm iterate-handles.sm job-timer.sm 
	list-attr.sm list-eattr.sm lookup.sm 
	mgmt-get-dirdata-handle.sm mgmt-remove-dirent.sm 
	mgmt-remove-object.sm mkdir.sm module.mk.in noop.sm 
	perf-mon.sm perf-update.sm prelude.sm proto-error.sm 
	pvfs2-server.c pvfs2-server.h readdir.sm remove.sm rmdirent.sm 
	set-attr.sm set-eattr.sm setparam.sm small-io.sm statfs.sm 
	truncate.sm unexpected.sm 
Added Files:
	pvfs2-server-req.c 
Log Message:
The normal path for a server request operation is to jump to the prelude state machine, which tries schedule the request based on the handle+fsid.  This meant that the request scheduler code had a switch/case returning the handle+fsid for each request we defined.  The function was also overloaded with a readonly parameter (whether the request modified any objects on the server), and a scheduling policy parameter (as the return code), which specified whether the request scheduling could be bypassed for this request.

I moved all that to a per-request parameter structure, that gets specified within the server state machine for the request.  Now there is one array of server requests (moved to pvfs2-server-req.c) which the request scheduler and prelude state machine can poke at to get parameters (defined in the state machine for that request), and based decisions on.

The patch includes some other minor changes:

* A fix to the BMI addr ref count increment/decrement.  Previously, the addr ref count was being incremented/decremented in the prelude/final-response state machines.  That requires that those state machines get invoked, which I don't want to have to depend on.  I've moved the INC call to the unexpected_sm, and the DEC call to where the state machine gets finished in the server.  That way we don't have to worry about whether we're using prelude/final-response.

* Cleanup of the request scheduler.  The way we were changing the mode from normal to admin was sort of embedded into the request scheduling code, so we had to hack the mode change from prelude_sm instead of in setparam.  Also, the request scheduler had to be aware of the setparam fields in the request.  I've moved the mode change code to separate request scheduler and job calls.  I think something similar could be done for the timer code (it doesn't really belong in the request scheduler), but I'll leave that for another patch.

* Changed the way we compile the server binary in Makefile.in to allow for multiple object files.



--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ pvfs2-server-req.c	2008-02-11 12:25:30.000000000 -0500
@@ -0,0 +1,165 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+#include "pvfs2-server.h"
+
+/* server operation state machines */
+extern struct PINT_server_req_params pvfs2_get_config_params;
+extern struct PINT_server_req_params pvfs2_get_attr_params;
+extern struct PINT_server_req_params pvfs2_list_attr_params;
+extern struct PINT_server_req_params pvfs2_set_attr_params;
+extern struct PINT_server_req_params pvfs2_create_params;
+extern struct PINT_server_req_params pvfs2_crdirent_params;
+extern struct PINT_server_req_params pvfs2_mkdir_params;
+extern struct PINT_server_req_params pvfs2_readdir_params;
+extern struct PINT_server_req_params pvfs2_lookup_params;
+extern struct PINT_server_req_params pvfs2_io_params;
+extern struct PINT_server_req_params pvfs2_small_io_params;
+extern struct PINT_server_req_params pvfs2_remove_params;
+extern struct PINT_server_req_params pvfs2_mgmt_remove_object_params;
+extern struct PINT_server_req_params pvfs2_mgmt_remove_dirent_params;
+extern struct PINT_server_req_params pvfs2_mgmt_get_dirdata_handle_params;
+extern struct PINT_server_req_params pvfs2_rmdirent_params;
+extern struct PINT_server_req_params pvfs2_chdirent_params;
+extern struct PINT_server_req_params pvfs2_flush_params;
+extern struct PINT_server_req_params pvfs2_truncate_params;
+extern struct PINT_server_req_params pvfs2_setparam_params;
+extern struct PINT_server_req_params pvfs2_noop_params;
+extern struct PINT_server_req_params pvfs2_unexpected_params;
+extern struct PINT_server_req_params pvfs2_statfs_params;
+extern struct PINT_server_req_params pvfs2_perf_update_params;
+extern struct PINT_server_req_params pvfs2_job_timer_params;
+extern struct PINT_server_req_params pvfs2_proto_error_params;
+extern struct PINT_server_req_params pvfs2_perf_mon_params;
+extern struct PINT_server_req_params pvfs2_event_mon_params;
+extern struct PINT_server_req_params pvfs2_iterate_handles_params;
+extern struct PINT_server_req_params pvfs2_get_eattr_params;
+extern struct PINT_server_req_params pvfs2_get_eattr_list_params;
+extern struct PINT_server_req_params pvfs2_set_eattr_params;
+extern struct PINT_server_req_params pvfs2_set_eattr_list_params;
+extern struct PINT_server_req_params pvfs2_del_eattr_params;
+extern struct PINT_server_req_params pvfs2_list_eattr_params;
+
+/* table of incoming request types and associated parameters */
+struct PINT_server_req_entry PINT_server_req_table[] =
+{
+    /* 0 */ {PVFS_SERV_INVALID, NULL},
+    /* 1 */ {PVFS_SERV_CREATE, &pvfs2_create_params},
+    /* 2 */ {PVFS_SERV_REMOVE, &pvfs2_remove_params},
+    /* 3 */ {PVFS_SERV_IO, &pvfs2_io_params},
+    /* 4 */ {PVFS_SERV_GETATTR, &pvfs2_get_attr_params},
+    /* 5 */ {PVFS_SERV_SETATTR, &pvfs2_set_attr_params},
+    /* 6 */ {PVFS_SERV_LOOKUP_PATH, &pvfs2_lookup_params},
+    /* 7 */ {PVFS_SERV_CRDIRENT, &pvfs2_crdirent_params},
+    /* 8 */ {PVFS_SERV_RMDIRENT, &pvfs2_rmdirent_params},
+    /* 9 */ {PVFS_SERV_CHDIRENT, &pvfs2_chdirent_params},
+    /* 10 */ {PVFS_SERV_TRUNCATE, &pvfs2_truncate_params},
+    /* 11 */ {PVFS_SERV_MKDIR, &pvfs2_mkdir_params},
+    /* 12 */ {PVFS_SERV_READDIR, &pvfs2_readdir_params},
+    /* 13 */ {PVFS_SERV_GETCONFIG, &pvfs2_get_config_params},
+    /* 14 */ {PVFS_SERV_WRITE_COMPLETION, NULL},
+    /* 15 */ {PVFS_SERV_FLUSH, &pvfs2_flush_params},
+    /* 16 */ {PVFS_SERV_MGMT_SETPARAM, &pvfs2_setparam_params},
+    /* 17 */ {PVFS_SERV_MGMT_NOOP, &pvfs2_noop_params},
+    /* 18 */ {PVFS_SERV_STATFS, &pvfs2_statfs_params},
+    /* 19 */ {PVFS_SERV_PERF_UPDATE, &pvfs2_perf_update_params},
+    /* 20 */ {PVFS_SERV_MGMT_PERF_MON, &pvfs2_perf_mon_params},
+    /* 21 */ {PVFS_SERV_MGMT_ITERATE_HANDLES, &pvfs2_iterate_handles_params},
+    /* 22 */ {PVFS_SERV_MGMT_DSPACE_INFO_LIST, NULL},
+    /* 23 */ {PVFS_SERV_MGMT_EVENT_MON, &pvfs2_event_mon_params},
+    /* 24 */ {PVFS_SERV_MGMT_REMOVE_OBJECT, &pvfs2_mgmt_remove_object_params},
+    /* 25 */ {PVFS_SERV_MGMT_REMOVE_DIRENT, &pvfs2_mgmt_remove_dirent_params},
+    /* 26 */ {PVFS_SERV_MGMT_GET_DIRDATA_HANDLE, &pvfs2_mgmt_get_dirdata_handle_params},
+    /* 27 */ {PVFS_SERV_JOB_TIMER, &pvfs2_job_timer_params},
+    /* 28 */ {PVFS_SERV_PROTO_ERROR, &pvfs2_proto_error_params},
+    /* 29 */ {PVFS_SERV_GETEATTR, &pvfs2_get_eattr_params},
+    /* 30 */ {PVFS_SERV_SETEATTR, &pvfs2_set_eattr_params},
+    /* 31 */ {PVFS_SERV_DELEATTR, &pvfs2_del_eattr_params},
+    /* 32 */ {PVFS_SERV_LISTEATTR, &pvfs2_list_eattr_params},
+    /* 33 */ {PVFS_SERV_SMALL_IO, &pvfs2_small_io_params},
+    /* 34 */ {PVFS_SERV_LISTATTR, &pvfs2_list_attr_params},
+};
+
+#define CHECK_OP(_op_) assert(_op_ == PINT_server_req_table[_op_].op_type)
+
+inline int PINT_server_req_readonly(struct PVFS_server_req *req)
+{
+    return 1;
+}
+
+inline int PINT_server_req_modify(struct PVFS_server_req *req)
+{
+    return 0;
+}
+
+enum PINT_server_req_permissions
+PINT_server_req_get_perms(struct PVFS_server_req *req)
+{
+    CHECK_OP(req->op);
+    return PINT_server_req_table[req->op].params->perm;
+}
+
+enum PINT_server_req_access_type
+PINT_server_req_get_access_type(struct PVFS_server_req *req)
+{
+    CHECK_OP(req->op);
+
+    if(!PINT_server_req_table[req->op].params->access_type)
+    {
+        return PINT_SERVER_REQ_READONLY;
+    }
+    return PINT_server_req_table[req->op].params->access_type(req);
+}
+
+enum PINT_server_sched_policy
+PINT_server_req_get_sched_policy(struct PVFS_server_req *req)
+{
+    CHECK_OP(req->op);
+    return PINT_server_req_table[req->op].params->sched_policy;
+}
+
+int PINT_server_req_get_object_ref(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    CHECK_OP(req->op);
+
+    if(!PINT_server_req_table[req->op].params->get_object_ref)
+    {
+        *fs_id = 0;
+        *handle = 0;
+        return 0;
+    }
+    else
+    {
+        return PINT_server_req_table[req->op].params->get_object_ref(
+            req, fs_id, handle);
+    }
+}
+
+/*
+ * PINT_map_server_op_to_string()
+ *
+ * provides a string representation of the server operation number
+ *
+ * returns a pointer to a static string (DONT FREE IT) on success,
+ * null on failure
+ */
+const char* PINT_map_server_op_to_string(enum PVFS_server_op op)
+{
+    const char *s = NULL;
+
+    CHECK_OP(op);
+    return PINT_server_req_table[op].params->string_name;
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

Index: chdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/chdirent.sm,v
diff -p -u -r1.18 -r1.19
--- chdirent.sm	30 Aug 2007 00:13:44 -0000	1.18
+++ chdirent.sm	11 Feb 2008 17:25:29 -0000	1.19
@@ -115,7 +115,7 @@ static PINT_sm_action chdirent_verify_pa
         "  reading dirdata handle (coll_id = 0x%x, handle = %llu, "
         "key = %s (%d), val_buf = %p (%d))\n",
         s_op->req->u.chdirent.fs_id,
-        llu(s_op->req->u.chdirent.parent_handle),
+        llu(s_op->req->u.chdirent.handle),
         (char *) s_op->key.buffer,
         s_op->key.buffer_sz,
         s_op->val.buffer,
@@ -123,7 +123,7 @@ static PINT_sm_action chdirent_verify_pa
 
     ret = job_trove_keyval_read(
         s_op->req->u.chdirent.fs_id,
-        s_op->req->u.chdirent.parent_handle,
+        s_op->req->u.chdirent.handle,
         &s_op->key,
         &s_op->val,
         0,
@@ -266,7 +266,7 @@ static PINT_sm_action chdirent_update_di
     PVFS_object_attr_to_ds_attr(tmp_attr_ptr, ds_attr);
 
     ret = job_trove_dspace_setattr(
-        s_op->req->u.chdirent.fs_id, s_op->req->u.chdirent.parent_handle,
+        s_op->req->u.chdirent.fs_id, s_op->req->u.chdirent.handle,
         ds_attr, 
         TROVE_SYNC |
         0,
@@ -318,6 +318,18 @@ static PINT_sm_action chdirent_cleanup(
 {
     return (server_state_machine_complete(smcb));
 }
+
+PINT_GET_OBJECT_REF_DEFINE(chdirent);
+
+struct PINT_server_req_params pvfs2_chdirent_params =
+{
+    .string_name = "chdirent",
+    .perm = PINT_SERVER_CHECK_WRITE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_chdirent,
+    .state_machine = &pvfs2_chdirent_sm
+};
 
 /*
  * Local variables:

Index: crdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/crdirent.sm,v
diff -p -u -r1.68 -r1.69
--- crdirent.sm	30 Aug 2007 00:13:44 -0000	1.68
+++ crdirent.sm	11 Feb 2008 17:25:29 -0000	1.69
@@ -326,7 +326,7 @@ static PINT_sm_action crdirent_update_di
     PVFS_object_attr_to_ds_attr(tmp_attr_ptr, ds_attr);
 
     ret = job_trove_dspace_setattr(
-        s_op->req->u.crdirent.fs_id, s_op->req->u.crdirent.parent_handle,
+        s_op->req->u.crdirent.fs_id, s_op->req->u.crdirent.handle,
         ds_attr, 
         TROVE_SYNC,
         smcb, 0, js_p, &j_id, server_job_context);
@@ -355,13 +355,25 @@ static PINT_sm_action crdirent_setup_op(
 
     s_op->u.crdirent.name = s_op->req->u.crdirent.name;
     s_op->u.crdirent.new_handle = s_op->req->u.crdirent.new_handle;
-    s_op->u.crdirent.parent_handle = s_op->req->u.crdirent.parent_handle;
+    s_op->u.crdirent.parent_handle = s_op->req->u.crdirent.handle;
     s_op->u.crdirent.fs_id = s_op->req->u.crdirent.fs_id;
     s_op->u.crdirent.dir_attr_update_required = 0;
 
     js_p->error_code = 0;
     return SM_ACTION_COMPLETE;
 }
+
+PINT_GET_OBJECT_REF_DEFINE(crdirent);
+
+struct PINT_server_req_params pvfs2_crdirent_params =
+{
+    .string_name = "crdirent",
+    .perm = PINT_SERVER_CHECK_CRDIRENT,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_crdirent,
+    .state_machine = &pvfs2_crdirent_sm
+};
 
 /*
  * Local variables:

Index: create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/create.sm,v
diff -p -u -r1.46 -r1.47
--- create.sm	30 Aug 2007 00:13:44 -0000	1.46
+++ create.sm	11 Feb 2008 17:25:29 -0000	1.47
@@ -158,6 +158,22 @@ static int create_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+static inline int PINT_get_object_ref_create(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.create.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+};
+
+struct PINT_server_req_params pvfs2_create_params =
+{
+    .string_name = "create",
+    .get_object_ref = PINT_get_object_ref_create,
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .state_machine = &pvfs2_create_sm
+};
 
 /*
  * Local variables:

Index: del-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/del-eattr.sm,v
diff -p -u -r1.14 -r1.15
--- del-eattr.sm	7 Dec 2007 23:08:46 -0000	1.14
+++ del-eattr.sm	11 Feb 2008 17:25:29 -0000	1.15
@@ -195,6 +195,18 @@ static PINT_sm_action deleattr_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(deleattr);
+
+struct PINT_server_req_params pvfs2_del_eattr_params =
+{
+    .string_name = "del_eattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_deleattr,
+    .state_machine = &pvfs2_del_eattr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: event-mon.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/event-mon.sm,v
diff -p -u -r1.8 -r1.9
--- event-mon.sm	30 Aug 2007 00:13:44 -0000	1.8
+++ event-mon.sm	11 Feb 2008 17:25:29 -0000	1.9
@@ -89,7 +89,13 @@ static PINT_sm_action event_mon_do_work(
     return SM_ACTION_COMPLETE;
 }
 
-
+struct PINT_server_req_params pvfs2_event_mon_params =
+{
+    .string_name = "mgmt_event_mon",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .get_object_ref = PINT_get_object_ref_mgmt_event_mon,
+    .state_machine = &pvfs2_event_mon_sm
+};
 
 /*
  * Local variables:

Index: final-response.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/final-response.sm,v
diff -p -u -r1.37 -r1.38
--- final-response.sm	24 Jan 2008 20:28:40 -0000	1.37
+++ final-response.sm	11 Feb 2008 17:25:29 -0000	1.38
@@ -162,58 +162,10 @@ static PINT_sm_action final_response_cle
 
     PINT_encode_release(&s_op->encoded, PINT_ENCODE_RESP);
 
-    /* decrement reference count for this bmi address */
-    BMI_set_info(s_op->addr, BMI_DEC_ADDR_REF, NULL);
-
     js_p->error_code = 0;
     return SM_ACTION_COMPLETE;
 }
 
-
-static const struct {
-    enum PVFS_server_op type;
-    const char *type_str;
-} s_req_resp_type_map[] = {
-    /* WARNING: THESE MUST BE LISTED IN ORDER */
-    { PVFS_SERV_INVALID, "PVFS_SERV_INVALID"}, /* 0 */
-    { PVFS_SERV_CREATE, "PVFS_SERV_CREATE" },
-    { PVFS_SERV_REMOVE, "PVFS_SERV_REMOVE" },
-    { PVFS_SERV_IO, "PVFS_SERV_IO" },
-    { PVFS_SERV_GETATTR, "PVFS_SERV_GETATTR" },
-    { PVFS_SERV_SETATTR, "PVFS_SERV_SETATTR" },
-    { PVFS_SERV_LOOKUP_PATH, "PVFS_SERV_LOOKUP_PATH" },
-    { PVFS_SERV_CRDIRENT, "PVFS_SERV_CRDIRENT" },
-    { PVFS_SERV_RMDIRENT, "PVFS_SERV_RMDIRENT" },
-    { PVFS_SERV_CHDIRENT, "PVFS_SERV_CHDIRENT" },
-    { PVFS_SERV_TRUNCATE, "PVFS_SERV_TRUNCATE" }, /* 10 */
-    { PVFS_SERV_MKDIR, "PVFS_SERV_MKDIR" },
-    { PVFS_SERV_READDIR, "PVFS_SERV_READDIR" },
-    { PVFS_SERV_GETCONFIG, "PVFS_SERV_GETCONFIG" },
-    { PVFS_SERV_WRITE_COMPLETION, "PVFS_SERV_WRITE_COMPLETION" },
-    { PVFS_SERV_FLUSH, "PVFS_SERV_FLUSH" },
-    { PVFS_SERV_MGMT_SETPARAM, "PVFS_SERV_MGMT_SETPARAM" },
-    { PVFS_SERV_MGMT_NOOP, "PVFS_SERV_MGMT_NOOP" },
-    { PVFS_SERV_STATFS, "PVFS_SERV_STATFS" },
-    { PVFS_SERV_PERF_UPDATE, "PVFS_SERV_PERF_UPDATE" },
-    { PVFS_SERV_MGMT_PERF_MON, "PVFS_SERV_MGMT_PERF_MON" }, /* 20 */
-    { PVFS_SERV_MGMT_ITERATE_HANDLES, "PVFS_SERV_MGMT_ITERATE_HANDLES" },
-    { PVFS_SERV_MGMT_DSPACE_INFO_LIST,
-      "PVFS_SERV_MGMT_DSPACE_INFO_LIST" },
-    { PVFS_SERV_MGMT_EVENT_MON, "PVFS_SERV_MGMT_EVENT_MON" },
-    { PVFS_SERV_MGMT_REMOVE_OBJECT, "PVFS_SERV_MGMT_REMOVE_OBJECT" },
-    { PVFS_SERV_MGMT_REMOVE_DIRENT, "PVFS_SERV_MGMT_REMOVE_DIRENT" },
-    { PVFS_SERV_MGMT_GET_DIRDATA_HANDLE,
-      "PVFS_SERV_MGMT_GET_DIRDATA_HANDLE" },
-    { PVFS_SERV_JOB_TIMER, "PVFS_SERV_JOB_TIMER" },
-    { PVFS_SERV_PROTO_ERROR, "PVFS_SERV_PROTO_ERROR" },
-    { PVFS_SERV_GETEATTR, "PVFS_SERV_GETEATTR" },
-    { PVFS_SERV_SETEATTR, "PVFS_SERV_SETEATTR" }, /* 30 */
-    { PVFS_SERV_DELEATTR, "PVFS_SERV_DELEATTR" },
-    { PVFS_SERV_LISTEATTR, "PVFS_SERV_LISTEATTR" },
-    { PVFS_SERV_SMALL_IO, "PVFS_SERV_SMALL_IO" },  
-    { PVFS_SERV_LISTATTR, "PVFS_SERV_LISTATTR" }  /* 34 */
-};
-
 static void PINT_gossip_err_server_resp(
     struct PVFS_server_resp *resp)
 {
@@ -222,7 +174,7 @@ static void PINT_gossip_err_server_resp(
         if (resp->op >= 0 && resp->op < PVFS_SERV_NUM_OPS)
         {
             gossip_err("Server Response %p is of type: %s\n",
-                       resp, s_req_resp_type_map[resp->op].type_str);
+                       resp, PINT_map_server_op_to_string(resp->op));
         }
         else
         {

Index: flush.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/flush.sm,v
diff -p -u -r1.22 -r1.23
--- flush.sm	30 Aug 2007 00:13:44 -0000	1.22
+++ flush.sm	11 Feb 2008 17:25:29 -0000	1.23
@@ -195,6 +195,18 @@ static PINT_sm_action flush_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(flush);
+
+struct PINT_server_req_params pvfs2_flush_params =
+{
+    .string_name = "flush",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_flush,
+    .state_machine = &pvfs2_flush_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: get-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-attr.sm,v
diff -p -u -r1.87 -r1.88
--- get-attr.sm	30 Aug 2007 00:13:44 -0000	1.87
+++ get-attr.sm	11 Feb 2008 17:25:29 -0000	1.88
@@ -1087,6 +1087,18 @@ static PINT_sm_action getattr_interpret_
     return SM_ACTION_COMPLETE;
 }
 
+PINT_GET_OBJECT_REF_DEFINE(getattr);
+
+struct PINT_server_req_params pvfs2_get_attr_params =
+{
+    .string_name = "getattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .access_type = PINT_server_req_readonly,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_getattr,
+    .state_machine = &pvfs2_get_attr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: get-config.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-config.sm,v
diff -p -u -r1.38 -r1.39
--- get-config.sm	30 Aug 2007 00:13:44 -0000	1.38
+++ get-config.sm	11 Feb 2008 17:25:29 -0000	1.39
@@ -104,6 +104,13 @@ static PINT_sm_action getconfig_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+struct PINT_server_req_params pvfs2_get_config_params =
+{
+    .string_name = "getconfig",
+    .get_object_ref = PINT_get_object_ref_getconfig,
+    .perm = PINT_SERVER_CHECK_NONE,
+    .state_machine = &pvfs2_get_config_sm
+};
 
 /*
  * Local variables:

Index: get-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-eattr.sm,v
diff -p -u -r1.19 -r1.20
--- get-eattr.sm	30 Aug 2007 00:13:44 -0000	1.19
+++ get-eattr.sm	11 Feb 2008 17:25:29 -0000	1.20
@@ -234,6 +234,17 @@ static PINT_sm_action geteattr_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(geteattr);
+
+struct PINT_server_req_params pvfs2_get_eattr_params =
+{
+    .string_name = "get_eattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_geteattr,
+    .state_machine = &pvfs2_get_eattr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/io.sm,v
diff -p -u -r1.68 -r1.69
--- io.sm	30 Aug 2007 00:13:44 -0000	1.68
+++ io.sm	11 Feb 2008 17:25:29 -0000	1.69
@@ -386,6 +386,28 @@ static PINT_sm_action io_send_completion
     return err;
 }
 
+static inline int PINT_server_req_access_io(
+    struct PVFS_server_req *req)
+{
+    if(req->u.io.io_type == PVFS_IO_READ)
+    {
+        return 1;
+    }
+    return 0;
+}
+
+PINT_GET_OBJECT_REF_DEFINE(io);
+
+struct PINT_server_req_params pvfs2_io_params =
+{
+    .string_name = "io",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_access_io,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_io,
+    .state_machine = &pvfs2_io_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: iterate-handles.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/iterate-handles.sm,v
diff -p -u -r1.10 -r1.11
--- iterate-handles.sm	18 Oct 2007 17:55:05 -0000	1.10
+++ iterate-handles.sm	11 Feb 2008 17:25:29 -0000	1.11
@@ -129,6 +129,22 @@ static PINT_sm_action iterate_handles_fi
     return SM_ACTION_COMPLETE;
 }
 
+static inline int PINT_get_object_ref_iterate_handles(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.mgmt_iterate_handles.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+}
+
+struct PINT_server_req_params pvfs2_iterate_handles_params =
+{
+    .string_name = "mgmt_iterate_handles",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .get_object_ref = PINT_get_object_ref_iterate_handles,
+    .state_machine = &pvfs2_iterate_handles_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: job-timer.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/job-timer.sm,v
diff -p -u -r1.6 -r1.7
--- job-timer.sm	30 Aug 2007 00:13:44 -0000	1.6
+++ job-timer.sm	11 Feb 2008 17:25:29 -0000	1.7
@@ -80,6 +80,13 @@ static PINT_sm_action job_timer_do_work(
 	    server_job_context));
 }
 
+struct PINT_server_req_params pvfs2_job_timer_params =
+{
+    .string_name = "job_timer",
+    .perm = PINT_SERVER_CHECK_INVALID,
+    .state_machine = &pvfs2_job_timer_sm
+};
+
 
 
 

Index: list-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/list-attr.sm,v
diff -p -u -r1.7 -r1.8
--- list-attr.sm	30 Aug 2007 00:13:44 -0000	1.7
+++ list-attr.sm	11 Feb 2008 17:25:29 -0000	1.8
@@ -802,6 +802,24 @@ static PINT_sm_action listattr_interpret
     return SM_ACTION_COMPLETE;
 }
 
+static inline int PINT_get_object_ref_listattr(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.listattr.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+};
+
+struct PINT_server_req_params pvfs2_list_attr_params =
+{
+    .string_name = "list_attr",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_readonly,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_listattr,
+    .state_machine = &pvfs2_list_attr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: list-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/list-eattr.sm,v
diff -p -u -r1.12 -r1.13
--- list-eattr.sm	30 Aug 2007 00:13:44 -0000	1.12
+++ list-eattr.sm	11 Feb 2008 17:25:29 -0000	1.13
@@ -238,6 +238,17 @@ static PINT_sm_action listeattr_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(listeattr);
+
+struct PINT_server_req_params pvfs2_list_eattr_params =
+{
+    .string_name = "listeattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_listeattr,
+    .state_machine = &pvfs2_list_eattr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/lookup.sm,v
diff -p -u -r1.56 -r1.57
--- lookup.sm	30 Aug 2007 00:13:44 -0000	1.56
+++ lookup.sm	11 Feb 2008 17:25:29 -0000	1.57
@@ -146,7 +146,7 @@ static PINT_sm_action lookup_init(
                      "(# of segments:%u)\n",
                      s_op->req->u.lookup_path.path,
                      s_op->req->u.lookup_path.fs_id,
-                     llu(s_op->req->u.lookup_path.starting_handle),
+                     llu(s_op->req->u.lookup_path.handle),
                      s_op->req->u.lookup_path.attrmask,
                      s_op->u.lookup.seg_ct);
     if ((s_op->u.lookup.seg_ct < 0) ||
@@ -217,7 +217,7 @@ static PINT_sm_action lookup_read_object
     /* use the base handle if we haven't looked up a segment yet */
     if (s_op->u.lookup.seg_nr == 0)
     {
-        handle = s_op->req->u.lookup_path.starting_handle;
+        handle = s_op->req->u.lookup_path.handle;
         ds_attr = &(s_op->u.lookup.ds_attr_array[0]);
     }
     else
@@ -500,7 +500,7 @@ static PINT_sm_action lookup_read_direct
     /* use the base handle if we haven't looked up a segment yet */
     if (s_op->u.lookup.seg_nr == 0)
     {
-        handle = s_op->req->u.lookup_path.starting_handle;
+        handle = s_op->req->u.lookup_path.handle;
     }
     else
     {
@@ -652,6 +652,17 @@ static PINT_sm_action lookup_cleanup(
     }
     return(server_state_machine_complete(smcb));
 }
+
+PINT_GET_OBJECT_REF_DEFINE(lookup_path);
+
+struct PINT_server_req_params pvfs2_lookup_params =
+{
+    .string_name = "lookup_path",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_lookup_path,
+    .state_machine = &pvfs2_lookup_sm
+};
 
 /*
  * Local variables:

Index: mgmt-get-dirdata-handle.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-get-dirdata-handle.sm,v
diff -p -u -r1.9 -r1.10
--- mgmt-get-dirdata-handle.sm	30 Aug 2007 00:13:44 -0000	1.9
+++ mgmt-get-dirdata-handle.sm	11 Feb 2008 17:25:29 -0000	1.10
@@ -117,6 +117,17 @@ static PINT_sm_action mgmt_get_dirdata_h
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(mgmt_get_dirdata_handle);
+
+struct PINT_server_req_params pvfs2_mgmt_get_dirdata_handle_params =
+{
+    .string_name = "mgmt-get-dirdata-handle",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_mgmt_get_dirdata_handle,
+    .state_machine = &pvfs2_mgmt_get_dirdata_handle_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: mgmt-remove-dirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-remove-dirent.sm,v
diff -p -u -r1.13 -r1.14
--- mgmt-remove-dirent.sm	30 Aug 2007 00:13:44 -0000	1.13
+++ mgmt-remove-dirent.sm	11 Feb 2008 17:25:29 -0000	1.14
@@ -125,6 +125,18 @@ static PINT_sm_action mgmt_remove_dirent
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(mgmt_remove_dirent);
+
+struct PINT_server_req_params pvfs2_mgmt_remove_dirent_params =
+{
+    .string_name = "mgmt-remove-dirent",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_mgmt_remove_dirent,
+    .state_machine = &pvfs2_mgmt_remove_dirent_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: mgmt-remove-object.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-remove-object.sm,v
diff -p -u -r1.13 -r1.14
--- mgmt-remove-object.sm	30 Aug 2007 00:13:44 -0000	1.13
+++ mgmt-remove-object.sm	11 Feb 2008 17:25:29 -0000	1.14
@@ -77,6 +77,18 @@ static PINT_sm_action mgmt_remove_cleanu
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(mgmt_remove_object);
+
+struct PINT_server_req_params pvfs2_mgmt_remove_object_params =
+{
+    .string_name = "mgmt-remove-object",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_mgmt_remove_object,
+    .state_machine = &pvfs2_mgmt_remove_object_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: mkdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mkdir.sm,v
diff -p -u -r1.50 -r1.51
--- mkdir.sm	30 Aug 2007 00:13:44 -0000	1.50
+++ mkdir.sm	11 Feb 2008 17:25:29 -0000	1.51
@@ -308,6 +308,22 @@ static PINT_sm_action mkdir_prep_sm(
     return SM_ACTION_COMPLETE;
 }
 
+static inline int PINT_get_object_ref_mkdir(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.mkdir.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+};
+
+struct PINT_server_req_params pvfs2_mkdir_params =
+{
+    .string_name = "mkdir",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .state_machine = &pvfs2_mkdir_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/module.mk.in,v
diff -p -u -r1.52 -r1.53
--- module.mk.in	22 Jul 2007 16:22:04 -0000	1.52
+++ module.mk.in	11 Feb 2008 17:25:29 -0000	1.53
@@ -53,8 +53,8 @@ ifdef BUILD_SERVER
 		SMCGEN += $(SERVER_SMCGEN)
 
 	# server code that will be linked manually, not included in library
-	MISCSRC += \
-		$(DIR)/pvfs2-server.c
+	SERVERBINSRC += \
+		$(DIR)/pvfs2-server.c $(DIR)/pvfs2-server-req.c
 
 	# to stat the fs, need to know about handle statistics
 	MODCFLAGS_$(DIR)/statfs.c = \

Index: noop.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/noop.sm,v
diff -p -u -r1.7 -r1.8
--- noop.sm	30 Aug 2007 00:13:44 -0000	1.7
+++ noop.sm	11 Feb 2008 17:25:29 -0000	1.8
@@ -48,6 +48,14 @@ static PINT_sm_action noop_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+struct PINT_server_req_params pvfs2_noop_params =
+{
+    .string_name = "noop",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_readonly,
+    .get_object_ref = PINT_get_object_ref_noop,
+    .state_machine = &pvfs2_noop_sm
+};
 
 /*
  * Local variables:

Index: perf-mon.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/perf-mon.sm,v
diff -p -u -r1.14 -r1.15
--- perf-mon.sm	30 Aug 2007 00:13:44 -0000	1.14
+++ perf-mon.sm	11 Feb 2008 17:25:29 -0000	1.15
@@ -312,6 +312,14 @@ static int reallocate_static_arrays_if_n
     return(0);
 }
 
+struct PINT_server_req_params pvfs2_perf_mon_params =
+{
+    .string_name = "mgmt_perf_mon",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .get_object_ref = PINT_get_object_ref_mgmt_perf_mon,
+    .state_machine = &pvfs2_perf_mon_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: perf-update.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/perf-update.sm,v
diff -p -u -r1.11 -r1.12
--- perf-update.sm	30 Aug 2007 00:13:44 -0000	1.11
+++ perf-update.sm	11 Feb 2008 17:25:29 -0000	1.12
@@ -100,6 +100,12 @@ static PINT_sm_action perf_update_do_wor
 	server_job_context));
 }
 
+struct PINT_server_req_params pvfs2_perf_update_params =
+{
+    .string_name = "perf_update",
+    .state_machine = &pvfs2_perf_update_sm
+};
+
 
 
 

Index: prelude.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/prelude.sm,v
diff -p -u -r1.72 -r1.73
--- prelude.sm	7 Dec 2007 23:08:46 -0000	1.72
+++ prelude.sm	11 Feb 2008 17:25:30 -0000	1.73
@@ -29,7 +29,7 @@ enum {
 
 %%
 
-nested machine pvfs2_prelude_sm
+nested machine pvfs2_prelude_work_sm
 {
     state req_sched
     {
@@ -64,8 +64,37 @@ nested machine pvfs2_prelude_sm
     }
 }
 
+nested machine pvfs2_prelude_sm
+{
+    state setup
+    {
+        run prelude_setup;
+        default => prelude_work;
+    }
+
+    state prelude_work
+    {
+        jump pvfs2_prelude_work_sm;
+        default => return;
+    }
+}
+
 %%
 
+static PINT_sm_action prelude_setup(
+        struct PINT_smcb *smcb, job_status_s *js_p)
+{
+    int ret;
+    struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+    ret = PINT_server_req_get_object_ref(
+        s_op->req, &s_op->target_fs_id, &s_op->target_handle);
+    s_op->access_type = PINT_server_req_get_access_type(s_op->req);
+    s_op->sched_policy = PINT_server_req_get_sched_policy(s_op->req);
+
+    return SM_ACTION_COMPLETE;
+}
+
 /* prelude_req_sched()
  *
  * posts a request scheduler job
@@ -82,23 +111,9 @@ static PINT_sm_action prelude_req_sched(
 
     PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DETAIL_DEBUG, "request\n");
 
-    /* this is the first state for every normal pvfs2 server state
-     * machine, so we get to do some housekeeping here.  In
-     * particular, bump up the reference count on the bmi address that
-     * we are using
-     */
-    BMI_set_info(s_op->addr, BMI_INC_ADDR_REF, NULL);
-
-    /* this is a bit of a hack; if we are changing server mode we must
-     * preserve the old mode value before calling req scheduler
-     */
-    if ((s_op->op == PVFS_SERV_MGMT_SETPARAM) &&
-        (s_op->req->u.mgmt_setparam.param == PVFS_SERV_PARAM_MODE))
-    {
-        s_op->resp.u.mgmt_setparam.old_value = PINT_req_sched_get_mode();
-    }
-    
-    ret = job_req_sched_post(s_op->req, 0, smcb, 0, js_p,
+    ret = job_req_sched_post(s_op->op, s_op->target_fs_id, s_op->target_handle,
+                             s_op->access_type, s_op->sched_policy,
+                             smcb, 0, js_p,
                              &(s_op->scheduled_id), server_job_context);
 
     PINT_perf_count(PINT_server_pc, PINT_PERF_REQSCHED, 1, PINT_PERF_ADD);
@@ -114,7 +129,7 @@ static PINT_sm_action prelude_getattr_if
         struct PINT_smcb *smcb, job_status_s *js_p)
 {
     struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
-    int ret = -PVFS_EINVAL, readonly_flag = 0;
+    int ret = -PVFS_EINVAL;
     job_id_t tmp_id;
 
     PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DETAIL_DEBUG, "start\n");
@@ -123,23 +138,6 @@ static PINT_sm_action prelude_getattr_if
                  "(%p) %s (prelude sm) state: getattr_if_needed\n", s_op,
                  PINT_map_server_op_to_string(s_op->req->op));
 
-    /* first, run a request scheduler utility function that tells us
-     * what handle this request will operate on
-     */
-    ret = PINT_req_sched_target_handle(
-        s_op->req, 0, &s_op->target_handle, 
-        &s_op->target_fs_id, &readonly_flag);
-
-    if (ret < 0)
-    {
-        gossip_debug(GOSSIP_SERVER_DEBUG, "PINT_req_sched_target_handle "
-                     "returned %d ret, skipping getattr on handle %llu\n",
-                     ret, llu(s_op->target_handle));
-
-        js_p->error_code = ret;
-        return SM_ACTION_COMPLETE;
-    }
-
     /* if the handle is 0, that indicates that the request does not
      * operate on a specific handle, so there is nothing we can do
      * here
@@ -165,137 +163,6 @@ static PINT_sm_action prelude_getattr_if
     return ret;
 }
 
-static void get_fs_intent(struct PVFS_server_req *req, PVFS_fs_id *fsid, int *read_only)
-{
-    if (req == NULL)
-    {
-        *fsid = PVFS_FS_ID_NULL;
-        *read_only = -1;
-        return;
-    }
-    switch (req->op)
-    {
-        case PVFS_SERV_CREATE:
-            *fsid = req->u.create.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_REMOVE:
-            *fsid = req->u.remove.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_IO:
-            *fsid = req->u.io.fs_id;
-            *read_only = (req->u.io.io_type == PVFS_IO_READ) ? 1 : 0;
-            break;
-        case PVFS_SERV_SMALL_IO:
-            *fsid = req->u.small_io.fs_id;
-            *read_only = (req->u.small_io.io_type == PVFS_IO_READ) ? 1 : 0;
-            break;
-        case PVFS_SERV_GETATTR:
-            *fsid = req->u.getattr.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_LISTATTR:
-            *fsid = req->u.listattr.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_SETATTR:
-            *fsid = req->u.setattr.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_LOOKUP_PATH:
-            *fsid = req->u.lookup_path.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_CRDIRENT:
-            *fsid = req->u.crdirent.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_RMDIRENT:
-            *fsid = req->u.rmdirent.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_CHDIRENT:
-            *fsid = req->u.chdirent.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_TRUNCATE:
-            *fsid = req->u.truncate.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_MKDIR:
-            *fsid = req->u.mkdir.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_READDIR:
-            *fsid = req->u.readdir.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_FLUSH:
-            *fsid = req->u.flush.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_MGMT_SETPARAM:
-            *fsid = req->u.mgmt_setparam.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_STATFS:
-            *fsid = req->u.statfs.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_MGMT_ITERATE_HANDLES:
-            *fsid = req->u.mgmt_iterate_handles.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_MGMT_DSPACE_INFO_LIST:
-            *fsid = req->u.mgmt_dspace_info_list.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_MGMT_REMOVE_OBJECT:
-            *fsid = req->u.mgmt_remove_object.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_MGMT_REMOVE_DIRENT:
-            *fsid = req->u.mgmt_remove_dirent.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_MGMT_GET_DIRDATA_HANDLE:
-            *fsid = req->u.mgmt_get_dirdata_handle.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_GETEATTR:
-            *fsid = req->u.geteattr.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_SETEATTR:
-            *fsid = req->u.seteattr.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_DELEATTR:
-            *fsid = req->u.deleattr.fs_id;
-            *read_only = 0;
-            break;
-        case PVFS_SERV_LISTEATTR:
-            *fsid = req->u.listeattr.fs_id;
-            *read_only = 1;
-            break;
-        case PVFS_SERV_PROTO_ERROR:
-        case PVFS_SERV_JOB_TIMER:
-        case PVFS_SERV_MGMT_EVENT_MON:
-        case PVFS_SERV_MGMT_PERF_MON:
-        case PVFS_SERV_PERF_UPDATE:
-        case PVFS_SERV_MGMT_NOOP:
-        case PVFS_SERV_WRITE_COMPLETION:
-        case PVFS_SERV_GETCONFIG:
-        case PVFS_SERV_NUM_OPS:
-        case PVFS_SERV_INVALID:
-            *fsid = PVFS_FS_ID_NULL;
-            *read_only = -1;
-            break;
-    }
-    return;
-}
-
 static void get_anon_ids(struct filesystem_configuration_s *fsconfig,
     PVFS_uid *uid, PVFS_gid *gid)
 {
@@ -473,7 +340,6 @@ static PINT_sm_action prelude_perm_check
     PVFS_uid translated_uid = s_op->req->credentials.uid;
     PVFS_gid translated_gid = s_op->req->credentials.gid;
     PVFS_fs_id  fsid = PVFS_FS_ID_NULL;
-    int  rdonly = -1;
     int squashed_flag = 0;
     int skip_acl_flag = 0;
 
@@ -492,34 +358,14 @@ static PINT_sm_action prelude_perm_check
     /* Set the target object attribute pointer.. used later by the acl check */
     s_op->target_object_attr = obj_attr;
 
-    /* Commenting out the below block for now.  I think this code is
-     * deprecated?  Even if not all of the attributes have been filled in
-     * yet, we should still be able to read them after the object has been
-     * created.  If this change seems stable then we need to also come back
-     * and remove the PINT_SERVER_ATTRIBS_NOT_REQUIRED flag. -Phil 4-13-2006
-     */
-#if 0
-    /* the next thing we need to do is interpret the error code from
-     * reading the attributes.  Normally it is an error if that step
-     * failed, but we have to look for the special case in which we
-     * set attributes on a file that did not have attributes
-     * previously.
-     */
-    if (PINT_server_req_table[s_op->req->op].attrib_flags ==
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED)
-    {
-        js_p->error_code = 0;
-    }
-#endif
-    
-    get_fs_intent(s_op->req, &fsid, &rdonly);
-    if (fsid != PVFS_FS_ID_NULL)
+    if (s_op->target_fs_id != PVFS_FS_ID_NULL)
     {
         /*
          * if we are exporting a volume readonly, disallow any operation that modifies
          * the state of the file-system.
          */
-        if (permit_operation(fsid, rdonly, s_op->addr) < 0)
+        if (permit_operation(
+                s_op->target_fs_id, s_op->access_type, s_op->addr) < 0)
         {
             js_p->error_code = -PVFS_EROFS;
             return SM_ACTION_COMPLETE;
@@ -566,7 +412,7 @@ static PINT_sm_action prelude_perm_check
         ((s_op->attr.mask & PVFS_ATTR_COMMON_GID) ? "yes" : "no"),
         s_op->attr.group, translated_gid);
     
-    switch(PINT_server_req_table[s_op->req->op].perm)
+    switch(PINT_server_req_get_perms(s_op->req))
     {
         case PINT_SERVER_CHECK_WRITE:
             js_p->error_code = PINT_check_mode(
@@ -633,7 +479,9 @@ static PINT_sm_action prelude_perm_check
             }
             break;
         case PINT_SERVER_CHECK_NONE:
-            if(squashed_flag && !rdonly && ((s_op->req->op == PVFS_SERV_IO) ||
+            if(squashed_flag &&
+               !PINT_server_req_get_access_type(s_op->req) &&
+               ((s_op->req->op == PVFS_SERV_IO) ||
                 (s_op->req->op == PVFS_SERV_SMALL_IO) ||
                 (s_op->req->op == PVFS_SERV_TRUNCATE)))
             {
@@ -754,7 +602,7 @@ static PINT_sm_action prelude_check_acls
         js_p->error_code = -PVFS_EINVAL;
         goto cleanup;
     }
-    switch (PINT_server_req_table[s_op->req->op].perm)
+    switch (PINT_server_req_get_perms(s_op->req))
     {
         case PINT_SERVER_CHECK_WRITE:
         default:

Index: proto-error.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/proto-error.sm,v
diff -p -u -r1.7 -r1.8
--- proto-error.sm	30 Aug 2007 00:13:44 -0000	1.7
+++ proto-error.sm	11 Feb 2008 17:25:30 -0000	1.8
@@ -95,6 +95,12 @@ static PINT_sm_action proto_error_cleanu
     return(server_state_machine_complete(smcb));
 }
 
+struct PINT_server_req_params pvfs2_proto_error_params =
+{
+    .string_name = "proto_error",
+    .state_machine = &pvfs2_proto_error_sm
+};
+
 
 /*
  * Local variables:

Index: pvfs2-server.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.c,v
diff -p -u -r1.248 -r1.249
--- pvfs2-server.c	29 Jan 2008 16:16:54 -0000	1.248
+++ pvfs2-server.c	11 Feb 2008 17:25:30 -0000	1.249
@@ -160,255 +160,6 @@ static char *guess_alias(void);
 
 static TROVE_method_id trove_coll_to_method_callback(TROVE_coll_id);
 
-/* table of incoming request types and associated parameters */
-struct PINT_server_req_params PINT_server_req_table[] =
-{
-    /* 0 */
-    {PVFS_SERV_INVALID,
-        "invalid",
-        PINT_SERVER_CHECK_INVALID,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        NULL},
-
-    /* 1 */
-    {PVFS_SERV_CREATE,
-        "create",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_create_sm},
-
-    /* 2 */
-    {PVFS_SERV_REMOVE,
-        "remove",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_remove_sm},
-
-    /* 3 */
-    {PVFS_SERV_IO,
-        "io",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_io_sm},
-
-    /* 4 */
-    {PVFS_SERV_GETATTR,
-        "getattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_get_attr_sm},
-
-    /* 5 */
-    {PVFS_SERV_SETATTR,
-        "setattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_set_attr_sm},
-
-    /* 6 */
-    {PVFS_SERV_LOOKUP_PATH,
-        "lookup_path",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_lookup_sm},
-
-    /* 7 */
-    {PVFS_SERV_CRDIRENT,
-        "crdirent",
-        PINT_SERVER_CHECK_CRDIRENT,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_crdirent_sm},
-
-    /* 8 */
-    {PVFS_SERV_RMDIRENT,
-        "rmdirent",
-        PINT_SERVER_CHECK_WRITE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_rmdirent_sm},
-
-    /* 9 */
-    {PVFS_SERV_CHDIRENT,
-        "chdirent",
-        PINT_SERVER_CHECK_WRITE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_chdirent_sm},
-
-    /* 10 */
-    {PVFS_SERV_TRUNCATE,
-        "truncate",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_truncate_sm},
-
-    /* 11 */
-    {PVFS_SERV_MKDIR,
-        "mkdir",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_mkdir_sm},
-
-    /* 12 */
-    {PVFS_SERV_READDIR,
-        "readdir",
-        PINT_SERVER_CHECK_READ,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_readdir_sm},
-
-    /* 13 */
-    {PVFS_SERV_GETCONFIG,
-        "getconfig",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_get_config_sm},
-
-    /* 14 */
-    {PVFS_SERV_WRITE_COMPLETION,
-        "write_completion",
-        PINT_SERVER_CHECK_INVALID,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        NULL},
-
-    /* 15 */
-    {PVFS_SERV_FLUSH,
-        "flush",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_flush_sm},
-
-    /* 16 */
-    {PVFS_SERV_MGMT_SETPARAM,
-        "mgmt_setparam",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_setparam_sm},
-
-    /* 17 */
-    {PVFS_SERV_MGMT_NOOP,
-        "mgmt_noop",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_noop_sm},
-
-    /* 18 */
-    {PVFS_SERV_STATFS,
-        "statfs",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_statfs_sm},
-
-    /* 19 */
-    {PVFS_SERV_PERF_UPDATE,
-        "perf_update",
-        PINT_SERVER_CHECK_INVALID,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_perf_update_sm},
-
-    /* 20 */
-    {PVFS_SERV_MGMT_PERF_MON,
-        "mgmt_perf_mon",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_perf_mon_sm},
-
-    /* 21 */
-    {PVFS_SERV_MGMT_ITERATE_HANDLES,
-        "mgmt_iterate_handles",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_iterate_handles_sm},
-
-    /* 22 */
-    {PVFS_SERV_MGMT_DSPACE_INFO_LIST,
-        "mgmt_dspace_info_list",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        NULL},
-
-    /* 23 */
-    {PVFS_SERV_MGMT_EVENT_MON,
-        "mgmt_event_mon",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_event_mon_sm},
-
-    /* 24 */
-    {PVFS_SERV_MGMT_REMOVE_OBJECT,
-        "mgmt-remove-object",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_mgmt_remove_object_sm},
-
-    /* 25 */
-    {PVFS_SERV_MGMT_REMOVE_DIRENT,
-        "mgmt-remove-dirent",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_mgmt_remove_dirent_sm},
-
-    /* 26 */
-    {PVFS_SERV_MGMT_GET_DIRDATA_HANDLE,
-        "mgmt-get-dirdata-handle",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_mgmt_get_dirdata_handle_sm},
-
-    /* 27 */
-    {PVFS_SERV_JOB_TIMER,
-        "job_timer",
-        PINT_SERVER_CHECK_INVALID,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_job_timer_sm},
-
-    /* 28 */
-    {PVFS_SERV_PROTO_ERROR,
-        "proto_error",
-        PINT_SERVER_CHECK_INVALID,
-        PINT_SERVER_ATTRIBS_REQUIRED,
-        &pvfs2_proto_error_sm},
-
-    /* 29 */
-    {PVFS_SERV_GETEATTR,
-        "geteattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_get_eattr_sm},
-
-    /* 30 */
-    {PVFS_SERV_SETEATTR,
-        "seteattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_set_eattr_sm},
-
-    /* 31 */
-    {PVFS_SERV_DELEATTR,
-        "deleattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_del_eattr_sm},
-
-    /* 32 */
-    {PVFS_SERV_LISTEATTR,
-        "listeattr",
-        PINT_SERVER_CHECK_ATTR,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_list_eattr_sm},
-
-    /* 33 */
-    {PVFS_SERV_SMALL_IO,
-        "small_io",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_small_io_sm},
-
-    /* 34 */
-    {PVFS_SERV_LISTATTR,
-        "listattr",
-        PINT_SERVER_CHECK_NONE,
-        PINT_SERVER_ATTRIBS_NOT_REQUIRED,
-        &pvfs2_list_attr_sm},
-};
-
 struct server_configuration_s *PINT_get_server_config(void)
 {
     return &server_config;
@@ -1969,7 +1720,7 @@ int server_state_machine_complete(PINT_s
 
     gossip_debug(GOSSIP_SERVER_DEBUG,
             "server_state_machine_complete %p\n",smcb);
-    
+
     /* set a timestamp on the completion of the state machine */
     id_gen_fast_register(&tmp_id, s_op);
     PINT_event_timestamp(PVFS_EVENT_API_SM, (int32_t)s_op->req->op,
@@ -1981,10 +1732,12 @@ int server_state_machine_complete(PINT_s
         PINT_decode_release(&(s_op->decoded),PINT_DECODE_REQ);
     }
 
+    BMI_set_info(s_op->unexp_bmi_buff.addr, BMI_DEC_ADDR_REF, NULL);
     BMI_unexpected_free(s_op->unexp_bmi_buff.addr, 
                         s_op->unexp_bmi_buff.buffer);
     s_op->unexp_bmi_buff.buffer = NULL;
 
+
    /* Remove s_op from the inprogress_sop_list */
     qlist_del(&s_op->next);
 
@@ -2028,7 +1781,7 @@ struct PINT_state_machine_s *server_op_s
     default :
         {
             if (op >= 0 && op < PVFS_SERV_NUM_OPS)
-                return PINT_server_req_table[op].sm;
+                return PINT_server_req_table[op].params->state_machine;
             else
                 return NULL;
             break;
@@ -2054,9 +1807,6 @@ void PINT_server_access_debug(PINT_serve
                               const char * format,
                               ...)
 {
-    PVFS_handle handle;    
-    PVFS_fs_id fsid;
-    int flag;
     static char pint_access_buffer[GOSSIP_BUF_SIZE];
     struct passwd* pw;
     struct group* gr;
@@ -2068,7 +1818,6 @@ void PINT_server_access_debug(PINT_serve
     {
         va_start(ap, format);
 
-        PINT_req_sched_target_handle(s_op->req, 0, &handle, &fsid, &flag);
         pw = getpwuid(s_op->req->credentials.uid);
         gr = getgrgid(s_op->req->credentials.gid);
         snprintf(pint_access_buffer, GOSSIP_BUF_SIZE,
@@ -2076,7 +1825,7 @@ void PINT_server_access_debug(PINT_serve
             ((pw) ? pw->pw_name : "UNKNOWN"),
             ((gr) ? gr->gr_name : "UNKNOWN"),
             BMI_addr_rev_lookup_unexpected(s_op->addr),
-            llu(handle),
+            llu(s_op->target_handle),
             s_op,
             PINT_map_server_op_to_string(s_op->req->op),
             format);
@@ -2087,23 +1836,6 @@ void PINT_server_access_debug(PINT_serve
     }
 }
 #endif
-
-/*
- * PINT_map_server_op_to_string()
- *
- * provides a string representation of the server operation number
- *
- * returns a pointer to a static string (DONT FREE IT) on success,
- * null on failure
- */
-const char* PINT_map_server_op_to_string(enum PVFS_server_op op)
-{
-    const char *s = NULL;
-
-    if (op >= 0 && op < PVFS_SERV_NUM_OPS)
-        s = PINT_server_req_table[op].string_name;
-    return s;
-}
 
 static char *guess_alias(void)
 {

Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.h,v
diff -p -u -r1.147 -r1.148
--- pvfs2-server.h	13 Apr 2007 05:14:30 -0000	1.147
+++ pvfs2-server.h	11 Feb 2008 17:25:30 -0000	1.148
@@ -76,30 +76,86 @@ enum PINT_server_req_permissions
                                       needs write and execute */
 };
 
-/* indicates if the attributes for the target object must exist for
- * the operation to proceed (see prelude.sm)
- */
-enum PINT_server_req_attrib_flags
+enum PINT_server_req_access_type
 {
-    PINT_SERVER_ATTRIBS_INVALID = 0,
-    PINT_SERVER_ATTRIBS_REQUIRED = 1,
-    /* operations that operate on datafiles or on incomplete metafiles
-     * do not expect to necessarily find attributes present before
-     * starting the operation
-     */
-    PINT_SERVER_ATTRIBS_NOT_REQUIRED = 2
+    PINT_SERVER_REQ_READONLY = 0,
+    PINT_SERVER_REQ_MODIFY
 };
 
+enum PINT_server_sched_policy
+{
+    PINT_SERVER_REQ_BYPASS = 0,
+    PINT_SERVER_REQ_SCHEDULE
+};
+
+#define PINT_GET_OBJECT_REF_DEFINE(req_name)                             \
+static inline int PINT_get_object_ref_##req_name(                        \
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle) \
+{                                                                        \
+    *fs_id = req->u.req_name.fs_id;                                      \
+    *handle = req->u.req_name.handle;                                    \
+    return 0;                                                            \
+}
+
+typedef int (*PINT_server_req_access_callback)(struct PVFS_server_req *req);
+
+int PINT_server_req_readonly(struct PVFS_server_req *req);
+int PINT_server_req_modify(struct PVFS_server_req *req);
+
 struct PINT_server_req_params
 {
-    enum PVFS_server_op op_type;
     const char* string_name;
+
+    /* For each request that specifies an object ref (fsid,handle) we
+     * get the common attributes on that object and check the permissions.
+     * For the request to proceed the permissions required by this flag
+     * must be met.
+     */
     enum PINT_server_req_permissions perm;
-    enum PINT_server_req_attrib_flags attrib_flags;
-    struct PINT_state_machine_s* sm;
+
+    /* Specifies the type of access on the object (readonly, modify).  This
+     * is used by the request scheduler to determine 
+     * which requests to queue (block), and which to schedule (proceed).
+     * This is a callback implemented by the request.  For example, sometimes
+     * the io request writes, sometimes it reads.
+     * Default functions PINT_server_req_readonly and PINT_server_req_modify
+     * are used for requests that always require the same access type.
+     */
+    PINT_server_req_access_callback access_type;
+
+    /* Specifies the scheduling policy for the request.  In some cases,
+     * we can bypass the request scheduler and proceed directly with the
+     * request.
+     */
+    enum PINT_server_sched_policy sched_policy;
+
+    /* A callback implemented by the request to return the object reference
+     * from the server request structure.
+     */
+    int (*get_object_ref)(
+        struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle);
+
+    /* The state machine that performs the request */
+    struct PINT_state_machine_s *state_machine;
 };
 
-extern struct PINT_server_req_params PINT_server_req_table[];
+struct PINT_server_req_entry
+{
+    enum PVFS_server_op op_type;
+    struct PINT_server_req_params *params;
+};
+
+extern struct PINT_server_req_entry PINT_server_req_table[];
+
+int PINT_server_req_get_object_ref(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle);
+
+enum PINT_server_req_permissions
+PINT_server_req_get_perms(struct PVFS_server_req *req);
+enum PINT_server_req_access_type
+PINT_server_req_get_access_type(struct PVFS_server_req *req);
+enum PINT_server_sched_policy
+PINT_server_req_get_sched_policy(struct PVFS_server_req *req);
 
 const char* PINT_map_server_op_to_string(enum PVFS_server_op op);
 
@@ -363,6 +419,9 @@ typedef struct PINT_server_op
     PVFS_fs_id target_fs_id;
     PVFS_object_attr *target_object_attr;
 
+    enum PINT_server_req_access_type access_type;
+    enum PINT_server_sched_policy sched_policy;
+
     union
     {
 	/* request-specific scratch spaces for use during processing */
@@ -404,51 +463,16 @@ void PINT_server_access_debug(PINT_serve
                               int64_t debug_mask,
                               const char * format,
                               ...) __attribute__((format(printf, 3, 4)));
-/* server operation state machines */
-extern struct PINT_state_machine_s pvfs2_get_config_sm;
-extern struct PINT_state_machine_s pvfs2_get_attr_sm;
-extern struct PINT_state_machine_s pvfs2_list_attr_sm;
-extern struct PINT_state_machine_s pvfs2_set_attr_sm;
-extern struct PINT_state_machine_s pvfs2_create_sm;
-extern struct PINT_state_machine_s pvfs2_crdirent_sm;
-extern struct PINT_state_machine_s pvfs2_mkdir_sm;
-extern struct PINT_state_machine_s pvfs2_readdir_sm;
-extern struct PINT_state_machine_s pvfs2_lookup_sm;
-extern struct PINT_state_machine_s pvfs2_io_sm;
-extern struct PINT_state_machine_s pvfs2_small_io_sm;
-extern struct PINT_state_machine_s pvfs2_remove_sm;
-extern struct PINT_state_machine_s pvfs2_mgmt_remove_object_sm;
-extern struct PINT_state_machine_s pvfs2_mgmt_remove_dirent_sm;
-extern struct PINT_state_machine_s pvfs2_mgmt_get_dirdata_handle_sm;
-extern struct PINT_state_machine_s pvfs2_rmdirent_sm;
-extern struct PINT_state_machine_s pvfs2_chdirent_sm;
-extern struct PINT_state_machine_s pvfs2_flush_sm;
-extern struct PINT_state_machine_s pvfs2_truncate_sm;
-extern struct PINT_state_machine_s pvfs2_setparam_sm;
-extern struct PINT_state_machine_s pvfs2_noop_sm;
-extern struct PINT_state_machine_s pvfs2_unexpected_sm;
-extern struct PINT_state_machine_s pvfs2_statfs_sm;
-extern struct PINT_state_machine_s pvfs2_perf_update_sm;
-extern struct PINT_state_machine_s pvfs2_job_timer_sm;
-extern struct PINT_state_machine_s pvfs2_proto_error_sm;
-extern struct PINT_state_machine_s pvfs2_perf_mon_sm;
-extern struct PINT_state_machine_s pvfs2_event_mon_sm;
-extern struct PINT_state_machine_s pvfs2_iterate_handles_sm;
-extern struct PINT_state_machine_s pvfs2_get_eattr_sm;
-extern struct PINT_state_machine_s pvfs2_get_eattr_list_sm;
-extern struct PINT_state_machine_s pvfs2_set_eattr_sm;
-extern struct PINT_state_machine_s pvfs2_set_eattr_list_sm;
-extern struct PINT_state_machine_s pvfs2_del_eattr_sm;
-extern struct PINT_state_machine_s pvfs2_list_eattr_sm;
-extern struct PINT_state_machine_s pvfs2_list_eattr_list_sm;
 
 /* nested state machines */
 extern struct PINT_state_machine_s pvfs2_get_attr_work_sm;
 extern struct PINT_state_machine_s pvfs2_prelude_sm;
+extern struct PINT_state_machine_s pvfs2_prelude_work_sm;
 extern struct PINT_state_machine_s pvfs2_final_response_sm;
 extern struct PINT_state_machine_s pvfs2_check_entry_not_exist_sm;
 extern struct PINT_state_machine_s pvfs2_remove_work_sm;
 extern struct PINT_state_machine_s pvfs2_mkdir_work_sm;
+extern struct PINT_state_machine_s pvfs2_unexpected_sm;
 
 /* Exported Prototypes */
 struct server_configuration_s *get_server_config_struct(void);
@@ -474,7 +498,7 @@ int server_state_machine_start_noreq(
 #define PINT_OP_STATE       PINT_server_op
 #define PINT_OP_STATE_GET_MACHINE(_op) \
     ((_op >= 0 && _op < PVFS_SERV_NUM_OPS) ? \
-    PINT_server_req_table[_op].sm : NULL)
+    PINT_server_req_table[_op].params->sm : NULL)
 #endif
 
 #include "pvfs2-internal.h"

Index: readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/readdir.sm,v
diff -p -u -r1.51 -r1.52
--- readdir.sm	30 Aug 2007 00:13:44 -0000	1.51
+++ readdir.sm	11 Feb 2008 17:25:30 -0000	1.52
@@ -257,6 +257,16 @@ static PINT_sm_action readdir_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(readdir);
+
+struct PINT_server_req_params pvfs2_readdir_params =
+{
+    .string_name = "readdir",
+    .perm = PINT_SERVER_CHECK_READ,
+    .get_object_ref = PINT_get_object_ref_readdir,
+    .state_machine = &pvfs2_readdir_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/remove.sm,v
diff -p -u -r1.59 -r1.60
--- remove.sm	7 Dec 2007 23:08:46 -0000	1.59
+++ remove.sm	11 Feb 2008 17:25:30 -0000	1.60
@@ -384,6 +384,18 @@ static PINT_sm_action remove_setup_work(
     return SM_ACTION_COMPLETE;
 }
 
+PINT_GET_OBJECT_REF_DEFINE(remove);
+
+struct PINT_server_req_params pvfs2_remove_params =
+{
+    .string_name = "remove",
+    .get_object_ref = PINT_get_object_ref_remove,
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .state_machine = &pvfs2_remove_sm
+};
+
 
 /*
  * Local variables:

Index: rmdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/rmdirent.sm,v
diff -p -u -r1.55 -r1.56
--- rmdirent.sm	30 Aug 2007 00:13:44 -0000	1.55
+++ rmdirent.sm	11 Feb 2008 17:25:30 -0000	1.56
@@ -108,7 +108,7 @@ static int rmdirent_verify_parent_metada
         "  reading dirdata handle (coll_id = 0x%x, handle = %llu, "
         "key = %s (%d), val_buf = %p (%d))\n",
         s_op->req->u.rmdirent.fs_id,
-        llu(s_op->req->u.rmdirent.parent_handle),
+        llu(s_op->req->u.rmdirent.handle),
         (char *)s_op->key.buffer,
         s_op->key.buffer_sz,
         s_op->val.buffer,
@@ -116,7 +116,7 @@ static int rmdirent_verify_parent_metada
 
     ret = job_trove_keyval_read(
         s_op->req->u.rmdirent.fs_id,
-        s_op->req->u.rmdirent.parent_handle,
+        s_op->req->u.rmdirent.handle,
         &s_op->key,
         &s_op->val,
         0,
@@ -216,7 +216,7 @@ static PINT_sm_action rmdirent_update_di
     PVFS_object_attr_to_ds_attr(tmp_attr_ptr, ds_attr);
 
     ret = job_trove_dspace_setattr(
-        s_op->req->u.rmdirent.fs_id, s_op->req->u.rmdirent.parent_handle,
+        s_op->req->u.rmdirent.fs_id, s_op->req->u.rmdirent.handle,
         ds_attr, 
         TROVE_SYNC,
         smcb, 0, js_p, &j_id, server_job_context);
@@ -289,6 +289,18 @@ static PINT_sm_action rmdirent_cleanup(
 {
     return(server_state_machine_complete(smcb));
 }
+
+PINT_GET_OBJECT_REF_DEFINE(rmdirent);
+
+struct PINT_server_req_params pvfs2_rmdirent_params =
+{
+    .string_name = "rmdirent",
+    .perm = PINT_SERVER_CHECK_WRITE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_rmdirent,
+    .state_machine = &pvfs2_rmdirent_sm
+};
 
 /*
  * Local variables:

Index: set-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/set-attr.sm,v
diff -p -u -r1.72 -r1.73
--- set-attr.sm	30 Aug 2007 00:13:44 -0000	1.72
+++ set-attr.sm	11 Feb 2008 17:25:30 -0000	1.73
@@ -486,6 +486,18 @@ static PINT_sm_action setattr_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(setattr);
+
+struct PINT_server_req_params pvfs2_set_attr_params =
+{
+    .string_name = "setattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_setattr,
+    .state_machine = &pvfs2_set_attr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: set-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/set-eattr.sm,v
diff -p -u -r1.19 -r1.20
--- set-eattr.sm	30 Aug 2007 00:13:44 -0000	1.19
+++ set-eattr.sm	11 Feb 2008 17:25:30 -0000	1.20
@@ -165,6 +165,18 @@ static int seteattr_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(seteattr);
+
+struct PINT_server_req_params pvfs2_set_eattr_params =
+{
+    .string_name = "set_eattr",
+    .perm = PINT_SERVER_CHECK_ATTR,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_seteattr,
+    .state_machine = &pvfs2_set_eattr_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: setparam.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/setparam.sm,v
diff -p -u -r1.33 -r1.34
--- setparam.sm	30 Aug 2007 00:13:44 -0000	1.33
+++ setparam.sm	11 Feb 2008 17:25:30 -0000	1.34
@@ -15,6 +15,7 @@
 #include "pvfs2-server.h"
 #include "pint-event.h"
 #include "pvfs2-internal.h"
+#include "request-scheduler/request-scheduler.h"
 
 static int check_fs_id(PVFS_fs_id fs_id);
 
@@ -154,9 +155,14 @@ static PINT_sm_action setparam_work(
             js_p->error_code = 0;
             return SM_ACTION_COMPLETE;
         case PVFS_SERV_PARAM_MODE:
-            /* no work to do here; request scheduler has already handled */
+
+            s_op->resp.u.mgmt_setparam.old_value = PINT_req_sched_get_mode();
+            ret = job_req_sched_change_mode(s_op->req->u.mgmt_setparam.value,
+                                            NULL, 0, js_p, &s_op->scheduled_id,
+                                            server_job_context);
+
             js_p->error_code = 0;
-            return SM_ACTION_COMPLETE;
+            return ret;
     }
 
     gossip_lerr("Error: mgmt_setparam for unknown parameter %d.\n",
@@ -239,6 +245,24 @@ check_failed:
 
     return ret;
 }
+
+static inline int PINT_get_object_ref_setparam(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.mgmt_setparam.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+};
+
+struct PINT_server_req_params pvfs2_setparam_params =
+{
+    .string_name = "mgmt_setparam",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_setparam,
+    .state_machine = &pvfs2_setparam_sm
+};
 
 /*
  * Local variables:

Index: small-io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/small-io.sm,v
diff -p -u -r1.19 -r1.20
--- small-io.sm	30 Aug 2007 00:13:45 -0000	1.19
+++ small-io.sm	11 Feb 2008 17:25:30 -0000	1.20
@@ -241,6 +241,28 @@ static PINT_sm_action small_io_cleanup(
     return server_state_machine_complete(smcb);
 }
 
+static inline int PINT_server_req_access_small_io(
+    struct PVFS_server_req *req)
+{
+    if(req->u.io.io_type == PVFS_IO_READ)
+    {
+        return 1;
+    }
+    return 0;
+}
+
+PINT_GET_OBJECT_REF_DEFINE(small_io);
+
+struct PINT_server_req_params pvfs2_small_io_params =
+{
+    .string_name = "small_io",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_access_small_io,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_small_io,
+    .state_machine = &pvfs2_small_io_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: statfs.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/statfs.sm,v
diff -p -u -r1.16 -r1.17
--- statfs.sm	30 Aug 2007 00:13:45 -0000	1.16
+++ statfs.sm	11 Feb 2008 17:25:30 -0000	1.17
@@ -146,6 +146,21 @@ static PINT_sm_action statfs_cleanup(
     return(server_state_machine_complete(smcb));
 }
 
+static inline int PINT_get_object_ref_statfs(
+    struct PVFS_server_req *req, PVFS_fs_id *fs_id, PVFS_handle *handle)
+{
+    *fs_id = req->u.statfs.fs_id;
+    *handle = PVFS_HANDLE_NULL;
+    return 0;
+}
+
+struct PINT_server_req_params pvfs2_statfs_params =
+{
+    .string_name = "statfs",
+    .get_object_ref = PINT_get_object_ref_statfs,
+    .state_machine = &pvfs2_statfs_sm
+};
+
 
 /*
  * Local variables:

Index: truncate.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/truncate.sm,v
diff -p -u -r1.8 -r1.9
--- truncate.sm	30 Aug 2007 00:13:45 -0000	1.8
+++ truncate.sm	11 Feb 2008 17:25:30 -0000	1.9
@@ -79,6 +79,18 @@ static PINT_sm_action truncate_cleanup(
     return (server_state_machine_complete(smcb));
 }
 
+PINT_GET_OBJECT_REF_DEFINE(truncate);
+
+struct PINT_server_req_params pvfs2_truncate_params =
+{
+    .string_name = "truncate",
+    .perm = PINT_SERVER_CHECK_NONE,
+    .access_type = PINT_server_req_modify,
+    .sched_policy = PINT_SERVER_REQ_SCHEDULE,
+    .get_object_ref = PINT_get_object_ref_truncate,
+    .state_machine = &pvfs2_truncate_sm
+};
+
 /*
  * Local variables:
  *  mode: c

Index: unexpected.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/unexpected.sm,v
diff -p -u -r1.3 -r1.4
--- unexpected.sm	30 Aug 2007 00:13:45 -0000	1.3
+++ unexpected.sm	11 Feb 2008 17:25:30 -0000	1.4
@@ -99,6 +99,10 @@ static PINT_sm_action unexpected_map(
          */
         gossip_lerr("Error: post unexpected failure when restarting.\n");
     }
+
+    /* Bump up the reference count on the bmi address that we are using */
+    BMI_set_info(s_op->unexp_bmi_buff.addr, BMI_INC_ADDR_REF, NULL);
+
     /* restart as new request state machine */
     memset(js_p, 0, sizeof(job_status_s));
     ret = server_state_machine_start(smcb, js_p);



More information about the Pvfs2-cvs mailing list