[Pvfs2-cvs] commit by slang in pvfs2/src/server: batch-create.sm
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 precreate-pool-refiller.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 stuffed-create.sm
truncate.sm unexpected.sm
CVS commit program
cvs at parl.clemson.edu
Wed Feb 20 21:10:25 EST 2008
Update of /projects/cvsroot/pvfs2/src/server
In directory parlweb1:/tmp/cvs-serv19046/src/server
Modified Files:
Tag: small-file-branch
batch-create.sm 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 precreate-pool-refiller.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 stuffed-create.sm
truncate.sm unexpected.sm
Log Message:
Big pile-o' changes to make Pete go mad.
The main changes are the implementation of the stuffed create path (now just the create state machine and operation), and the beginnings of the "unstuff" operation.
This also includes the request scheduler and state machine cleanups (required for using prelude with batch_remove) and whatever else I may have happened to change along the way.
This code is able to create files, but writing to them is almost guaranteed to break.
Index: batch-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/Attic/batch-create.sm,v
diff -p -u -r1.1.2.3 -r1.1.2.4
--- batch-create.sm 4 Feb 2008 18:01:52 -0000 1.1.2.3
+++ batch-create.sm 21 Feb 2008 02:10:20 -0000 1.1.2.4
@@ -336,6 +336,13 @@ static int batch_create_cleanup(
return(server_state_machine_complete(smcb));
}
+struct PINT_server_req_params pvfs2_batch_create_params =
+{
+ .string_name = "batch_create",
+ .perm = PINT_SERVER_CHECK_NONE,
+ .access_type = PINT_server_req_modify,
+ .state_machine = &pvfs2_batch_create_sm
+};
/*
* Local variables:
Index: chdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/chdirent.sm,v
diff -p -u -r1.18 -r1.18.6.1
--- chdirent.sm 30 Aug 2007 00:13:44 -0000 1.18
+++ chdirent.sm 21 Feb 2008 02:10:20 -0000 1.18.6.1
@@ -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.68.6.1
--- crdirent.sm 30 Aug 2007 00:13:44 -0000 1.68
+++ crdirent.sm 21 Feb 2008 02:10:20 -0000 1.68.6.1
@@ -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.6.1 -r1.46.6.2
--- create.sm 29 Jan 2008 20:33:14 -0000 1.46.6.1
+++ create.sm 21 Feb 2008 02:10:20 -0000 1.46.6.2
@@ -1,5 +1,5 @@
/*
- * (C) 2001 Clemson University and The University of Chicago
+ * (C) 2001 The University of Chicago
*
* See COPYING in top-level directory.
*/
@@ -12,6 +12,13 @@
#include "pvfs2-attr.h"
#include "gossip.h"
#include "pvfs2-internal.h"
+#include "pint-util.h"
+#include "pint-cached-config.h"
+
+enum
+{
+ DO_STUFFED_CREATE = 1
+};
%%
@@ -20,19 +27,83 @@ machine pvfs2_create_sm
state prelude
{
jump pvfs2_prelude_sm;
- success => create;
+ success => create_metafile;
default => final_response;
}
- state create
+ state create_metafile
+ {
+ run create_metafile;
+ success => check_stuffed;
+ default => final_response;
+ }
+
+ state check_stuffed
+ {
+ run check_stuffed;
+ DO_STUFFED_CREATE => create_stuffed_datafile;
+ success => request_datafiles;
+ default => final_response;
+ }
+
+ state create_stuffed_datafile
+ {
+ run create_stuffed_datafile;
+ success => setup_stuffed_datafile_handle;
+ default => remove_metafile_object;
+ }
+
+ state setup_stuffed_datafile_handle
{
- run create_create;
- default => setup_resp;
+ run setup_stuffed_datafile_handle;
+ success => write_keyvals;
+ default => remove_metafile_object;
+ }
+
+ state request_datafiles
+ {
+ run request_datafiles;
+ success => write_keyvals;
+ default => remove_metafile_object;
+ }
+
+ state write_keyvals
+ {
+ run write_keyvals;
+ success => setobj_attribs;
+ default => remove_datafile_handles;
+ }
+
+ state setobj_attribs
+ {
+ run setattr_setobj_attribs;
+ success => setup_resp;
+ default => remove_keyvals;
}
state setup_resp
{
- run create_setup_resp;
+ run setup_resp;
+ default => final_response;
+ }
+
+ state remove_datafile_handles
+ {
+ run remove_datafile_handles;
+ success => remove_metafile_object;
+ default => final_response;
+ }
+
+ state remove_metafile_object
+ {
+ run remove_metafile_object;
+ default => final_response;
+ }
+
+ state remove_keyvals
+ {
+ run remove_keyvals;
+ success => remove_datafile_handles;
default => final_response;
}
@@ -44,29 +115,14 @@ machine pvfs2_create_sm
state cleanup
{
- run create_cleanup;
+ run cleanup;
default => terminate;
}
}
%%
-/*
- * Function: create_create
- *
- * Params: server_op *s_op,
- * job_status_s* js_p
- *
- * Pre: None
- *
- * Post: None
- *
- * Returns: int
- *
- * Synopsis: Create the new dataspace with the values provided in the response.
- *
- */
-static int create_create(
+static int create_metafile(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
@@ -75,10 +131,10 @@ static int create_create(
ret = job_trove_dspace_create(
s_op->req->u.create.fs_id,
- &s_op->req->u.create.handle_extent_array,
- s_op->req->u.create.object_type,
+ &s_op->req->u.create.metafile_handle_extent_array,
+ PVFS_TYPE_METAFILE,
NULL,
- TROVE_SYNC ,
+ 0,
smcb,
0,
js_p,
@@ -88,54 +144,352 @@ static int create_create(
return(ret);
}
-/* create_setup_resp()
- *
- * fills in the response structure based on results of previous operation
- */
-static int create_setup_resp(
- struct PINT_smcb *smcb, job_status_s *js_p)
+static int check_stuffed(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- if (js_p->error_code == 0)
+ int server_type;
+ server_configuration_s *config = get_server_config_struct();
+ PVFS_BMI_addr_t myaddr;
+ PVFS_sys_layout *layout;
+ layout = &s_op->req->u.create.layout;
+ int ret;
+
+ assert(config);
+ ret = BMI_addr_lookup(&myaddr, config->host_id);
+ if(ret != 0)
{
- gossip_debug(GOSSIP_SERVER_DEBUG, "Handle created: %llu\n",
- llu(js_p->handle));
- s_op->resp.u.create.handle = js_p->handle;
- switch(s_op->req->u.create.object_type)
+ /* we can't get our own address? */
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ if(layout->algorithm != PVFS_SYS_LAYOUT_LIST)
+ {
+ /* is this metadata server also IO? */
+ PINT_cached_config_map_addr(s_op->req->u.create.fs_id,
+ myaddr, &server_type);
+ if(server_type & PINT_SERVER_TYPE_IO)
{
- case PVFS_TYPE_NONE:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type unknown.\n", llu(js_p->handle));
- break;
- case PVFS_TYPE_METAFILE:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type metafile.\n", llu(js_p->handle));
- break;
- case PVFS_TYPE_DATAFILE:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type datafile.\n", llu(js_p->handle));
- break;
- case PVFS_TYPE_DIRECTORY:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type directory.\n", llu(js_p->handle));
- break;
- case PVFS_TYPE_SYMLINK:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type symlink.\n", llu(js_p->handle));
- break;
- case PVFS_TYPE_DIRDATA:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type dirdata.\n", llu(js_p->handle));
- case PVFS_TYPE_INTERNAL:
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "new handle: %llu, type internal.\n", llu(js_p->handle));
- break;
+ /* we can do a stuffed create here */
+ s_op->resp.u.create.stuffed = 1;
+ js_p->error_code = DO_STUFFED_CREATE;
}
}
- /* NOTE: we _deliberately_ leave the error_code unchanged so that it
- * can be used by the next state.
- */
+ return SM_ACTION_COMPLETE;
+}
+
+static int create_stuffed_datafile(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t i;
+
+ /* we only get here if create_metafile succeeded */
+ assert(js_p->error_code == DO_STUFFED_CREATE);
+ gossip_debug(
+ GOSSIP_SERVER_DEBUG, "Stuffed metafile handle created: %llu\n",
+ llu(js_p->handle));
+ s_op->resp.u.create.metafile_handle = js_p->handle;
+
+ /* now create the datafile handle */
+ ret = job_trove_dspace_create(
+ s_op->req->u.create.fs_id,
+ &s_op->req->u.create.datafile_handle_extent_array,
+ PVFS_TYPE_DATAFILE,
+ NULL,
+ TROVE_SYNC,
+ smcb,
+ 0,
+ js_p,
+ &i,
+ server_job_context);
+
+ return(ret);
+}
+
+static PINT_sm_action request_datafiles(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ ret = PINT_cached_config_get_server_list(
+ s_op->req->u.create.fs_id,
+ s_op->req->u.create.attr.u.meta.dist,
+ s_op->req->u.create.num_dfiles_req,
+ &s_op->req->u.create.layout,
+ &s_op->u.create.io_servers,
+ &s_op->u.create.num_io_servers);
+ if(ret < 0)
+ {
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ s_op->resp.u.create.datafile_count = s_op->u.create.num_io_servers;
+
+ ret = job_precreate_pool_get_handles(
+ s_op->req->u.create.fs_id,
+ s_op->u.create.num_io_servers,
+ s_op->u.create.io_servers,
+ s_op->resp.u.create.datafile_handles,
+ smcb,
+ 0,
+ js_p,
+ &j_id,
+ server_job_context);
+ return ret;
+}
+
+static PINT_sm_action remove_metafile_object(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ free(s_op->resp.u.create.datafile_handles);
+
+ ret = job_trove_dspace_remove(
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
+ 0,
+ smcb,
+ 0,
+ js_p,
+ &j_id,
+ server_job_context);
+ return ret;
+}
+
+static PINT_sm_action remove_datafile_handles(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ if(s_op->resp.u.create.stuffed)
+ {
+ ret = job_trove_dspace_remove(
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.datafile_handles[0],
+ 0,
+ smcb,
+ 0,
+ js_p,
+ &j_id,
+ server_job_context);
+ }
+ else
+ {
+ /* TODO: */
+ gossip_err("We need to give the handles back to the pool somehow..\n");
+ assert(0);
+ }
+ return ret;
+}
+
+static PINT_sm_action remove_keyvals(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ /* the keyval keys and vals should still be valid here */
+ ret = job_trove_keyval_remove_list(
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
+ s_op->key_a, s_op->val_a, s_op->error_a,
+ 2, TROVE_SYNC, NULL, smcb, 0, js_p, &j_id, server_job_context);
+
+ return ret;
+}
+
+static PINT_sm_action setup_stuffed_datafile_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PVFS_handle *harray;
+
+ gossip_debug(
+ GOSSIP_SERVER_DEBUG, "Stuffed metafile handle created: %llu\n",
+ llu(js_p->handle));
+ assert(js_p->error_code == 0);
+
+ harray = malloc(sizeof(PVFS_handle));
+ if(!harray)
+ {
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+
+ harray[0] = js_p->handle;
+
+ s_op->resp.u.create.datafile_handles = harray;
+ s_op->resp.u.create.datafile_count = 1;
+ return SM_ACTION_COMPLETE;
+}
+
+static PINT_sm_action write_keyvals(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ /* start with 2 keyvals: the distribution and the datafile handles */
+ int keyval_count = 2;
+
+ if(s_op->resp.u.create.stuffed)
+ {
+ /* also need to set the layout as a keyval */
+ keyval_count+= 2;
+ }
+
+ s_op->key_a = malloc(sizeof(PVFS_ds_keyval) * keyval_count);
+ if(!s_op->key_a)
+ {
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+
+ s_op->val_a = malloc(sizeof(PVFS_ds_keyval) * keyval_count);
+ if(!s_op->val_a)
+ {
+ free(s_op->key_a);
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+
+ s_op->key_a[0].buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
+ s_op->key_a[0].buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size;
+
+ s_op->val_a[0].buffer = s_op->resp.u.create.datafile_handles;
+ s_op->val_a[0].buffer_sz =
+ s_op->resp.u.create.datafile_count * sizeof(PVFS_handle);
+
+ s_op->key_a[1].buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
+ s_op->key_a[1].buffer_sz = Trove_Common_Keys[METAFILE_DIST_KEY].size;
+
+ s_op->val_a[1].buffer_sz =
+ s_op->req->u.create.attr.u.meta.dist_size;
+ s_op->val_a[1].buffer = malloc(s_op->val_a[1].buffer_sz);
+ if(!s_op->val_a[1].buffer)
+ {
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+ PINT_dist_encode(s_op->val_a[1].buffer,
+ s_op->req->u.create.attr.u.meta.dist);
+
+ if(s_op->resp.u.create.stuffed)
+ {
+ s_op->key_a[2].buffer = Trove_Common_Keys[METAFILE_LAYOUT_KEY].key;
+ s_op->key_a[2].buffer_sz = Trove_Common_Keys[METAFILE_LAYOUT_KEY].size;
+
+ s_op->val_a[2].buffer =
+ &s_op->req->u.create.layout.algorithm;
+ s_op->val_a[2].buffer_sz =
+ sizeof(s_op->req->u.create.layout.algorithm);
+
+ s_op->key_a[3].buffer = Trove_Common_Keys[NUM_DFILES_REQ_KEY].key;
+ s_op->key_a[3].buffer_sz = Trove_Common_Keys[NUM_DFILES_REQ_KEY].size;
+
+ s_op->val_a[3].buffer = &s_op->req->u.create.num_dfiles_req;
+ s_op->val_a[3].buffer_sz = sizeof(s_op->req->u.create.num_dfiles_req);
+ }
+
+ ret = job_trove_keyval_write_list(
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
+ s_op->key_a, s_op->val_a,
+ keyval_count, TROVE_SYNC, NULL, smcb,
+ 0, js_p, &j_id, server_job_context);
+ if(ret < 0)
+ {
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ return ret;
+}
+
+static PINT_sm_action setattr_setobj_attribs(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+ PVFS_object_attr *a_p = NULL;
+ PVFS_object_attr *dspace_a_p = NULL;
+ PVFS_ds_attributes *ds_attr = NULL;
+
+ dspace_a_p = &s_op->attr;
+ a_p = &s_op->req->u.create.attr;
+
+ /*
+ * Remember that mtime is versioned on disk! so convert it here..
+ * It is better to do it here than change the PVFS_object_attr_overwrite_setable
+ * macro, since there are many more users of it, I think.
+ */
+ if (a_p->mask & PVFS_ATTR_COMMON_MTIME_SET)
+ {
+ PVFS_time orig_mtime = a_p->mtime;
+ a_p->mtime = PINT_util_mktime_version(orig_mtime);
+ gossip_debug(GOSSIP_SETATTR_DEBUG, "setting version "
+ "to %llu\n\tmtime is %llu\n",
+ llu(a_p->mtime), llu(orig_mtime));
+ }
+
+ /*
+ we have the attribs stored in the dspace, as well as the
+ requested attribs to store. overwrite the ones that are setable
+ and specified by the mask value in the request; macro defined in
+ pvfs2-storage.h
+ */
+ PVFS_object_attr_overwrite_setable(dspace_a_p, a_p);
+
+ gossip_debug(
+ GOSSIP_SERVER_DEBUG,
+ "[STUFFED CREATE]: WRITING attrs: [owner = %d, group = %d\n\t"
+ "perms = %o, type = %d, atime = %llu, mtime = %llu\n\t"
+ "ctime = %llu | dfile_count = %d | dist_size = %d]\n",
+ dspace_a_p->owner, dspace_a_p->group, dspace_a_p->perms,
+ dspace_a_p->objtype, llu(dspace_a_p->atime),
+ llu(PINT_util_mkversion_time(dspace_a_p->mtime)), llu(dspace_a_p->ctime),
+ (int)dspace_a_p->u.meta.dfile_count,
+ (int)dspace_a_p->u.meta.dist_size);
+
+ /* translate attrs to storage attr format */
+ ds_attr = &(s_op->ds_attr);
+ PVFS_object_attr_to_ds_attr(dspace_a_p, ds_attr);
+
+ ret = job_trove_dspace_setattr(
+ s_op->req->u.create.fs_id, s_op->resp.u.create.metafile_handle,
+ ds_attr,
+ TROVE_SYNC,
+ smcb, 0, js_p, &j_id, server_job_context);
+
+ return ret;
+}
+
+static int setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ if (js_p->error_code == 0)
+ {
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
+ "create: new metadata handle: %llu.\n",
+ llu(s_op->resp.u.create.metafile_handle));
+ }
+
return SM_ACTION_COMPLETE;
}
@@ -155,12 +509,45 @@ static int create_setup_resp(
* Synopsis: free memory and return
*
*/
-static int create_cleanup(
+static int cleanup(
struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+ if(s_op->key_a)
+ {
+ free(s_op->key_a);
+ }
+
+ if(s_op->val_a)
+ {
+ if(s_op->val_a[1].buffer)
+ {
+ free(s_op->val_a[1].buffer);
+ }
+ free(s_op->val_a);
+ }
+
+ if(s_op->resp.u.create.datafile_handles)
+ {
+ free(s_op->resp.u.create.datafile_handles);
+ }
+
+ if(s_op->u.create.io_servers)
+ {
+ free(s_op->u.create.io_servers);
+ }
+
return(server_state_machine_complete(smcb));
}
+struct PINT_server_req_params pvfs2_create_params =
+{
+ .string_name = "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.14.2.1
--- del-eattr.sm 7 Dec 2007 23:08:46 -0000 1.14
+++ del-eattr.sm 21 Feb 2008 02:10:20 -0000 1.14.2.1
@@ -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.8.6.1
--- event-mon.sm 30 Aug 2007 00:13:44 -0000 1.8
+++ event-mon.sm 21 Feb 2008 02:10:20 -0000 1.8.6.1
@@ -89,7 +89,12 @@ 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,
+ .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.36.6.3 -r1.36.6.4
--- final-response.sm 30 Jan 2008 20:26:33 -0000 1.36.6.3
+++ final-response.sm 21 Feb 2008 02:10:20 -0000 1.36.6.4
@@ -162,61 +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 */
- { 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(
struct PVFS_server_resp *resp)
{
@@ -225,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.22.6.1
--- flush.sm 30 Aug 2007 00:13:44 -0000 1.22
+++ flush.sm 21 Feb 2008 02:10:20 -0000 1.22.6.1
@@ -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.87.6.1
--- get-attr.sm 30 Aug 2007 00:13:44 -0000 1.87
+++ get-attr.sm 21 Feb 2008 02:10:20 -0000 1.87.6.1
@@ -28,6 +28,7 @@
#include "pvfs2-util.h"
#include "pint-util.h"
#include "pvfs2-internal.h"
+#include "pint-cached-config.h"
PINT_server_trove_keys_s Trove_Special_Keys[] =
{
@@ -54,7 +55,7 @@ nested machine pvfs2_get_attr_work_sm
{
run getattr_verify_attribs;
STATE_SYMLINK => read_symlink_target;
- STATE_METAFILE => read_metafile_hint;
+ STATE_METAFILE => read_metafile_keyvals;
STATE_DIR => get_dirdata_handle;
default => setup_resp;
}
@@ -65,29 +66,28 @@ nested machine pvfs2_get_attr_work_sm
default => setup_resp;
}
- state read_metafile_hint
+ state read_metafile_keyvals
{
- run getattr_read_metafile_hint;
- default => interpret_metafile_hint;
+ run getattr_read_metafile_keyvals;
+ default => interpret_metafile_keyvals;
}
- state interpret_metafile_hint
+ state interpret_metafile_keyvals
{
- run getattr_interpret_metafile_hint;
- STATE_METAFILE => read_metafile_datafile_handles_if_required;
- default => setup_resp;
+ run getattr_interpret_metafile_keyvals;
+ default => read_stuffed_size;
}
- state read_metafile_datafile_handles_if_required
+ state read_stuffed_size
{
- run getattr_read_metafile_datafile_handles_if_required;
- success => read_metafile_distribution_if_required;
+ run getattr_read_stuffed_size;
+ success => interpret_stuffed_size;
default => setup_resp;
}
- state read_metafile_distribution_if_required
+ state interpret_stuffed_size
{
- run getattr_read_metafile_distribution_if_required;
+ run getattr_interpret_stuffed_size;
default => setup_resp;
}
@@ -417,180 +417,211 @@ static PINT_sm_action getattr_read_symli
return ret;
}
-static PINT_sm_action getattr_interpret_metafile_hint(
- PINT_smcb *smcb, job_status_s *js_p)
+static PINT_sm_action getattr_read_metafile_keyvals(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PVFS_object_attr *resp_attr = NULL;
+ int ret = -PVFS_EINVAL;
+ int dfile_count = 0;
+ job_id_t i;
+ int keyval_count = 1;
+ int kind = 0;
+ char *buf;
- resp_attr = &s_op->resp.u.getattr.attr;
- assert(resp_attr->objtype == PVFS_TYPE_METAFILE);
- if (js_p->error_code == 0 || js_p->error_code == -TROVE_ENOENT)
+ assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
+
+ js_p->error_code = 0;
+
+ assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
+
+ if (s_op->u.getattr.attrmask & PVFS_ATTR_META_DFILES)
{
- if (js_p->error_code == 0)
- {
- memcpy(&s_op->resp.u.getattr.attr.u.meta.hint, s_op->val.buffer,
- sizeof(s_op->resp.u.getattr.attr.u.meta.hint));
- }
- if ((resp_attr->mask & PVFS_ATTR_META_DFILES) ||
- (resp_attr->mask & PVFS_ATTR_META_DIST))
- {
- gossip_debug(GOSSIP_GETATTR_DEBUG, " * client wants extra "
- "meta info, about to retrieve it now\n");
- js_p->error_code = STATE_METAFILE;
- }
- else
- {
- gossip_debug(GOSSIP_GETATTR_DEBUG, " * client doesn't want "
- "extra meta info, preparing response now\n");
- js_p->error_code = 0;
- }
+ /* get the datafile handles array keyval */
+ keyval_count++;
}
- else {
- /*If we hit an error the DIST & DFILES are no longer valid*/
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
+
+ if (s_op->u.getattr.attrmask & PVFS_ATTR_META_DIST)
+ {
+ /* get the distribution keyval */
+ keyval_count++;
}
- if (s_op->val.buffer)
+
+ s_op->key_a = malloc(sizeof(*s_op->key_a) * keyval_count);
+ if(!s_op->key_a)
{
- free(s_op->val.buffer);
- s_op->val.buffer = NULL;
+ js_p->error_code = -PVFS_ENOMEM;
+ s_op->resp.u.getattr.attr.mask &=
+ ~(PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES);
+ return SM_ACTION_COMPLETE;
}
- return 1;
-}
-static PINT_sm_action getattr_read_metafile_hint(
- 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;
- job_id_t i;
- char *buf = NULL;
+ s_op->val_a = malloc(sizeof(*s_op->val_a) * keyval_count);
+ if(!s_op->val_a)
+ {
+ free(s_op->key_a);
+ js_p->error_code = -PVFS_ENOMEM;
+ s_op->resp.u.getattr.attr.mask &=
+ ~(PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES);
+ return SM_ACTION_COMPLETE;
+ }
- assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
- buf = (char *) calloc(sizeof(PVFS_metafile_hint) + 1, 1);
- if (buf == NULL)
+ s_op->free_a = malloc(sizeof(*s_op->free_a) * keyval_count);
+ if(!s_op->val_a)
{
+ free(s_op->key_a);
+ free(s_op->val_a);
js_p->error_code = -PVFS_ENOMEM;
- /*If we hit an error the DIST & DFILES are no longer valid*/
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
- return 1;
+ s_op->resp.u.getattr.attr.mask &=
+ ~(PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES);
+ return SM_ACTION_COMPLETE;
}
- js_p->error_code = 0;
- s_op->key.buffer = Trove_Special_Keys[METAFILE_HINT_KEY].key;
- s_op->key.buffer_sz = Trove_Special_Keys[METAFILE_HINT_KEY].size;
+ buf = (char *) malloc(sizeof(s_op->resp.u.getattr.attr.u.meta.hint) + 1);
+ if (!buf)
+ {
+ free(s_op->val_a);
+ free(s_op->key_a);
+ js_p->error_code = -PVFS_ENOMEM;
+ /*If we hit an error the DIST & DFILES are no longer valid*/
+ s_op->resp.u.getattr.attr.mask &=
+ ~(PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES);
+ return SM_ACTION_COMPLETE;
+ }
- s_op->val.buffer = buf;
- s_op->val.buffer_sz = sizeof(s_op->resp.u.getattr.attr.u.meta.hint) + 1;
+ s_op->key_a[kind].buffer = Trove_Special_Keys[METAFILE_HINT_KEY].key;
+ s_op->key_a[kind].buffer_sz = Trove_Special_Keys[METAFILE_HINT_KEY].size;
- gossip_debug(GOSSIP_GETATTR_DEBUG,
- " reading metafile hint (coll_id = %d, "
- "handle = %llu, key = %s (%d), val_buf = %p (%d))\n",
- s_op->u.getattr.fs_id,
- llu(s_op->u.getattr.handle), (char *)s_op->key.buffer,
- s_op->key.buffer_sz, s_op->val.buffer,
- s_op->val.buffer_sz);
+ s_op->val_a[kind].buffer = buf;
+ s_op->val_a[kind].buffer_sz =
+ sizeof(s_op->resp.u.getattr.attr.u.meta.hint) + 1;
+ s_op->free_a[kind] = 1;
- ret = job_trove_keyval_read(
- s_op->u.getattr.fs_id, s_op->u.getattr.handle,
- &s_op->key, &s_op->val,
- 0,
- NULL, smcb, 0, js_p,
- &i, server_job_context);
+ ++kind;
- return ret;
-}
+ /* if we don't need to fill in the dfiles, skip them */
+ if (s_op->u.getattr.attrmask & PVFS_ATTR_META_DFILES)
+ {
+ dfile_count = s_op->resp.u.getattr.attr.u.meta.dfile_count;
-static PINT_sm_action getattr_read_metafile_datafile_handles_if_required(
- 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;
- int dfile_count = 0;
- job_id_t i;
+ gossip_debug(GOSSIP_GETATTR_DEBUG,
+ "[GETATTR]: dspace has dfile count of %d\n",
+ s_op->resp.u.getattr.attr.u.meta.dfile_count);
- assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
+ /* verify that the retrieved dfile count is sane */
+ if (!PVFS_REQ_LIMIT_DFILE_COUNT_IS_VALID(dfile_count))
+ {
+ gossip_err("The requested dfile count of %d is invalid; "
+ "aborting operation.\n", dfile_count);
+ gossip_err(
+ "+ attrs read from dspace: (owner = %d, group = %d, "
+ "perms = %o, type = %d\n atime = %lld, mtime = %lld, "
+ "ctime = %lld |\n dfile_count = %d | dist_size = %d)\n",
+ s_op->resp.u.getattr.attr.owner,
+ s_op->resp.u.getattr.attr.group,
+ s_op->resp.u.getattr.attr.perms,
+ s_op->resp.u.getattr.attr.objtype,
+ lld(s_op->resp.u.getattr.attr.atime),
+ lld(s_op->resp.u.getattr.attr.mtime),
+ lld(s_op->resp.u.getattr.attr.ctime),
+ (int)s_op->resp.u.getattr.attr.u.meta.dfile_count,
+ (int)s_op->resp.u.getattr.attr.u.meta.dist_size);
+
+ gossip_err("handle: %llu (%llx), fsid: %d.\n",
+ llu(s_op->u.getattr.handle), llu(s_op->u.getattr.handle),
+ (int)s_op->u.getattr.fs_id);
+
+ /*If we hit an error the DIST & DFILES are no longer valid*/
+ s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
+ s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
+
+ free(s_op->val_a);
+ free(s_op->key_a);
+ free(s_op->error_a);
+ free(buf);
+ js_p->error_code = -PVFS_EOVERFLOW;
+ return SM_ACTION_COMPLETE;
+ }
- js_p->error_code = 0;
+ s_op->key_a[kind].buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
+ s_op->key_a[kind].buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size;
- /* if we don't need to fill in the dfiles, skip them */
- if (!(s_op->u.getattr.attrmask & PVFS_ATTR_META_DFILES))
- {
- gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping data handle read\n");
- return SM_ACTION_COMPLETE;
- }
+ /* add mask value to indicate the data file array is filled */
+ s_op->resp.u.getattr.attr.mask |= PVFS_ATTR_META_DFILES;
- dfile_count = s_op->resp.u.getattr.attr.u.meta.dfile_count;
+ s_op->resp.u.getattr.attr.u.meta.dfile_array =
+ malloc(dfile_count * sizeof(PVFS_handle));
+ if (!s_op->resp.u.getattr.attr.u.meta.dfile_array)
+ {
+ gossip_err("Cannot allocate dfile array of count %d\n",
+ dfile_count);
+ free(s_op->val_a);
+ free(s_op->key_a);
+ free(s_op->error_a);
+ free(buf);
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
- gossip_debug(GOSSIP_GETATTR_DEBUG,
- " request has dfile_count of %d | dspace has %d\n",
- s_op->resp.u.getattr.attr.u.meta.dfile_count,
- s_op->resp.u.getattr.attr.u.meta.dfile_count);
-
- /* verify that the retrieved dfile count is sane */
- if (!PVFS_REQ_LIMIT_DFILE_COUNT_IS_VALID(dfile_count))
- {
- gossip_err("The requested dfile count of %d is invalid; "
- "aborting operation.\n", dfile_count);
- gossip_err(
- "+ attrs read from dspace: (owner = %d, group = %d, "
- "perms = %o, type = %d\n atime = %lld, mtime = %lld, "
- "ctime = %lld |\n dfile_count = %d | dist_size = %d)\n",
- s_op->resp.u.getattr.attr.owner,
- s_op->resp.u.getattr.attr.group,
- s_op->resp.u.getattr.attr.perms,
- s_op->resp.u.getattr.attr.objtype,
- lld(s_op->resp.u.getattr.attr.atime),
- lld(s_op->resp.u.getattr.attr.mtime),
- lld(s_op->resp.u.getattr.attr.ctime),
- (int)s_op->resp.u.getattr.attr.u.meta.dfile_count,
- (int)s_op->resp.u.getattr.attr.u.meta.dist_size);
-
- gossip_err("handle: %llu (%llx), fsid: %d.\n",
- llu(s_op->u.getattr.handle), llu(s_op->u.getattr.handle),
- (int)s_op->u.getattr.fs_id);
+ s_op->val_a[kind].buffer = s_op->resp.u.getattr.attr.u.meta.dfile_array;
+ s_op->val_a[kind].buffer_sz = (dfile_count * sizeof(PVFS_handle));
+ s_op->free_a[kind] = 1;
- /*If we hit an error the DIST & DFILES are no longer valid*/
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
-
- js_p->error_code = -PVFS_EOVERFLOW;
- return SM_ACTION_COMPLETE;
+ ++kind;
}
- s_op->key.buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
- s_op->key.buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size;
+ /* if we don't need to fill in the distribution, skip it */
+ if (s_op->u.getattr.attrmask & PVFS_ATTR_META_DIST)
+ {
+ gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping data handle "
+ "distribution read\n");
- /* add mask value to indicate the data file array is filled */
- s_op->resp.u.getattr.attr.mask |= PVFS_ATTR_META_DFILES;
+ s_op->key_a[kind].buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
+ s_op->key_a[kind].buffer_sz = Trove_Common_Keys[METAFILE_DIST_KEY].size;
- s_op->resp.u.getattr.attr.u.meta.dfile_array =
- malloc(dfile_count * sizeof(PVFS_handle));
- if (!s_op->resp.u.getattr.attr.u.meta.dfile_array)
- {
- gossip_err("Cannot allocate dfile array of count %d\n",
- dfile_count);
- js_p->error_code = -PVFS_ENOMEM;
- return SM_ACTION_COMPLETE;
- }
+ /*
+ there *should* be some distribution information. if not, dump
+ which handle is busted and assertion die for now while we're not
+ handling this kind of error
+ */
+ if (s_op->resp.u.getattr.attr.u.meta.dist_size < 1)
+ {
+ gossip_err("Cannot Read Dist! Got an invalid dist size for "
+ "handle %llu,%d\n",llu(s_op->u.getattr.handle),
+ s_op->u.getattr.fs_id);
+ free(s_op->val_a);
+ free(s_op->key_a);
+ free(s_op->error_a);
+ free(buf);
+ js_p->error_code = -PVFS_EINVAL;
+ return SM_ACTION_COMPLETE;
+ }
+
+ /* add mask value to indicate the distribution is filled */
+ s_op->resp.u.getattr.attr.mask |= PVFS_ATTR_META_DIST;
- s_op->val.buffer = s_op->resp.u.getattr.attr.u.meta.dfile_array;
- s_op->val.buffer_sz = (dfile_count * sizeof(PVFS_handle));
+ s_op->val_a[kind].buffer_sz = s_op->resp.u.getattr.attr.u.meta.dist_size;
+ s_op->val_a[kind].buffer = malloc(s_op->val.buffer_sz);
+ if (!s_op->val_a[kind].buffer)
+ {
+ gossip_err("Cannot allocate dist of size %d\n",
+ s_op->val_a[kind].buffer_sz);
+ free(s_op->val_a);
+ free(s_op->key_a);
+ free(s_op->error_a);
+ free(buf);
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+ s_op->free_a[kind] = 1;
- gossip_debug(GOSSIP_GETATTR_DEBUG,
- " reading %d datafile handles (coll_id = %d, "
- "handle = %llu, key = %s (%d), val_buf = %p (%d))\n",
- dfile_count, s_op->u.getattr.fs_id,
- llu(s_op->u.getattr.handle), (char *)s_op->key.buffer,
- s_op->key.buffer_sz, s_op->val.buffer,
- s_op->val.buffer_sz);
+ ++kind;
+ }
- ret = job_trove_keyval_read(
+ s_op->keyval_count = keyval_count;
+ ret = job_trove_keyval_read_list(
s_op->u.getattr.fs_id, s_op->u.getattr.handle,
- &s_op->key, &s_op->val,
+ s_op->key_a, s_op->val_a, s_op->error_a, s_op->keyval_count,
0,
NULL, smcb, 0, js_p,
&i, server_job_context);
@@ -598,65 +629,108 @@ static PINT_sm_action getattr_read_metaf
return ret;
}
-static PINT_sm_action getattr_read_metafile_distribution_if_required(
- struct PINT_smcb *smcb, job_status_s *js_p)
+static PINT_sm_action getattr_interpret_metafile_keyvals(
+ 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;
- job_id_t i;
+ int kind = 0;
- assert(s_op->attr.objtype == PVFS_TYPE_METAFILE);
- js_p->error_code = 0;
-
- /* if we don't need to fill in the distribution, skip it */
- if (!(s_op->u.getattr.attrmask & PVFS_ATTR_META_DIST))
+ /* handle metafile hint keyval */
+ if(s_op->error_a[kind] == 0 || s_op->error_a[kind] == -TROVE_ENOENT)
{
- gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping data handle "
- "distribution read\n");
+ if (s_op->error_a[kind] == 0)
+ {
+ memcpy(&s_op->resp.u.getattr.attr.u.meta.hint,
+ s_op->val_a[kind].buffer,
+ sizeof(s_op->resp.u.getattr.attr.u.meta.hint));
+ }
+ }
+ else
+ {
+ js_p->error_code = s_op->error_a[kind];
return SM_ACTION_COMPLETE;
}
- s_op->key.buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
- s_op->key.buffer_sz = Trove_Common_Keys[METAFILE_DIST_KEY].size;
+ return SM_ACTION_COMPLETE;
+}
- /*
- there *should* be some distribution information. if not, dump
- which handle is busted and assertion die for now while we're not
- handling this kind of error
- */
- if (s_op->resp.u.getattr.attr.u.meta.dist_size < 1)
+static PINT_sm_action getattr_read_stuffed_size(
+ 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;
+ job_id_t job_id;
+ PVFS_BMI_addr_t myaddr, first_handle_server_addr;
+ server_configuration_s *config = get_server_config_struct();
+
+ js_p->error_code = 0;
+
+ if(!(s_op->req->u.getattr.attrmask & PVFS_ATTR_DATA_SIZE))
{
- gossip_err("Cannot Read Dist! Got an invalid dist size for "
- "handle %llu,%d\n",llu(s_op->u.getattr.handle),
- s_op->u.getattr.fs_id);
- js_p->error_code = -PVFS_EINVAL;
+ /* skip trying to get the size of the stuffed file if its not requested */
return SM_ACTION_COMPLETE;
}
- assert(s_op->resp.u.getattr.attr.u.meta.dist_size > 0);
- /* add mask value to indicate the distribution is filled */
- s_op->resp.u.getattr.attr.mask |= PVFS_ATTR_META_DIST;
+ ret = BMI_addr_lookup(&myaddr, config->host_id);
+ if(ret != 0)
+ {
+ /* we can't get our own address? */
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
- s_op->val.buffer_sz = s_op->resp.u.getattr.attr.u.meta.dist_size;
- s_op->val.buffer = malloc(s_op->val.buffer_sz);
- if (!s_op->val.buffer)
+ /* figure out if this is a stuffed file */
+ if(s_op->resp.u.getattr.attr.u.meta.dfile_count >= 1)
{
- gossip_err("Cannot allocate dist of size %d\n",
- s_op->val.buffer_sz);
- js_p->error_code = -PVFS_ENOMEM;
- return SM_ACTION_COMPLETE;
+ ret = PINT_cached_config_map_to_server(
+ &first_handle_server_addr,
+ s_op->resp.u.getattr.attr.u.meta.dfile_array[0],
+ s_op->req->u.getattr.fs_id);
+ if(ret < 0)
+ {
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ if(myaddr == first_handle_server_addr)
+ {
+ /* first handle belongs to this server, so we can return the
+ * bstream size.
+ */
+ ret = job_trove_dspace_getattr(
+ s_op->req->u.getattr.fs_id,
+ s_op->resp.u.getattr.attr.u.meta.dfile_array[0],
+ smcb,
+ &s_op->ds_attr,
+ 0,
+ js_p,
+ &job_id,
+ server_job_context);
+ if(ret < 0)
+ {
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+ return ret;
+ }
}
- s_op->free_val = 1;
- ret = job_trove_keyval_read(
- s_op->u.getattr.fs_id, s_op->u.getattr.handle,
- &(s_op->key), &(s_op->val),
- 0,
- NULL,
- smcb, 0, js_p, &i, server_job_context);
+ return SM_ACTION_COMPLETE;
+}
- return ret;
+static PINT_sm_action getattr_interpret_stuffed_size(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+
+ if(js_p->error_code == 0)
+ {
+ s_op->resp.u.getattr.attr.u.meta.stuffed_size = s_op->ds_attr.b_size;
+ s_op->resp.u.getattr.attr.mask |= PVFS_ATTR_DATA_SIZE;
+ }
+
+ return SM_ACTION_COMPLETE;
}
static PINT_sm_action getattr_setup_resp(
@@ -793,11 +867,16 @@ static PINT_sm_action getattr_cleanup(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int i;
+
if(s_op->val_a)
{
- if(s_op->val_a[NUM_DFILES_KEY].buffer)
+ for(i = 0; i < s_op->keyval_count; ++i)
{
- free(s_op->val_a[NUM_DFILES_KEY].buffer);
+ if(s_op->free_a[i] && s_op->val_a[i].buffer)
+ {
+ free(s_op->val_a[i].buffer);
+ }
}
free(s_op->val_a);
s_op->val_a = NULL;
@@ -807,10 +886,10 @@ static PINT_sm_action getattr_cleanup(
free(s_op->key_a);
s_op->key_a = NULL;
}
- if(s_op->u.getattr.err_array)
+ if(s_op->error_a)
{
- free(s_op->u.getattr.err_array);
- s_op->u.getattr.err_array = NULL;
+ free(s_op->error_a);
+ s_op->error_a = NULL;
}
PINT_free_object_attr(&s_op->resp.u.getattr.attr);
@@ -969,14 +1048,21 @@ static PINT_sm_action getattr_get_dir_hi
js_p->error_code = -PVFS_ENOMEM;
return SM_ACTION_COMPLETE;
}
- s_op->u.getattr.err_array = (PVFS_error*)calloc(NUM_SPECIAL_KEYS,
- sizeof(PVFS_error));
- if(s_op->u.getattr.err_array == NULL)
+ s_op->error_a = (PVFS_error*)calloc(NUM_SPECIAL_KEYS, sizeof(PVFS_error));
+ if(s_op->error_a == NULL)
{
js_p->error_code = -PVFS_ENOMEM;
return SM_ACTION_COMPLETE;
}
+ s_op->free_a = calloc(NUM_SPECIAL_KEYS, sizeof(*s_op->free_a));
+ if(s_op->free_a == NULL)
+ {
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+
+ }
+
for (i = 0; i < NUM_SPECIAL_KEYS; i++)
{
s_op->key_a[i].buffer = Trove_Special_Keys[i].key;
@@ -990,6 +1076,7 @@ static PINT_sm_action getattr_get_dir_hi
return SM_ACTION_COMPLETE;
}
s_op->val_a[i].buffer_sz = 16;
+ s_op->free_a[i] = 1;
}
else if (i == DIST_PARAMS_KEY) {
s_op->val_a[i].buffer = s_op->resp.u.getattr.attr.u.dir.hint.dist_params;
@@ -1002,10 +1089,11 @@ static PINT_sm_action getattr_get_dir_hi
}
js_p->error_code = 0;
+ s_op->keyval_count = NUM_SPECIAL_KEYS;
ret = job_trove_keyval_read_list(
s_op->req->u.getattr.fs_id,
s_op->req->u.getattr.handle,
- s_op->key_a, s_op->val_a, s_op->u.getattr.err_array, NUM_SPECIAL_KEYS,
+ s_op->key_a, s_op->val_a, s_op->error_a, NUM_SPECIAL_KEYS,
0, NULL, smcb, 0, js_p, &tmp_id,
server_job_context);
@@ -1031,7 +1119,7 @@ static PINT_sm_action getattr_interpret_
{
long int dfile_count = 0;
- if (s_op->u.getattr.err_array[DIST_NAME_KEY] == 0)
+ if (s_op->error_a[DIST_NAME_KEY] == 0)
{
gossip_debug(GOSSIP_SERVER_DEBUG,
"val_a[DIST_NAME_KEY] %p read_sz = %d dist_name = %s\n",
@@ -1046,7 +1134,7 @@ static PINT_sm_action getattr_interpret_
s_op->resp.u.getattr.attr.u.dir.hint.dist_name_len = 0;
}
- if (s_op->u.getattr.err_array[DIST_PARAMS_KEY] == 0)
+ if (s_op->error_a[DIST_PARAMS_KEY] == 0)
{
gossip_debug(GOSSIP_SERVER_DEBUG,
"val_a[DIST_PARAMS_KEY] %p read_sz = %d dist_params = %s\n",
@@ -1061,7 +1149,7 @@ static PINT_sm_action getattr_interpret_
s_op->resp.u.getattr.attr.u.dir.hint.dist_params_len = 0;
}
- if (s_op->u.getattr.err_array[NUM_DFILES_KEY] == 0)
+ if (s_op->error_a[NUM_DFILES_KEY] == 0)
{
char *endptr = NULL;
gossip_debug(GOSSIP_SERVER_DEBUG, "val_a[NUM_DFILES_KEY] %p read_sz = %d\n",
@@ -1073,6 +1161,7 @@ static PINT_sm_action getattr_interpret_
dfile_count = 0;
}
free(s_op->val_a[NUM_DFILES_KEY].buffer);
+ s_op->free_a[NUM_DFILES_KEY] = 0;
s_op->val_a[NUM_DFILES_KEY].buffer = NULL;
s_op->val_a[NUM_DFILES_KEY].buffer_sz = 0;
}
@@ -1086,6 +1175,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:
Index: get-config.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-config.sm,v
diff -p -u -r1.38 -r1.38.6.1
--- get-config.sm 30 Aug 2007 00:13:44 -0000 1.38
+++ get-config.sm 21 Feb 2008 02:10:21 -0000 1.38.6.1
@@ -104,6 +104,12 @@ static PINT_sm_action getconfig_cleanup(
return(server_state_machine_complete(smcb));
}
+struct PINT_server_req_params pvfs2_get_config_params =
+{
+ .string_name = "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.19.6.1
--- get-eattr.sm 30 Aug 2007 00:13:44 -0000 1.19
+++ get-eattr.sm 21 Feb 2008 02:10:21 -0000 1.19.6.1
@@ -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.68.6.1
--- io.sm 30 Aug 2007 00:13:44 -0000 1.68
+++ io.sm 21 Feb 2008 02:10:21 -0000 1.68.6.1
@@ -306,13 +306,6 @@ static PINT_sm_action io_cleanup(
PINT_encode_release(&s_op->encoded, PINT_ENCODE_RESP);
}
- /* NOTE: this would happen in final_response nested state machine
- * for most operations, but io.sm is the one state machine which
- * does not use final_response -- decrement reference count for
- * this bmi address
- */
- BMI_set_info(s_op->addr, BMI_DEC_ADDR_REF, NULL);
-
return(server_state_machine_complete(smcb));
}
@@ -385,6 +378,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:
Index: iterate-handles.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/iterate-handles.sm,v
diff -p -u -r1.10 -r1.10.6.1
--- iterate-handles.sm 18 Oct 2007 17:55:05 -0000 1.10
+++ iterate-handles.sm 21 Feb 2008 02:10:21 -0000 1.10.6.1
@@ -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.6.6.1
--- job-timer.sm 30 Aug 2007 00:13:44 -0000 1.6
+++ job-timer.sm 21 Feb 2008 02:10:21 -0000 1.6.6.1
@@ -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.7.6.1
--- list-attr.sm 30 Aug 2007 00:13:44 -0000 1.7
+++ list-attr.sm 21 Feb 2008 02:10:21 -0000 1.7.6.1
@@ -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.12.6.1
--- list-eattr.sm 30 Aug 2007 00:13:44 -0000 1.12
+++ list-eattr.sm 21 Feb 2008 02:10:21 -0000 1.12.6.1
@@ -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.56.6.1
--- lookup.sm 30 Aug 2007 00:13:44 -0000 1.56
+++ lookup.sm 21 Feb 2008 02:10:21 -0000 1.56.6.1
@@ -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.9.6.1
--- mgmt-get-dirdata-handle.sm 30 Aug 2007 00:13:44 -0000 1.9
+++ mgmt-get-dirdata-handle.sm 21 Feb 2008 02:10:21 -0000 1.9.6.1
@@ -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.13.6.1
--- mgmt-remove-dirent.sm 30 Aug 2007 00:13:44 -0000 1.13
+++ mgmt-remove-dirent.sm 21 Feb 2008 02:10:21 -0000 1.13.6.1
@@ -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.13.6.1
--- mgmt-remove-object.sm 30 Aug 2007 00:13:44 -0000 1.13
+++ mgmt-remove-object.sm 21 Feb 2008 02:10:21 -0000 1.13.6.1
@@ -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.50.6.1
--- mkdir.sm 30 Aug 2007 00:13:44 -0000 1.50
+++ mkdir.sm 21 Feb 2008 02:10:21 -0000 1.50.6.1
@@ -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.6.3 -r1.52.6.4
--- module.mk.in 30 Jan 2008 20:26:33 -0000 1.52.6.3
+++ module.mk.in 21 Feb 2008 02:10:21 -0000 1.52.6.4
@@ -10,6 +10,7 @@ ifdef BUILD_SERVER
$(DIR)/lookup.c \
$(DIR)/create.c \
$(DIR)/batch-create.c \
+ $(DIR)/batch-remove.c \
$(DIR)/crdirent.c \
$(DIR)/set-attr.c \
$(DIR)/mkdir.c \
@@ -42,7 +43,6 @@ ifdef BUILD_SERVER
$(DIR)/del-eattr.c \
$(DIR)/list-eattr.c \
$(DIR)/unexpected.c \
- $(DIR)/stuffed-create.c \
$(DIR)/precreate-pool-refiller.c
# c files that should be added to server library
@@ -56,8 +56,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.7.6.1
--- noop.sm 30 Aug 2007 00:13:44 -0000 1.7
+++ noop.sm 21 Feb 2008 02:10:21 -0000 1.7.6.1
@@ -48,6 +48,13 @@ 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,
+ .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.14.6.1
--- perf-mon.sm 30 Aug 2007 00:13:44 -0000 1.14
+++ perf-mon.sm 21 Feb 2008 02:10:21 -0000 1.14.6.1
@@ -312,6 +312,13 @@ 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,
+ .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.11.6.1
--- perf-update.sm 30 Aug 2007 00:13:44 -0000 1.11
+++ perf-update.sm 21 Feb 2008 02:10:21 -0000 1.11.6.1
@@ -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: precreate-pool-refiller.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/Attic/precreate-pool-refiller.sm,v
diff -p -u -r1.1.2.8 -r1.1.2.9
--- precreate-pool-refiller.sm 19 Feb 2008 15:31:59 -0000 1.1.2.8
+++ precreate-pool-refiller.sm 21 Feb 2008 02:10:21 -0000 1.1.2.9
@@ -130,7 +130,7 @@ static PINT_sm_action setup_batch_create
gossip_debug(GOSSIP_SERVER_DEBUG, "setting up msgpair 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);
+ llu(s_op->u.precreate_pool_refiller.pool_handle));
PINT_init_msgpair(s_op, msg_p);
@@ -250,6 +250,12 @@ static int batch_create_comp_fn(void *v_
return 0;
}
+struct PINT_server_req_params pvfs2_precreate_pool_refiller_params =
+{
+ .string_name = "precreate_pool_refiller",
+ .perm = PINT_SERVER_CHECK_INVALID,
+ .state_machine = &pvfs2_precreate_pool_refiller_sm
+};
/*
* Local variables:
Index: prelude.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/prelude.sm,v
diff -p -u -r1.72.2.3 -r1.72.2.4
--- prelude.sm 30 Jan 2008 20:26:33 -0000 1.72.2.3
+++ prelude.sm 21 Feb 2008 02:10:21 -0000 1.72.2.4
@@ -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,13 +111,6 @@ 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
*/
@@ -97,8 +119,11 @@ static PINT_sm_action prelude_req_sched(
{
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->req->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 +139,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 +148,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,146 +173,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_BATCH_CREATE:
- *fsid = req->u.batch_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_STUFFED_CREATE:
- *fsid = req->u.create.fs_id;
- *read_only = 0;
- 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_PRECREATE_POOL_REFILLER:
- 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)
{
@@ -482,7 +350,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;
@@ -501,34 +368,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;
@@ -575,7 +422,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(
@@ -642,7 +489,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)))
{
@@ -763,7 +612,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.7.6.1
--- proto-error.sm 30 Aug 2007 00:13:44 -0000 1.7
+++ proto-error.sm 21 Feb 2008 02:10:21 -0000 1.7.6.1
@@ -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.246.6.8 -r1.246.6.9
--- pvfs2-server.c 18 Feb 2008 19:03:20 -0000 1.246.6.8
+++ pvfs2-server.c 21 Feb 2008 02:10:22 -0000 1.246.6.9
@@ -23,6 +23,8 @@
#include <ucontext.h>
#endif
+#define __PINT_REQPROTO_ENCODE_FUNCS_C
+
#include "bmi.h"
#include "gossip.h"
#include "job.h"
@@ -124,7 +126,9 @@ PINT_server_trove_keys_s Trove_Common_Ke
{DIRECTORY_ENTRY_KEYSTR, DIRECTORY_ENTRY_KEYLEN},
{DATAFILE_HANDLES_KEYSTR, DATAFILE_HANDLES_KEYLEN},
{METAFILE_DIST_KEYSTR, METAFILE_DIST_KEYLEN},
- {SYMLINK_TARGET_KEYSTR, SYMLINK_TARGET_KEYLEN}
+ {SYMLINK_TARGET_KEYSTR, SYMLINK_TARGET_KEYLEN},
+ {METAFILE_LAYOUT_KEYSTR, METAFILE_LAYOUT_KEYLEN},
+ {NUM_DFILES_REQ_KEYSTR, NUM_DFILES_REQ_KEYLEN}
};
/* These three are used continuously in our wait loop. They could be
@@ -169,276 +173,6 @@ static int precreate_pool_count(
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},
-
- /* 35 */
- {PVFS_SERV_BATCH_CREATE,
- "batch_create",
- PINT_SERVER_CHECK_NONE,
- PINT_SERVER_ATTRIBS_REQUIRED,
- &pvfs2_batch_create_sm},
-
- /* 36 */
- {PVFS_SERV_STUFFED_CREATE,
- "stuffed_create",
- PINT_SERVER_CHECK_NONE,
- PINT_SERVER_ATTRIBS_REQUIRED,
- &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)
{
return &server_config;
@@ -1045,7 +779,7 @@ static int server_initialize_subsystems(
break;
}
- ret = PINT_handle_load_mapping(&server_config, cur_fs);
+ ret = PINT_cached_config_handle_load_mapping(cur_fs);
if(ret)
{
PVFS_perror("Error: PINT_handle_load_mapping", ret);
@@ -2029,6 +1763,7 @@ 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;
@@ -2076,7 +1811,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;
@@ -2102,9 +1837,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;
@@ -2116,7 +1848,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,
@@ -2124,7 +1855,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);
@@ -2136,23 +1867,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)
{
char tmp_alias[1024];
@@ -2256,7 +1970,7 @@ static int precreate_pool_initialize(voi
}
/* how many I/O servers do we have? */
- ret = PINT_cached_config_count_servers(&server_config,
+ ret = PINT_cached_config_count_servers(
cur_fs->coll_id, PINT_SERVER_TYPE_IO, &server_count);
if(ret < 0)
{
@@ -2273,7 +1987,7 @@ static int precreate_pool_initialize(voi
/* resolve addrs for each I/O server */
ret = PINT_cached_config_get_server_array(
- &server_config, cur_fs->coll_id, PINT_SERVER_TYPE_IO,
+ cur_fs->coll_id, PINT_SERVER_TYPE_IO,
addr_array, &server_count);
if(ret < 0)
{
@@ -2283,7 +1997,7 @@ static int precreate_pool_initialize(voi
for(i=0; i<server_count; i++)
{
- host = PINT_cached_config_map_addr(&server_config,
+ host = PINT_cached_config_map_addr(
cur_fs->coll_id, addr_array[i], &server_type);
if(!strcmp(host, server_config.host_id) == 0)
{
@@ -2399,7 +2113,7 @@ static int precreate_pool_setup_server(c
gossip_debug(GOSSIP_SERVER_DEBUG, "precreate_pool didn't find handle for %s; creating now.\n", host);
/* find extent array for ourselves */
- ret = PINT_cached_config_get_server(&server_config,
+ ret = PINT_cached_config_get_server(
fsid, server_config.host_id, PINT_SERVER_TYPE_META, &ext_array);
if(ret < 0)
{
@@ -2517,7 +2231,7 @@ static int precreate_pool_launch_refille
return(ret);
}
- ret = PINT_cached_config_get_server(&server_config,
+ ret = PINT_cached_config_get_server(
fsid, host, PINT_SERVER_TYPE_IO,
&s_op->u.precreate_pool_refiller.data_handle_extent_array);
if(ret < 0)
Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.h,v
diff -p -u -r1.147.8.8 -r1.147.8.9
--- pvfs2-server.h 19 Feb 2008 15:31:59 -0000 1.147.8.8
+++ pvfs2-server.h 21 Feb 2008 02:10:23 -0000 1.147.8.9
@@ -83,30 +83,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;
+};
+
+struct PINT_server_req_entry
+{
+ enum PVFS_server_op op_type;
+ struct PINT_server_req_params *params;
};
-extern struct PINT_server_req_params PINT_server_req_table[];
+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);
@@ -126,6 +182,8 @@ enum
METAFILE_HANDLES_KEY = 2,
METAFILE_DIST_KEY = 3,
SYMLINK_TARGET_KEY = 4,
+ METAFILE_LAYOUT_KEY = 5,
+ NUM_DFILES_REQ_KEY = 6
};
/* optional; user-settable keys */
@@ -162,6 +220,12 @@ typedef enum
SERVER_PRECREATE_INIT = (1 << 18),
} PINT_server_status_flag;
+struct PINT_server_create_op
+{
+ const char **io_servers;
+ int num_io_servers;
+};
+
/* struct PINT_server_lookup_op
*
* All the data needed during lookup processing:
@@ -258,6 +322,12 @@ struct PINT_server_batch_create_op
int batch_index;
};
+struct PINT_server_batch_remove_op
+{
+ int handle_index;
+ int error_code;
+};
+
struct PINT_server_mgmt_get_dirdata_op
{
PVFS_handle dirdata_handle;
@@ -307,7 +377,6 @@ struct PINT_server_getattr_op
PVFS_fs_id fs_id;
PVFS_ds_attributes dirdata_ds_attr;
uint32_t attrmask;
- PVFS_error* err_array;
PVFS_ds_keyval_handle_info keyval_handle_info;
PVFS_handle dirent_handle;
};
@@ -350,6 +419,8 @@ typedef struct PINT_server_op
PVFS_ds_keyval *key_a;
PVFS_ds_keyval *val_a;
int *error_a;
+ int *free_a;
+ int keyval_count;
int free_val;
@@ -388,9 +459,13 @@ 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 */
+ struct PINT_server_create_op create;
struct PINT_server_eattr_op eattr;
struct PINT_server_getattr_op getattr;
struct PINT_server_listattr_op listattr;
@@ -411,6 +486,7 @@ typedef struct PINT_server_op
struct PINT_server_precreate_pool_refiller_op
precreate_pool_refiller;
struct PINT_server_batch_create_op batch_create;
+ struct PINT_server_batch_remove_op batch_remove;
} u;
} PINT_server_op;
@@ -432,54 +508,15 @@ 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_batch_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;
-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;
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);
@@ -505,7 +542,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.51.6.1
--- readdir.sm 30 Aug 2007 00:13:44 -0000 1.51
+++ readdir.sm 21 Feb 2008 02:10:23 -0000 1.51.6.1
@@ -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.59.2.1
--- remove.sm 7 Dec 2007 23:08:46 -0000 1.59
+++ remove.sm 21 Feb 2008 02:10:23 -0000 1.59.2.1
@@ -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.55.6.1
--- rmdirent.sm 30 Aug 2007 00:13:44 -0000 1.55
+++ rmdirent.sm 21 Feb 2008 02:10:23 -0000 1.55.6.1
@@ -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.72.6.1
--- set-attr.sm 30 Aug 2007 00:13:44 -0000 1.72
+++ set-attr.sm 21 Feb 2008 02:10:23 -0000 1.72.6.1
@@ -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.19.6.1
--- set-eattr.sm 30 Aug 2007 00:13:44 -0000 1.19
+++ set-eattr.sm 21 Feb 2008 02:10:23 -0000 1.19.6.1
@@ -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.6.2 -r1.33.6.3
--- setparam.sm 12 Feb 2008 15:06:12 -0000 1.33.6.2
+++ setparam.sm 21 Feb 2008 02:10:23 -0000 1.33.6.3
@@ -16,6 +16,7 @@
#include "pint-event.h"
#include "pvfs2-internal.h"
#include "pint-cached-config.h"
+#include "request-scheduler/request-scheduler.h"
static int check_fs_id(PVFS_fs_id fs_id);
@@ -71,7 +72,6 @@ static PINT_sm_action setparam_work(
struct server_configuration_s *user_opts;
struct filesystem_configuration_s *fs_conf;
char buf[16] = {0};
- int i;
/* these are temporary */
int test_precreate_count = 0;
@@ -163,9 +163,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;
case PVFS_SERV_PARAM_TEST_PRECREATE:
user_opts = get_server_config_struct();
s_op->resp.u.mgmt_setparam.old_value = 0;
@@ -175,7 +180,6 @@ static PINT_sm_action setparam_work(
/* count how many I/O servers are in the file system */
ret = PINT_cached_config_count_servers(
- user_opts,
s_op->req->u.mgmt_setparam.fs_id,
PINT_SERVER_TYPE_IO,
&test_precreate_count);
@@ -314,6 +318,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.19.6.1
--- small-io.sm 30 Aug 2007 00:13:45 -0000 1.19
+++ small-io.sm 21 Feb 2008 02:10:23 -0000 1.19.6.1
@@ -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.16.6.1
--- statfs.sm 30 Aug 2007 00:13:45 -0000 1.16
+++ statfs.sm 21 Feb 2008 02:10:23 -0000 1.16.6.1
@@ -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: stuffed-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/Attic/stuffed-create.sm,v
diff -p -u -r1.1.2.1 -r1.1.2.2
--- stuffed-create.sm 24 Jan 2008 21:34:41 -0000 1.1.2.1
+++ stuffed-create.sm 21 Feb 2008 02:10:23 -0000 1.1.2.2
@@ -14,9 +14,15 @@
#include "pvfs2-internal.h"
#include "pint-util.h"
+static int PINT_get_server_list(
+ struct PVFS_servreq_stuffed_create *screate,
+ PVFS_sys_layout *layout,
+ PVFS_BMI_addr_t **addrs,
+ int *server_count);
+
%%
-machine pvfs2_stuffed_create_sm
+machine pvfs2_create_sm
{
state prelude
{
@@ -28,13 +34,28 @@ machine pvfs2_stuffed_create_sm
state create_metafile
{
run create_metafile;
- success => create_datafile;
+ success => check_stuffed;
+ default => final_response;
+ }
+
+ state check_stuffed
+ {
+ run check_stuffed;
+ DO_STUFFED_CREATE => create_stuffed_datafile;
+ success => request_datafiles;
default => final_response;
}
- state create_datafile
+ state create_stuffed_datafile
{
- run create_datafile;
+ run create_stuffed_datafile;
+ success => setup_stuffed_datafile_handle;
+ default => remove_metafile_object;
+ }
+
+ state setup_stuffed_datafile_handle
+ {
+ run setup_stuffed_datafile_handle;
success => write_keyvals;
default => remove_metafile_object;
}
@@ -43,7 +64,7 @@ machine pvfs2_stuffed_create_sm
{
run write_keyvals;
success => setobj_attrib;
- default => remove_datafile_object;
+ default => remove_datafile_handles;
}
state setobj_attrib
@@ -59,9 +80,9 @@ machine pvfs2_stuffed_create_sm
default => final_response;
}
- state remove_datafile_object
+ state remove_datafile_handles
{
- run remove_datafile_object;
+ run remove_datafile_handles;
success => remove_metafile_object;
default => final_response;
}
@@ -75,7 +96,7 @@ machine pvfs2_stuffed_create_sm
state remove_keyvals
{
run remove_keyvals;
- success => remove_datafile_object;
+ success => remove_datafile_handles;
default => final_response;
}
@@ -102,8 +123,8 @@ static int create_metafile(
job_id_t i;
ret = job_trove_dspace_create(
- s_op->req->u.stuffed_create.fs_id,
- &s_op->req->u.stuffed_create.metafile_handle_extent_array,
+ s_op->req->u.create.fs_id,
+ &s_op->req->u.create.metafile_handle_extent_array,
PVFS_TYPE_METAFILE,
NULL,
0,
@@ -116,7 +137,66 @@ static int create_metafile(
return(ret);
}
-static int create_datafile(
+static int check_stuffed(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int server_type;
+ server_configuration_s *config = get_server_config_struct();
+ PVFS_BMI_addr_t myaddr;
+ PVFS_sys_layout *layout;
+ PVFS_BMI_addr_t server_addrs;
+ int num_io_servers, i;
+
+ layout = &s_op->req->u.create.layout;
+
+ assert(config);
+ ret = BMI_addr_lookup(config->server_alias, &myaddr);
+ if(ret != 0)
+ {
+ /* we can't get our own address? */
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ if(layout->algorithm != PVFS_SYS_LAYOUT_LIST)
+ {
+ /* is this metadata server also IO? */
+ PINT_cached_config_map_addr(s_op->req->u.create.fs_id,
+ myaddr, &server_type);
+ if(server_type == PVFS_SERVER_TYPE_IO)
+ {
+ js_p->error_code = DO_STUFFED_CREATE;
+ ret = PINT_get_server_list(&s_op->req->u.create,
+ layout,
+ &server_addrs,
+ &num_io_servers);
+ if(ret < 0)
+ {
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
+ }
+
+ for(i = 0; i < num_io_servers; ++i)
+ {
+ if(server_addrs[i] == myaddr)
+ {
+ /* shift all the addresses down by one up to this */
+ server_addrs = memmove(server_addrs, &server_addrs[1], i);
+ server_addrs[0] = myaddr;
+ }
+ break;
+ }
+ }
+ }
+
+ s_op->u.create.io_server_addrs = server_addrs;
+ s_op->u.create.io_server_count = num_io_servers;
+
+ return SM_ACTION_COMPLETE;
+}
+
+static int create_stuffed_datafile(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
@@ -128,12 +208,12 @@ static int create_datafile(
gossip_debug(
GOSSIP_SERVER_DEBUG, "Stuffed metafile handle created: %llu\n",
llu(js_p->handle));
- s_op->resp.u.stuffed_create.metafile_handle = js_p->handle;
+ s_op->resp.u.create.metafile_handle = js_p->handle;
/* now create the datafile handle */
ret = job_trove_dspace_create(
- s_op->req->u.stuffed_create.fs_id,
- &s_op->req->u.stuffed_create.datafile_handle_extent_array,
+ s_op->req->u.create.fs_id,
+ &s_op->req->u.create.datafile_handle_extent_array,
PVFS_TYPE_DATAFILE,
NULL,
TROVE_SYNC,
@@ -146,6 +226,26 @@ static int create_datafile(
return(ret);
}
+static PINT_sm_action request_datafiles(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ ret = job_precreate_pool_get_handles(
+ s_op->req->u.create.fs_id,
+ count,
+ servers,
+ s_op->resp->u.create.datafile_handles,
+ smcb,
+ 0,
+ js_p,
+ &j_id,
+ server_job_context);
+ return ret;
+}
+
static PINT_sm_action remove_metafile_object(
struct PINT_smcb *smcb, job_status_s *js_p)
{
@@ -153,9 +253,11 @@ static PINT_sm_action remove_metafile_ob
int ret = -1;
job_id_t j_id;
+ free(s_op->resp.u.create.datafile_handles);
+
ret = job_trove_dspace_remove(
- s_op->req->u.stuffed_create.fs_id,
- s_op->resp.u.stuffed_create.metafile_handle,
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
0,
smcb,
0,
@@ -165,16 +267,17 @@ static PINT_sm_action remove_metafile_ob
return ret;
}
-static PINT_sm_action remove_datafile_object(
+static PINT_sm_action remove_datafile_handles(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -1;
job_id_t j_id;
- ret = job_trove_dspace_remove(
- s_op->req->u.stuffed_create.fs_id,
- s_op->resp.u.stuffed_create.datafile_handle,
+ ret = job_trove_dspace_remove_list(
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.datafile_count,
+ s_op->resp.u.create.datafile_handles,
0,
smcb,
0,
@@ -193,35 +296,56 @@ static PINT_sm_action remove_keyvals(
/* the keyval keys and vals should still be valid here */
ret = job_trove_keyval_remove_list(
- s_op->req->u.stuffed_create.fs_id,
- s_op->resp.u.stuffed_create.metafile_handle,
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
s_op->key_a, s_op->val_a, s_op->error_a,
2, TROVE_SYNC, NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static PINT_sm_action write_keyvals(
+static PINT_sm_action setup_stuffed_datafile_handle(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -1;
job_id_t j_id;
+ PVFS_handle *harray;
- assert(js_p->error_code == 0);
gossip_debug(
GOSSIP_SERVER_DEBUG, "Stuffed metafile handle created: %llu\n",
llu(js_p->handle));
- s_op->resp.u.stuffed_create.datafile_handle = js_p->handle;
+ assert(js_p->error_code == 0);
- s_op->key_a = malloc(sizeof(PVFS_ds_keyval) * 2);
+ harray = malloc(sizeof(PVFS_handle));
+ if(!harray)
+ {
+ js_p->error_code = -PVFS_ENOMEM;
+ return SM_ACTION_COMPLETE;
+ }
+
+ harray[0] = js_p->handle;
+
+ s_op->resp.u.create.datafile_handles = harray;
+ s_op->resp.u.create.datafile_count = 1;
+ return SM_ACTION_COMPLETE;
+}
+
+static PINT_sm_action write_keyvals(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ int ret = -1;
+ job_id_t j_id;
+
+ s_op->key_a = malloc(sizeof(PVFS_ds_keyval) * 3);
if(!s_op->key_a)
{
js_p->error_code = -PVFS_ENOMEM;
return SM_ACTION_COMPLETE;
}
- s_op->val_a = malloc(sizeof(PVFS_ds_keyval) * 2);
+ s_op->val_a = malloc(sizeof(PVFS_ds_keyval) * 3);
if(!s_op->val_a)
{
free(s_op->key_a);
@@ -232,13 +356,15 @@ static PINT_sm_action write_keyvals(
s_op->key_a[0].buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
s_op->key_a[0].buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size;
- s_op->val_a[0].buffer = &s_op->resp.u.stuffed_create.datafile_handle;
- s_op->val_a[0].buffer_sz = sizeof(PVFS_handle);
+ s_op->val_a[0].buffer = s_op->resp.u.create.datafile_handles;
+ s_op->val_a[0].buffer_sz =
+ s_op->resp.u.create.datafile_count * sizeof(PVFS_handle);
s_op->key_a[1].buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
s_op->key_a[1].buffer_sz = Trove_Common_Keys[METAFILE_DIST_KEY].size;
- s_op->val_a[1].buffer_sz = s_op->req->u.stuffed_create.attr.u.meta.dist_size;
+ s_op->val_a[1].buffer_sz =
+ s_op->req->u.create.attr.u.meta.dist_size;
s_op->val_a[1].buffer = malloc(s_op->val_a[1].buffer_sz);
if(!s_op->val_a[1].buffer)
{
@@ -246,12 +372,21 @@ static PINT_sm_action write_keyvals(
return SM_ACTION_COMPLETE;
}
PINT_dist_encode(s_op->val_a[1].buffer,
- s_op->req->u.stuffed_create.attr.u.meta.dist);
+ s_op->req->u.create.attr.u.meta.dist);
+
+ s_op->key_a[2].buffer = Trove_Common_Keys[METAFILE_LAYOUT_KEY].key;
+ s_op->key_a[2].buffer_sz = Trove_Common_Keys[METAFILE_LAYOUT_KEY].size;
+
+ s_op->val_a[2].buffer =
+ &s_op->req->u.create.layout.algorithm;
+ s_op->val_a[2].buffer_sz =
+ sizeof(s_op->req->u.create.layout.algorithm);
job_trove_keyval_write_list(
- s_op->req->u.stuffed_create.fs_id, s_op->resp.u.stuffed_create.metafile_handle,
+ s_op->req->u.create.fs_id,
+ s_op->resp.u.create.metafile_handle,
s_op->key_a, s_op->val_a,
- 2, TROVE_SYNC, NULL, smcb, 0, js_p, &j_id, server_job_context);
+ 3, TROVE_SYNC, NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
@@ -266,7 +401,7 @@ static PINT_sm_action setattr_setobj_att
PVFS_object_attr *dspace_a_p = NULL;
PVFS_ds_attributes *ds_attr = NULL;
- a_p = &s_op->req->u.stuffed_create.attr;
+ a_p = &s_op->req->u.create.attr;
/*
* Remember that mtime is versioned on disk! so convert it here..
@@ -306,7 +441,7 @@ static PINT_sm_action setattr_setobj_att
PVFS_object_attr_to_ds_attr(dspace_a_p, ds_attr);
ret = job_trove_dspace_setattr(
- s_op->req->u.stuffed_create.fs_id, s_op->resp.u.stuffed_create.metafile_handle,
+ s_op->req->u.create.fs_id, s_op->resp.u.stuffed_create.metafile_handle,
ds_attr,
TROVE_SYNC,
smcb, 0, js_p, &j_id, server_job_context);
@@ -321,10 +456,10 @@ static int setup_resp(
if (js_p->error_code == 0)
{
PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "stuffed_create: new metadata handle: %llu, "
+ "create: new metadata handle: %llu, "
"new datafile handle: %llu.\n",
- llu(s_op->resp.u.stuffed_create.metafile_handle),
- llu(s_op->resp.u.stuffed_create.datafile_handle));
+ llu(s_op->resp.u.create.metafile_handle),
+ llu(s_op->resp.u.create.datafile_handle));
}
return SM_ACTION_COMPLETE;
@@ -366,6 +501,67 @@ static int cleanup(
return(server_state_machine_complete(smcb));
}
+
+static int PINT_get_server_list(
+ struct PVFS_servreq_create *screate,
+ PVFS_sys_layout *layout,
+ PVFS_BMI_addr_t **addrs,
+ int *server_count)
+{
+ int num_io_servers, ret;
+ PVFS_BMI_addr_t *server_addrs;
+
+ /* find the server list from the layout */
+ ret = PINT_cached_config_get_num_dfiles(
+ screate->fs_id,
+ screate->attr.dist,
+ screate->num_dfiles_req,
+ &num_io_servers);
+ if (ret < 0)
+ {
+ gossip_err("Failed to get number of data servers\n");
+ return ret;
+ }
+
+ if(num_io_servers > PVFS_REQ_LIMIT_DFILE_COUNT)
+ {
+ num_io_servers = PVFS_REQ_LIMIT_DFILE_COUNT;
+ gossip_err("Warning: reducing number of data "
+ "files to PVFS_REQ_LIMIT_DFILE_COUNT\n");
+ }
+
+ server_addrs = malloc(sizeof(*server_addrs) * num_io_servers);
+ if(!server_addrs)
+ {
+ gossip_err("Failed to allocate server address list\n");
+ return -PVFS_ENOMEM;
+ }
+
+ ret = PINT_cached_config_map_servers(
+ s_op->req->u.create.fs_id,
+ &num_io_servers,
+ layout,
+ server_addrs,
+ NULL);
+ if(ret != 0)
+ {
+ gossip_err("Failed to get IO server addrs from layout\n");
+ return ret;
+ }
+
+ server_count = num_io_servers;
+ *addrs = server_addrs;
+
+return 0;
+}
+
+struct PINT_server_req_params pvfs2_create_params =
+{
+ .string_name = "create",
+ .perm = PINT_SERVER_CHECK_NONE,
+ .access_type = PINT_server_req_modify,
+ .state_machine = &pvfs2_create_sm
+};
/*
* Local variables:
Index: truncate.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/truncate.sm,v
diff -p -u -r1.8 -r1.8.6.1
--- truncate.sm 30 Aug 2007 00:13:45 -0000 1.8
+++ truncate.sm 21 Feb 2008 02:10:23 -0000 1.8.6.1
@@ -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.3.6.1
--- unexpected.sm 30 Aug 2007 00:13:45 -0000 1.3
+++ unexpected.sm 21 Feb 2008 02:10:23 -0000 1.3.6.1
@@ -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