[Pvfs2-cvs] commit by slang in pvfs2/src/server: unexpected.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 prelude.sm proto-error.sm
pvfs2-server.c pvfs2-server.h readdir.sm remove.sm
rmdirent.sm set-attr.sm set-eattr.sm setparam.sm small-io.sm
statfs.sm truncate.sm
CVS commit program
cvs at parl.clemson.edu
Fri Apr 13 01:14:31 EDT 2007
Update of /projects/cvsroot/pvfs2/src/server
In directory parlweb1:/tmp/cvs-serv14013/src/server
Modified Files:
chdirent.sm crdirent.sm create.sm del-eattr.sm event-mon.sm
final-response.sm flush.sm get-attr.sm get-config.sm
get-eattr.sm io.sm iterate-handles.sm job-timer.sm
list-attr.sm list-eattr.sm lookup.sm
mgmt-get-dirdata-handle.sm mgmt-remove-dirent.sm
mgmt-remove-object.sm mkdir.sm module.mk.in noop.sm
perf-mon.sm perf-update.sm prelude.sm proto-error.sm
pvfs2-server.c pvfs2-server.h readdir.sm remove.sm rmdirent.sm
set-attr.sm set-eattr.sm setparam.sm small-io.sm statfs.sm
truncate.sm
Added Files:
unexpected.sm
Log Message:
merge of the WALT3 branch to HEAD. This patch changes the way state actions
are represented as C structures (what statecomp generates). It also changes
the main state action parameter from a s_op on the server or an sm_p on the client
to a unified smcb pointer (state machine control block) for all state actions (both client and server). Finally, initial support for concurrent state machines has
been added to allow state actions to be invoked concurrently .. a first step for
server-to-server.
Index: chdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/chdirent.sm,v
diff -p -u -r1.16 -r1.17
--- chdirent.sm 17 Feb 2007 21:16:47 -0000 1.16
+++ chdirent.sm 13 Apr 2007 05:14:30 -0000 1.17
@@ -19,24 +19,24 @@ enum
UPDATE_DIR_ATTR_REQUIRED = 135
};
-static int chdirent_verify_parent_metadata_and_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_change_directory_entry(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p);
-static int chdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p);
-static int chdirent_read_directory_entry(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_read_directory_entry_failure(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_change_directory_entry_failure(
- PINT_server_op *s_op, job_status_s* js_p);
-static int chdirent_setup_resp(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action chdirent_verify_parent_metadata_and_read_directory_entry_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_change_directory_entry(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_check_for_req_dir_update(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_update_directory_attr(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_read_directory_entry(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_read_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_change_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action chdirent_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -116,9 +116,10 @@ machine pvfs2_chdirent_sm
%%
-static int chdirent_verify_parent_metadata_and_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action chdirent_verify_parent_metadata_and_read_directory_entry_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 = -PVFS_EINVAL;
job_id_t i;
@@ -146,7 +147,7 @@ static int chdirent_verify_parent_metada
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -155,9 +156,10 @@ static int chdirent_verify_parent_metada
return ret;
}
-static int chdirent_read_directory_entry(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action chdirent_read_directory_entry(
+ 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 j_id;
@@ -178,7 +180,7 @@ static int chdirent_read_directory_entry
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -187,8 +189,8 @@ static int chdirent_read_directory_entry
return ret;
}
-static int chdirent_read_directory_entry_failure(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action chdirent_read_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
switch (js_p->error_code)
{
@@ -200,12 +202,13 @@ static int chdirent_read_directory_entry
"unexpected error %d\n", js_p->error_code);
break;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int chdirent_change_directory_entry(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action chdirent_change_directory_entry(
+ 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 j_id;
@@ -238,26 +241,28 @@ static int chdirent_change_directory_ent
&s_op->key, &s_op->val,
TROVE_SYNC |
0,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
s_op->u.chdirent.dir_attr_update_required = 1;
return ret;
}
-static int chdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action chdirent_check_for_req_dir_update(
+ 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->u.chdirent.dir_attr_update_required))
{
js_p->error_code = UPDATE_DIR_ATTR_REQUIRED;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int chdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action chdirent_update_directory_attr(
+ 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 tmp_attr, *tmp_attr_ptr = &tmp_attr;
@@ -268,7 +273,7 @@ static int chdirent_update_directory_att
{
PVFS_perror_gossip("previous keyval write failed",
js_p->error_code);
- return 1;
+ return SM_ACTION_COMPLETE;
}
memset(&tmp_attr, 0, sizeof(PVFS_object_attr));
@@ -284,13 +289,13 @@ static int chdirent_update_directory_att
ds_attr,
TROVE_SYNC |
0,
- s_op, 0, js_p, &j_id, server_job_context);
+ smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int chdirent_change_directory_entry_failure(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action chdirent_change_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
assert(js_p->error_code != -TROVE_ENOENT);
@@ -303,12 +308,13 @@ static int chdirent_change_directory_ent
break;
}
gossip_err("unexpected error %d\n", js_p->error_code);
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int chdirent_setup_resp(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action chdirent_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)
{
/* return original dirent handle in the response */
@@ -323,13 +329,13 @@ static int chdirent_setup_resp(PINT_serv
{
gossip_debug(GOSSIP_SERVER_DEBUG, " sending error response\n");
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int chdirent_cleanup(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action chdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return (server_state_machine_complete(smcb));
}
/*
Index: crdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/crdirent.sm,v
diff -p -u -r1.66 -r1.67
--- crdirent.sm 17 Feb 2007 21:16:47 -0000 1.66
+++ crdirent.sm 13 Apr 2007 05:14:30 -0000 1.67
@@ -20,22 +20,22 @@ enum
UPDATE_DIR_ATTR_REQUIRED
};
-static int crdirent_setup_op(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_validate(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_write_directory_entry(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p);
-static int crdirent_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int validation_object_type_failure(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action crdirent_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_validate(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_read_directory_entry_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_write_directory_entry(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_check_for_req_dir_update(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_update_directory_attr(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action crdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action validation_object_type_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -115,16 +115,17 @@ machine pvfs2_crdirent_sm
*
* Synopsis: verifies that entry name and object type is valid
*/
-static int crdirent_validate(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action crdirent_validate(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
char *ptr = NULL;
if ((s_op->u.crdirent.name == NULL) ||
(s_op->u.crdirent.parent_handle == PVFS_HANDLE_NULL))
{
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_SERVER_DEBUG,
@@ -150,7 +151,7 @@ static int crdirent_validate(PINT_server
/* Do not zero the scheduled_id, as this operation was
* scheduled before we checked the filename */
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* make sure we're dealing with a directory */
@@ -161,11 +162,11 @@ static int crdirent_validate(PINT_server
"a non-directory! Returning error.\n");
js_p->error_code = INVALID_OBJECT;
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -192,9 +193,10 @@ static int crdirent_validate(PINT_server
* space and if it does not exist, we need to create it.
*
*/
-static int crdirent_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action crdirent_read_directory_entry_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 = -PVFS_EINVAL;
job_id_t i;
@@ -213,7 +215,7 @@ static int crdirent_read_directory_entry
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -222,14 +224,14 @@ static int crdirent_read_directory_entry
return ret;
}
-static int validation_object_type_failure(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action validation_object_type_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_debug(GOSSIP_SERVER_DEBUG, "crdirent: validation_object_"
"type_failure called\n");
js_p->error_code = -PVFS_ENOTDIR;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -249,9 +251,10 @@ static int validation_object_type_failur
* Synopsis: We are now ready to store the name/handle pair in the k/v
* space for directory handles.
*/
-static int crdirent_write_directory_entry(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action crdirent_write_directory_entry(
+ 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;
TROVE_ds_flags keyval_flags;
@@ -293,7 +296,7 @@ static int crdirent_write_directory_entr
s_op->u.crdirent.fs_id, s_op->u.crdirent.dirent_handle,
&s_op->key, &s_op->val,
keyval_flags,
- NULL, s_op, 0, js_p, &i, server_job_context);
+ NULL, smcb, 0, js_p, &i, server_job_context);
/*
* creating an entry will cause directory times to be updated.
@@ -302,20 +305,22 @@ static int crdirent_write_directory_entr
return ret;
}
-static int crdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action crdirent_check_for_req_dir_update(
+ 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->u.crdirent.dir_attr_update_required))
{
js_p->error_code = UPDATE_DIR_ATTR_REQUIRED;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int crdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action crdirent_update_directory_attr(
+ 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 tmp_attr, *tmp_attr_ptr = &tmp_attr;
@@ -326,7 +331,7 @@ static int crdirent_update_directory_att
{
PVFS_perror_gossip("previous keyval write failed",
js_p->error_code);
- return 1;
+ return SM_ACTION_COMPLETE;
}
memset(&tmp_attr, 0, sizeof(PVFS_object_attr));
@@ -341,15 +346,15 @@ static int crdirent_update_directory_att
s_op->req->u.crdirent.fs_id, s_op->req->u.crdirent.parent_handle,
ds_attr,
TROVE_SYNC,
- s_op, 0, js_p, &j_id, server_job_context);
+ smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int crdirent_cleanup(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action crdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* crdirent_setup_op()
@@ -358,13 +363,12 @@ static int crdirent_cleanup(PINT_server_
* storing request structure fields in state machine so that nested
* machines are not dependent on request type
*/
-static int crdirent_setup_op(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action crdirent_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG,
- "crdirent entry: %s points to %llu\n",
- s_op->req->u.crdirent.name,
- llu(s_op->req->u.crdirent.new_handle));
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_ACCESS_DEBUG(s_op, GOSSIP_ACCESS_DEBUG, "crdirent entry: %s points to %llu\n",
+ s_op->req->u.crdirent.name, llu(s_op->req->u.crdirent.new_handle));
s_op->u.crdirent.name = s_op->req->u.crdirent.name;
s_op->u.crdirent.new_handle = s_op->req->u.crdirent.new_handle;
@@ -373,7 +377,7 @@ static int crdirent_setup_op(
s_op->u.crdirent.dir_attr_update_required = 0;
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
Index: create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/create.sm,v
diff -p -u -r1.44 -r1.45
--- create.sm 17 Feb 2007 21:16:47 -0000 1.44
+++ create.sm 13 Apr 2007 05:14:30 -0000 1.45
@@ -13,12 +13,12 @@
#include "gossip.h"
#include "pvfs2-internal.h"
-static int create_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int create_create(
- PINT_server_op *s_op, job_status_s* js_p);
-static int create_setup_resp(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action create_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action create_create(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action create_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -73,8 +73,10 @@ machine pvfs2_create_sm
* Synopsis: Create the new dataspace with the values provided in the response.
*
*/
-static int create_create(PINT_server_op *s_op, job_status_s* js_p)
+static int create_create(
+ 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;
@@ -84,7 +86,7 @@ static int create_create(PINT_server_op
s_op->req->u.create.object_type,
NULL,
TROVE_SYNC ,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -97,8 +99,10 @@ static int create_create(PINT_server_op
*
* fills in the response structure based on results of previous operation
*/
-static int create_setup_resp(PINT_server_op *s_op, job_status_s* js_p)
+static int create_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)
{
gossip_debug(GOSSIP_SERVER_DEBUG, "Handle created: %llu\n",
@@ -136,7 +140,7 @@ static int create_setup_resp(PINT_server
/* NOTE: we _deliberately_ leave the error_code unchanged so that it
* can be used by the next state.
*/
- return(1);
+ return SM_ACTION_COMPLETE;
}
@@ -155,9 +159,10 @@ static int create_setup_resp(PINT_server
* Synopsis: free memory and return
*
*/
-static int create_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static int create_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
Index: del-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/del-eattr.sm,v
diff -p -u -r1.11 -r1.12
--- del-eattr.sm 17 Feb 2007 21:16:47 -0000 1.11
+++ del-eattr.sm 13 Apr 2007 05:14:30 -0000 1.12
@@ -14,12 +14,12 @@
#include "pvfs2-util.h"
#include "pint-util.h"
-static int deleattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int deleattr_delobj_eattribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int deleattr_verify_eattribs(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action deleattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action deleattr_delobj_eattribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action deleattr_verify_eattribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -67,9 +67,10 @@ machine pvfs2_del_eattr_sm
* extended attributes on certain object types if we want. We might
* want to prevent access to standard metadata keys.
*/
-static int deleattr_verify_eattribs(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action deleattr_verify_eattribs(
+ 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 *a_p = NULL;
a_p = &s_op->attr;
@@ -130,15 +131,17 @@ static int deleattr_verify_eattribs(
return -PVFS_EINVAL;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
* This is where the actual extended attrib gets written.
* Not much to this, its pretty straight-forward.
*/
-static int deleattr_delobj_eattribs(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action deleattr_delobj_eattribs(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = 0;
job_id_t j_id;
@@ -166,7 +169,7 @@ static int deleattr_delobj_eattribs(PINT
NULL,
TROVE_SYNC ,
NULL,
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -186,14 +189,16 @@ static int deleattr_delobj_eattribs(PINT
* Synopsis: free memory and return
*
*/
-static int deleattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action deleattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(
GOSSIP_DELEATTR_DEBUG,
"keybuf %p keylen %d\n",
s_op->req->u.deleattr.key.buffer, s_op->req->u.deleattr.key.buffer_sz);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: event-mon.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/event-mon.sm,v
diff -p -u -r1.6 -r1.7
--- event-mon.sm 17 Feb 2007 21:16:47 -0000 1.6
+++ event-mon.sm 13 Apr 2007 05:14:30 -0000 1.7
@@ -14,8 +14,10 @@
#include "pvfs2-server.h"
#include "pint-event.h"
-static int event_mon_cleanup(PINT_server_op *s_op, job_status_s* js_p);
-static int event_mon_do_work(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action event_mon_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action event_mon_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -53,20 +55,24 @@ machine pvfs2_event_mon_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int event_mon_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action event_mon_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->resp.u.mgmt_event_mon.event_array)
free(s_op->resp.u.mgmt_event_mon.event_array);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* event_mon_do_work()
*
* gathers statistics and builds response
*/
-static int event_mon_do_work(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action event_mon_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
/* allocate memory to hold events */
s_op->resp.u.mgmt_event_mon.event_array
= (struct PVFS_mgmt_event*)malloc(s_op->req->u.mgmt_event_mon.event_count
@@ -74,7 +80,7 @@ static int event_mon_do_work(PINT_server
if(!s_op->resp.u.mgmt_event_mon.event_array)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.mgmt_event_mon.event_count =
@@ -85,7 +91,7 @@ static int event_mon_do_work(PINT_server
s_op->req->u.mgmt_event_mon.event_count);
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
Index: final-response.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/final-response.sm,v
diff -p -u -r1.34 -r1.35
--- final-response.sm 17 Feb 2007 21:16:47 -0000 1.34
+++ final-response.sm 13 Apr 2007 05:14:30 -0000 1.35
@@ -29,12 +29,12 @@
* stored in s_op->scheduled_id
*/
-static int final_response_release(
- PINT_server_op *s_op, job_status_s *js_p);
-static int final_response_send_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int final_response_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action final_response_release(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action final_response_send_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action final_response_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
static void PINT_gossip_err_server_resp(
struct PVFS_server_resp *resp);
@@ -68,15 +68,16 @@ nested machine pvfs2_final_response_sm
*
* releases the operation from the request scheduler
*/
-static int final_response_release(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action final_response_release(
+ 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 tmp_id;
gossip_debug(GOSSIP_SERVER_DEBUG,
- "(%p) %s (FR sm) state: release: (error_code = %d)\n", s_op,
- PINT_map_server_op_to_string(s_op->req->op),
+ "(s_op %p) %s (FR sm) state: release: (error_code = %d)\n",
+ s_op, PINT_map_server_op_to_string(s_op->req->op),
js_p->error_code);
/* this seems a little odd, but since this is the first state of the
@@ -92,11 +93,11 @@ static int final_response_release(
if (!s_op->scheduled_id)
{
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
ret = job_req_sched_release(
- s_op->scheduled_id, s_op, 0, js_p, &tmp_id, server_job_context);
+ s_op->scheduled_id, smcb, 0, js_p, &tmp_id, server_job_context);
PINT_perf_count(PINT_server_pc, PINT_PERF_REQSCHED, 1, PINT_PERF_SUB);
@@ -107,18 +108,18 @@ static int final_response_release(
*
* encodes and sends a response to the client
*/
-static int final_response_send_resp(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action final_response_send_resp(
+ 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 tmp_id;
struct server_configuration_s *user_opts = get_server_config_struct();
gossip_debug(
GOSSIP_SERVER_DEBUG,
- "(%p) %s (FR sm) state: send_resp (status = %d)\n",
- s_op,
- PINT_map_server_op_to_string(s_op->req->op),
+ "(s_op %p) %s (FR sm) state: send_resp (status = %d)\n",
+ s_op, PINT_map_server_op_to_string(s_op->req->op),
s_op->resp.status);
if (js_p->error_code != 0)
@@ -134,14 +135,14 @@ static int final_response_send_resp(
PINT_gossip_err_server_resp(&s_op->resp);
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* send the response */
ret = job_bmi_send_list(
s_op->addr, s_op->encoded.buffer_list, s_op->encoded.size_list,
s_op->encoded.list_count, s_op->encoded.total_size, s_op->tag,
- s_op->encoded.buffer_type, 0, s_op, 0, js_p, &tmp_id,
+ s_op->encoded.buffer_type, 0, smcb, 0, js_p, &tmp_id,
server_job_context, user_opts->server_job_bmi_timeout);
return ret;
@@ -153,12 +154,14 @@ static int final_response_send_resp(
* cleans up resources allocated while in this nested machine. Right now
* that just means releasing the encoding of the response
*/
-static int final_response_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action final_response_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
char status_string[64] = {0};
gossip_debug(GOSSIP_SERVER_DEBUG,
- "(%p) %s (FR sm) state: cleanup\n",
+ "(s_op %p) %s (FR sm) state: cleanup\n",
s_op, PINT_map_server_op_to_string(s_op->req->op));
PVFS_strerror_r(s_op->resp.status, status_string, 64);
@@ -170,7 +173,7 @@ static int final_response_cleanup(PINT_s
BMI_set_info(s_op->addr, BMI_DEC_ADDR_REF, NULL);
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
Index: flush.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/flush.sm,v
diff -p -u -r1.20 -r1.21
--- flush.sm 17 Feb 2007 21:16:47 -0000 1.20
+++ flush.sm 13 Apr 2007 05:14:30 -0000 1.21
@@ -25,16 +25,16 @@ enum
FLUSH_BSTREAM = 5
};
-static int flush_check_type(
- PINT_server_op *s_op, job_status_s * js_p);
-static int flush_keyval_flush(
- PINT_server_op *s_op, job_status_s * js_p);
-static int flush_bstream_flush(
- PINT_server_op *s_op, job_status_s * js_p);
-static int flush_cleanup(
- PINT_server_op *s_op, job_status_s *ret);
-static int flush_check_error(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action flush_check_type(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action flush_keyval_flush(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action flush_bstream_flush(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action flush_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action flush_check_error(
+ struct PINT_smcb *smcb, job_status_s *js_p);
void flush_init_state_machine(void);
%%
@@ -95,8 +95,10 @@ machine pvfs2_flush_sm
%%
-static int flush_check_type(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action flush_check_type(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
js_p->error_code = 0;
if (s_op->attr.objtype == PVFS_TYPE_METAFILE)
@@ -107,7 +109,7 @@ static int flush_check_type(PINT_server_
{
js_p->error_code = FLUSH_BSTREAM;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -123,8 +125,10 @@ static int flush_check_type(PINT_server_
* Synopsys: send a keyval flush request to storage
*
*/
-static int flush_keyval_flush(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action flush_keyval_flush(
+ 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 tmp_id;
@@ -135,7 +139,7 @@ static int flush_keyval_flush(PINT_serve
s_op->req->u.flush.fs_id,
s_op->req->u.flush.handle,
s_op->req->u.flush.flags,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -144,8 +148,10 @@ static int flush_keyval_flush(PINT_serve
return ret;
}
-static int flush_check_error(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action flush_check_error(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
char buf[64] = {0};
if (js_p->error_code != 0)
{
@@ -154,7 +160,7 @@ static int flush_check_error(PINT_server
gossip_err("failed to flush handle %llu: %s\n",
llu(s_op->req->u.flush.handle), buf);
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -170,8 +176,10 @@ static int flush_check_error(PINT_server
* Synopsys: send a bstream flush request to storage
*
*/
-static int flush_bstream_flush(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action flush_bstream_flush(
+ 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;
@@ -182,7 +190,7 @@ static int flush_bstream_flush(PINT_serv
s_op->req->u.flush.fs_id,
s_op->req->u.flush.handle,
s_op->req->u.flush.flags,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -191,9 +199,10 @@ static int flush_bstream_flush(PINT_serv
return ret;
}
-static int flush_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action flush_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: get-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-attr.sm,v
diff -p -u -r1.85 -r1.86
--- get-attr.sm 17 Feb 2007 21:16:47 -0000 1.85
+++ get-attr.sm 13 Apr 2007 05:14:30 -0000 1.86
@@ -46,34 +46,34 @@ enum
STATE_DONE = 12
};
-static int getattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_read_symlink_target(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_get_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_interpret_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_get_dir_hint(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_interpret_dir_hint(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_read_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_read_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_read_metafile_hint(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_interpret_metafile_hint(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int getattr_setup_op(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action getattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_verify_attribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_read_symlink_target(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_get_dirdata_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_interpret_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_get_dir_hint(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_interpret_dir_hint(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_read_metafile_datafile_handles_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_read_metafile_distribution_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_read_metafile_hint(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_interpret_metafile_hint(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getattr_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -201,9 +201,10 @@ machine pvfs2_get_attr_sm
* We initialize the attribute mask that will be returned in this
* function. This mask can be augmented in some of the other states.
*/
-static int getattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_verify_attribs(
+ 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;
js_p->error_code = 0;
@@ -396,12 +397,13 @@ static int getattr_verify_attribs(
llu(s_op->u.getattr.handle));
js_p->error_code = -PVFS_ENXIO;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int getattr_read_symlink_target(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_read_symlink_target(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t i;
@@ -410,7 +412,7 @@ static int getattr_read_symlink_target(
{
gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping symlink target read\n");
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[SYMLINK_TARGET_KEY].key;
@@ -428,7 +430,7 @@ static int getattr_read_symlink_target(
if (!s_op->resp.u.getattr.attr.u.sym.target_path)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer = s_op->resp.u.getattr.attr.u.sym.target_path;
@@ -436,18 +438,60 @@ static int getattr_read_symlink_target(
ret = job_trove_keyval_read(
s_op->u.getattr.fs_id, s_op->u.getattr.handle,
- &s_op->key, &s_op->val,
+ &(s_op->key), &(s_op->val),
0,
- NULL, s_op, 0, js_p,
+ NULL, smcb, 0, js_p,
&i, server_job_context);
-
return ret;
}
-static int getattr_read_metafile_hint(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_interpret_metafile_hint(
+ 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;
+
+ 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)
+ {
+ 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;
+ }
+ }
+ 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->val.buffer)
+ {
+ free(s_op->val.buffer);
+ s_op->val.buffer = NULL;
+ }
+ 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;
@@ -483,56 +527,16 @@ static int getattr_read_metafile_hint(
s_op->u.getattr.fs_id, s_op->u.getattr.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p,
+ NULL, smcb, 0, js_p,
&i, server_job_context);
return ret;
}
-static int getattr_interpret_metafile_hint(
- PINT_server_op *s_op, job_status_s *js_p)
-{
- PVFS_object_attr *resp_attr = NULL;
-
- 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)
- {
- 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;
- }
- }
- 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->val.buffer)
- {
- free(s_op->val.buffer);
- s_op->val.buffer = NULL;
- }
- return 1;
-}
-
-static int getattr_read_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+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;
@@ -545,7 +549,7 @@ static int getattr_read_metafile_datafil
if (!(s_op->u.getattr.attrmask & PVFS_ATTR_META_DFILES))
{
gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping data handle read\n");
- return 1;
+ return SM_ACTION_COMPLETE;
}
dfile_count = s_op->resp.u.getattr.attr.u.meta.dfile_count;
@@ -583,7 +587,7 @@ static int getattr_read_metafile_datafil
s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
js_p->error_code = -PVFS_EOVERFLOW;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
@@ -599,10 +603,7 @@ static int getattr_read_metafile_datafil
gossip_err("Cannot allocate dfile array of count %d\n",
dfile_count);
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;
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer = s_op->resp.u.getattr.attr.u.meta.dfile_array;
@@ -620,15 +621,16 @@ static int getattr_read_metafile_datafil
s_op->u.getattr.fs_id, s_op->u.getattr.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p,
+ NULL, smcb, 0, js_p,
&i, server_job_context);
return ret;
}
-static int getattr_read_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_read_metafile_distribution_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;
job_id_t i;
@@ -641,7 +643,7 @@ static int getattr_read_metafile_distrib
{
gossip_debug(GOSSIP_GETATTR_DEBUG, "skipping data handle "
"distribution read\n");
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
@@ -658,9 +660,7 @@ static int getattr_read_metafile_distrib
"handle %llu,%d\n",llu(s_op->u.getattr.handle),
s_op->u.getattr.fs_id);
js_p->error_code = -PVFS_EINVAL;
- /*If we hit an error the DIST & DFILES are no longer valid*/
- s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
- return 1;
+ return SM_ACTION_COMPLETE;
}
assert(s_op->resp.u.getattr.attr.u.meta.dist_size > 0);
@@ -674,9 +674,7 @@ static int getattr_read_metafile_distrib
gossip_err("Cannot allocate dist of size %d\n",
s_op->val.buffer_sz);
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;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->free_val = 1;
@@ -685,13 +683,15 @@ static int getattr_read_metafile_distrib
&(s_op->key), &(s_op->val),
0,
NULL,
- s_op, 0, js_p, &i, server_job_context);
+ smcb, 0, js_p, &i, server_job_context);
return ret;
}
-static int getattr_setup_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_setup_resp(
+ 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 = &s_op->resp.u.getattr.attr;
if(js_p->error_code > 0)
@@ -704,15 +704,11 @@ static int getattr_setup_resp(PINT_serve
}
if(js_p->error_code < 0)
{
- if (s_op->free_val && s_op->val.buffer)
+ if(s_op->val.buffer)
{
free(s_op->val.buffer);
- s_op->free_val = 0;
}
- /*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;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(
@@ -749,7 +745,7 @@ static int getattr_setup_resp(PINT_serve
llu(s_op->u.getattr.handle), s_op->u.getattr.fs_id);
PVFS_perror("Metafile getattr_setup_resp",js_p->error_code);
js_p->error_code = -PVFS_EIO;
- return 1;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_GETATTR_DEBUG,
@@ -791,7 +787,7 @@ static int getattr_setup_resp(PINT_serve
PVFS_perror("Symlink retrieval failure",js_p->error_code);
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
else if ((resp_attr->objtype == PVFS_TYPE_DIRECTORY) &&
@@ -819,12 +815,13 @@ static int getattr_setup_resp(PINT_serve
s_op->resp.u.getattr.attr.mask);
#endif
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int getattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+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);
if(s_op->val_a)
{
if(s_op->val_a[NUM_DFILES_KEY].buffer)
@@ -846,23 +843,25 @@ static int getattr_cleanup(PINT_server_o
}
PINT_free_object_attr(&s_op->resp.u.getattr.attr);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
-static int getattr_setup_op(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
s_op->u.getattr.handle = s_op->req->u.getattr.handle;
s_op->u.getattr.fs_id = s_op->req->u.getattr.fs_id;
s_op->u.getattr.attrmask = s_op->req->u.getattr.attrmask;
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
-static int getattr_get_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_get_dirdata_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;
job_id_t tmp_id;
@@ -876,7 +875,7 @@ static int getattr_get_dirdata_handle(
&s_op->key, &s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -885,9 +884,10 @@ static int getattr_get_dirdata_handle(
return ret;
}
-static int getattr_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t tmp_id;
@@ -897,7 +897,7 @@ static int getattr_get_dirent_count(
* directory hints
*/
js_p->error_code = STATE_DIR_HINT;
- return(1);
+ return SM_ACTION_COMPLETE;
}
ret = job_trove_keyval_get_handle_info(
s_op->u.getattr.fs_id,
@@ -905,7 +905,7 @@ static int getattr_get_dirent_count(
TROVE_KEYVAL_HANDLE_COUNT |
0,
&s_op->u.getattr.keyval_handle_info,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -914,9 +914,10 @@ static int getattr_get_dirent_count(
return ret;
}
-static int getattr_interpret_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_interpret_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
switch(js_p->error_code)
{
case -TROVE_ENOENT:
@@ -928,18 +929,19 @@ static int getattr_interpret_dirent_coun
s_op->u.getattr.keyval_handle_info.count;
break;
default:
- return 1;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_GETATTR_DEBUG, "getattr: dirent_count: %lld\n",
lld(s_op->resp.u.getattr.attr.u.dir.dirent_count));
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int getattr_get_dir_hint(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_get_dir_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, i;
job_id_t tmp_id;
@@ -952,7 +954,7 @@ static int getattr_get_dir_hint(
/* the caller didn't really want the dir hints; skip
*/
js_p->error_code = STATE_DONE;
- return(1);
+ return SM_ACTION_COMPLETE;
}
@@ -968,7 +970,7 @@ static int getattr_get_dir_hint(
if (!s_op->resp.u.getattr.attr.u.dir.hint.dist_params)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.getattr.attr.u.dir.hint.dist_params_len =
PVFS_REQ_LIMIT_DIST_BYTES;
@@ -978,7 +980,7 @@ static int getattr_get_dir_hint(
if (!s_op->resp.u.getattr.attr.u.dir.hint.dist_name)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.getattr.attr.u.dir.hint.dist_name_len =
PVFS_REQ_LIMIT_DIST_NAME;
@@ -988,20 +990,21 @@ static int getattr_get_dir_hint(
if (s_op->key_a == NULL)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val_a = (PVFS_ds_keyval *) calloc(NUM_SPECIAL_KEYS, sizeof(PVFS_ds_keyval));
if (s_op->val_a == NULL)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ 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)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
+
}
for (i = 0; i < NUM_SPECIAL_KEYS; i++)
{
@@ -1013,7 +1016,7 @@ static int getattr_get_dir_hint(
if(s_op->val_a[i].buffer == NULL)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val_a[i].buffer_sz = 16;
}
@@ -1032,23 +1035,23 @@ static int getattr_get_dir_hint(
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,
- 0, NULL, s_op, 0, js_p, &tmp_id,
+ 0, NULL, smcb, 0, js_p, &tmp_id,
server_job_context);
return ret;
}
-static int getattr_interpret_dir_hint(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action getattr_interpret_dir_hint(
+ 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 && js_p->error_code != -TROVE_ENOENT)
{
/* if we failed to get any of the keys, and the error code is due to
* something other than the keys simply not being present, then
* propigate the error.
*/
- return(1);
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_SERVER_DEBUG,
@@ -1110,7 +1113,7 @@ static int getattr_interpret_dir_hint(
js_p->error_code = 0;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
Index: get-config.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-config.sm,v
diff -p -u -r1.35 -r1.36
--- get-config.sm 17 Feb 2007 21:16:47 -0000 1.35
+++ get-config.sm 13 Apr 2007 05:14:30 -0000 1.36
@@ -14,8 +14,10 @@
#include "server-config.h"
#include "pvfs2-server.h"
-static int getconfig_cleanup(PINT_server_op *s_op, job_status_s* js_p);
-static int getconfig_init(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action getconfig_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action getconfig_init(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -49,7 +51,6 @@ machine pvfs2_get_config_sm
%%
-
/*
* Function: getconfig_init
*
@@ -67,8 +68,10 @@ machine pvfs2_get_config_sm
*
*/
-static int getconfig_init(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action getconfig_init(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
struct server_configuration_s *user_opts = get_server_config_struct();
assert(user_opts);
@@ -86,7 +89,7 @@ static int getconfig_init(PINT_server_op
(char*)user_opts->server_config_buf;
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/*
@@ -105,9 +108,10 @@ static int getconfig_init(PINT_server_op
* response structure
*/
-static int getconfig_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action getconfig_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
Index: get-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/get-eattr.sm,v
diff -p -u -r1.16 -r1.17
--- get-eattr.sm 29 Mar 2007 14:20:44 -0000 1.16
+++ get-eattr.sm 13 Apr 2007 05:14:30 -0000 1.17
@@ -25,14 +25,14 @@
#include "pint-util.h"
#include "pint-eattr.h"
-static int geteattr_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int geteattr_read_eattrib(
- PINT_server_op *s_op, job_status_s *js_p);
-static int geteattr_check_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int geteattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action geteattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action geteattr_read_eattrib(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action geteattr_check_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action geteattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -83,15 +83,17 @@ machine pvfs2_get_eattr_sm
* geteattr_setup_resp()
* Set up the response - allocate needed resources
*/
-static int geteattr_setup_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action geteattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int i, tsz;
gossip_debug(GOSSIP_GETEATTR_DEBUG,"geteattr requesting %d keys\n",
s_op->req->u.geteattr.nkey);
js_p->error_code = 0;
-
+
/* iterate through the keys and see if they fall into valid name spaces */
for(i=0; i<s_op->req->u.geteattr.nkey; i++)
{
@@ -103,9 +105,10 @@ static int geteattr_setup_resp(PINT_serv
NULL);
if(js_p->error_code != 0)
{
- return(1);
+ /* not prefixed: treat this as if the key does not exist */
+ js_p->error_code = -PVFS_ENOENT;
+ return SM_ACTION_COMPLETE;
}
-
}
s_op->resp.u.geteattr.val =
@@ -113,7 +116,7 @@ static int geteattr_setup_resp(PINT_serv
if (!s_op->resp.u.geteattr.val)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.geteattr.err =
malloc(s_op->req->u.geteattr.nkey*sizeof(PVFS_error));
@@ -121,7 +124,7 @@ static int geteattr_setup_resp(PINT_serv
{
free(s_op->resp.u.geteattr.val);
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.geteattr.nkey = s_op->req->u.geteattr.nkey;
for (i = 0, tsz = 0; i < s_op->req->u.geteattr.nkey; i++)
@@ -133,7 +136,7 @@ static int geteattr_setup_resp(PINT_serv
free (s_op->resp.u.geteattr.val);
free (s_op->resp.u.geteattr.err);
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_GETEATTR_DEBUG,"geteattr buffer size %d bytes\n",
tsz);
@@ -145,16 +148,17 @@ static int geteattr_setup_resp(PINT_serv
(char *) s_op->u.eattr.buffer + tsz;
tsz += s_op->req->u.geteattr.valsz[i];
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
* geteattr_read_eattrib()
* Here is where the eattrib get read. Not much to this.
*/
-static int geteattr_read_eattrib(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action geteattr_read_eattrib(
+ 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;
@@ -169,7 +173,7 @@ static int geteattr_read_eattrib(
s_op->req->u.geteattr.nkey,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -182,8 +186,10 @@ static int geteattr_read_eattrib(
* geteattr_check_resp()
* Check the response - handle any errors
*/
-static int geteattr_check_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action geteattr_check_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int k;
gossip_debug(GOSSIP_GETEATTR_DEBUG,"geteattr returning %d values\n",
s_op->resp.u.geteattr.nkey);
@@ -205,21 +211,23 @@ static int geteattr_check_resp(PINT_serv
s_op->resp.u.geteattr.val[k].buffer_sz = 0;
}
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* geteattr_cleanup()
* free resources alloc'd by state machine
*/
-static int geteattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action geteattr_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->resp.u.geteattr.val)
free(s_op->resp.u.geteattr.val);
if (s_op->resp.u.geteattr.err)
free(s_op->resp.u.geteattr.err);
if (s_op->u.eattr.buffer)
free(s_op->u.eattr.buffer);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/io.sm,v
diff -p -u -r1.66 -r1.67
--- io.sm 17 Feb 2007 21:16:47 -0000 1.66
+++ io.sm 13 Apr 2007 05:14:30 -0000 1.67
@@ -19,16 +19,16 @@
#include "pint-request.h"
#include "pvfs2-internal.h"
-static int io_send_ack(
- PINT_server_op *s_op, job_status_s* js_p);
-static int io_send_completion_ack(
- PINT_server_op *s_op, job_status_s* js_p);
-static int io_start_flow(
- PINT_server_op *s_op, job_status_s* js_p);
-static int io_release(
- PINT_server_op *s_op, job_status_s* js_p);
-static int io_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action io_send_ack(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action io_send_completion_ack(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action io_start_flow(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action io_release(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action io_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -100,8 +100,10 @@ machine pvfs2_io_sm
* send either positive or negative acknowledgements.
*
*/
-static int io_send_ack(PINT_server_op *s_op, job_status_s *js_p)
+static int io_send_ack(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int err = -PVFS_EIO;
job_id_t tmp_id;
struct server_configuration_s *user_opts = get_server_config_struct();
@@ -119,13 +121,13 @@ static int io_send_ack(PINT_server_op *s
{
gossip_lerr("Server: IO SM: PINT_encode() failure.\n");
js_p->error_code = err;
- return 1;
+ return SM_ACTION_COMPLETE;
}
err = job_bmi_send_list(
s_op->addr, s_op->encoded.buffer_list, s_op->encoded.size_list,
s_op->encoded.list_count, s_op->encoded.total_size,
- s_op->tag, s_op->encoded.buffer_type, 0, s_op, 0, js_p,
+ s_op->tag, s_op->encoded.buffer_type, 0, smcb, 0, js_p,
&tmp_id, server_job_context, user_opts->server_job_bmi_timeout);
return err;
@@ -149,8 +151,10 @@ static int io_send_ack(PINT_server_op *s
* carry out the data transfer
*
*/
-static int io_start_flow(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action io_start_flow(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int err = -PVFS_EIO;
job_id_t tmp_id;
struct server_configuration_s *user_opts = get_server_config_struct();
@@ -160,7 +164,7 @@ static int io_start_flow(PINT_server_op
if (!s_op->u.io.flow_d)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* we still have the file size stored in the response structure
@@ -236,10 +240,10 @@ static int io_start_flow(PINT_server_op
{
gossip_lerr("Server: IO SM: unknown IO type requested.\n");
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
- err = job_flow(s_op->u.io.flow_d, s_op, 0, js_p, &tmp_id,
+ err = job_flow(s_op->u.io.flow_d, smcb, 0, js_p, &tmp_id,
server_job_context, user_opts->server_job_flow_timeout);
return err;
@@ -260,8 +264,10 @@ static int io_start_flow(PINT_server_op
*
* Synopsis: releases the operation from the scheduler
*/
-static int io_release(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action io_release(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = 0;
job_id_t i;
@@ -270,7 +276,7 @@ static int io_release(PINT_server_op *s_
was scheduled in the first place)
*/
ret = job_req_sched_release(
- s_op->scheduled_id, s_op, 0, js_p, &i, server_job_context);
+ s_op->scheduled_id, smcb, 0, js_p, &i, server_job_context);
return ret;
}
@@ -289,8 +295,10 @@ static int io_release(PINT_server_op *s_
* Synopsis: free up any buffers associated with the operation,
* including any encoded or decoded protocol structures
*/
-static int io_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action io_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
char status_string[64] = {0};
PVFS_strerror_r(s_op->resp.status, status_string, 64);
@@ -316,7 +324,7 @@ static int io_cleanup(PINT_server_op *s_
*/
BMI_set_info(s_op->addr, BMI_DEC_ADDR_REF, NULL);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
@@ -337,9 +345,10 @@ static int io_cleanup(PINT_server_op *s_
* send either positive or negative acknowledgements.
*
*/
-static int io_send_completion_ack(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action io_send_completion_ack(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int err = -PVFS_EIO;
job_id_t tmp_id;
struct server_configuration_s *user_opts = get_server_config_struct();
@@ -350,7 +359,7 @@ static int io_send_completion_ack(
if (s_op->req->u.io.io_type == PVFS_IO_READ)
{
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* release encoding of the first ack that we sent */
@@ -376,13 +385,13 @@ static int io_send_completion_ack(
{
gossip_lerr("Server: IO SM: PINT_encode() failure.\n");
js_p->error_code = err;
- return 1;
+ return SM_ACTION_COMPLETE;
}
err = job_bmi_send_list(
s_op->addr, s_op->encoded.buffer_list, s_op->encoded.size_list,
s_op->encoded.list_count, s_op->encoded.total_size, s_op->tag,
- s_op->encoded.buffer_type, 0, s_op, 0, js_p, &tmp_id,
+ s_op->encoded.buffer_type, 0, smcb, 0, js_p, &tmp_id,
server_job_context, user_opts->server_job_bmi_timeout);
return err;
Index: iterate-handles.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/iterate-handles.sm,v
diff -p -u -r1.7 -r1.8
--- iterate-handles.sm 17 Feb 2007 21:16:47 -0000 1.7
+++ iterate-handles.sm 13 Apr 2007 05:14:30 -0000 1.8
@@ -13,9 +13,12 @@
#include "pvfs2-server.h"
#include "server-config.h"
-static int iterate_handles_cleanup(PINT_server_op *s_op, job_status_s* js_p);
-static int iterate_handles_do_work(PINT_server_op *s_op, job_status_s* js_p);
-static int iterate_handles_fill_resp(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action iterate_handles_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action iterate_handles_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action iterate_handles_fill_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -59,12 +62,14 @@ machine pvfs2_iterate_handles_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int iterate_handles_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action iterate_handles_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->resp.u.mgmt_iterate_handles.handle_array)
free(s_op->resp.u.mgmt_iterate_handles.handle_array);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
@@ -72,8 +77,10 @@ static int iterate_handles_cleanup(PINT_
*
* actually performs work necessary to retrieve handles
*/
-static int iterate_handles_do_work(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action iterate_handles_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
job_id_t tmp_id;
/* allocate memory to hold handles */
@@ -83,7 +90,7 @@ static int iterate_handles_do_work(PINT_
if(!s_op->resp.u.mgmt_iterate_handles.handle_array)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.mgmt_iterate_handles.position
@@ -107,18 +114,20 @@ static int iterate_handles_do_work(PINT_
*
* gathers results from job status for response
*/
-static int iterate_handles_fill_resp(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action iterate_handles_fill_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)
{
/* propigate error and let final_response handle it */
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.mgmt_iterate_handles.handle_count = js_p->count;
s_op->resp.u.mgmt_iterate_handles.position = js_p->position;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/*
Index: job-timer.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/job-timer.sm,v
diff -p -u -r1.4 -r1.5
--- job-timer.sm 17 Feb 2007 21:16:47 -0000 1.4
+++ job-timer.sm 13 Apr 2007 05:14:30 -0000 1.5
@@ -15,8 +15,10 @@
#include "job-time-mgr.h"
#include "server-config.h"
-static int job_timer_do_work(PINT_server_op *s_op, job_status_s* js_p);
-static int job_timer_error(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action job_timer_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action job_timer_error(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -43,11 +45,12 @@ machine pvfs2_job_timer_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int job_timer_error(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action job_timer_error(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("Error: stopping server job timer.\n");
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* job_timer_do_work()
@@ -55,7 +58,8 @@ static int job_timer_error(PINT_server_o
* resets counters, updates metrices, etc- this is intended to be called
* repeatedly on a regular interval
*/
-static int job_timer_do_work(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action job_timer_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
int ret = -1;
job_id_t tmp_id;
@@ -69,16 +73,16 @@ static int job_timer_do_work(PINT_server
if(ret < 0)
{
js_p->error_code = ret;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* post another timer */
return(job_req_sched_post_timer(1000,
- s_op,
- 0,
- js_p,
- &tmp_id,
- server_job_context));
+ smcb,
+ 0,
+ js_p,
+ &tmp_id,
+ server_job_context));
}
Index: list-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/list-attr.sm,v
diff -p -u -r1.4 -r1.5
--- list-attr.sm 17 Feb 2007 21:16:47 -0000 1.4
+++ list-attr.sm 13 Apr 2007 05:14:30 -0000 1.5
@@ -36,24 +36,26 @@ enum
MORE_WORK = 1,
};
-static int listattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_read_symlink_target(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_interpret_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_read_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_read_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listattr_setup_op(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action listattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_verify_attribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_read_symlink_target(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_interpret_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_read_metafile_datafile_handles_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_read_metafile_distribution_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listattr_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+
+extern PINT_server_trove_keys_s Trove_Common_Keys[];
%%
@@ -150,9 +152,10 @@ machine pvfs2_list_attr_sm
* We initialize the attribute mask that will be returned in this
* function. This mask can be augmented in some of the other states.
*/
-static int listattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_verify_attribs(
+ 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, *obj_attr = NULL;
PVFS_ds_attributes *ds_attr = NULL;
int *resp_error = NULL, *ds_error = NULL;
@@ -356,12 +359,13 @@ static int listattr_verify_attribs(
llu(*handle),
lld(resp_attr->u.data.size));
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int listattr_read_symlink_target(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_read_symlink_target(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t i;
PVFS_object_attr *resp_attr = NULL;
@@ -376,7 +380,7 @@ static int listattr_read_symlink_target(
if (!(s_op->u.listattr.attrmask & PVFS_ATTR_SYMLNK_TARGET))
{
gossip_debug(GOSSIP_LISTATTR_DEBUG, "skipping symlink target read\n");
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[SYMLINK_TARGET_KEY].key;
@@ -394,7 +398,7 @@ static int listattr_read_symlink_target(
if (!resp_attr->u.sym.target_path)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer = resp_attr->u.sym.target_path;
@@ -403,16 +407,17 @@ static int listattr_read_symlink_target(
ret = job_trove_keyval_read(
s_op->u.listattr.fs_id, *handle,
&(s_op->key), &(s_op->val),
- 0, NULL, s_op, 0, js_p,
+ 0, NULL, smcb, 0, js_p,
&i, server_job_context);
return ret;
}
-static int listattr_read_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_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;
@@ -430,7 +435,7 @@ static int listattr_read_metafile_datafi
if (!(s_op->u.listattr.attrmask & PVFS_ATTR_META_DFILES))
{
gossip_debug(GOSSIP_LISTATTR_DEBUG, "skipping data handle read\n");
- return 1;
+ return SM_ACTION_COMPLETE;
}
dfile_count = resp_attr->u.meta.dfile_count;
@@ -464,7 +469,7 @@ static int listattr_read_metafile_datafi
(int)s_op->u.listattr.fs_id);
js_p->error_code = -PVFS_EOVERFLOW;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key;
@@ -480,7 +485,7 @@ static int listattr_read_metafile_datafi
gossip_err("Cannot allocate dfile array of count %d\n",
dfile_count);
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer = resp_attr->u.meta.dfile_array;
@@ -497,15 +502,16 @@ static int listattr_read_metafile_datafi
ret = job_trove_keyval_read(
s_op->u.listattr.fs_id, *handle,
&s_op->key, &s_op->val,
- 0, NULL, s_op, 0, js_p,
+ 0, NULL, smcb, 0, js_p,
&i, server_job_context);
return ret;
}
-static int listattr_read_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_read_metafile_distribution_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;
job_id_t i;
PVFS_object_attr *resp_attr = NULL;
@@ -523,7 +529,7 @@ static int listattr_read_metafile_distri
{
gossip_debug(GOSSIP_LISTATTR_DEBUG, "skipping data handle "
"distribution read\n");
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->key.buffer = Trove_Common_Keys[METAFILE_DIST_KEY].key;
@@ -540,7 +546,7 @@ static int listattr_read_metafile_distri
"handle %llu,%d\n",llu(*handle),
s_op->u.listattr.fs_id);
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
assert(resp_attr->u.meta.dist_size > 0);
@@ -554,20 +560,21 @@ static int listattr_read_metafile_distri
gossip_err("Cannot allocate dist of size %d\n",
s_op->val.buffer_sz);
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
ret = job_trove_keyval_read(
s_op->u.listattr.fs_id, *handle,
&(s_op->key), &(s_op->val),
0, NULL,
- s_op, 0, js_p, &i, server_job_context);
+ smcb, 0, js_p, &i, server_job_context);
return ret;
}
-static int listattr_setup_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_setup_resp(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;
PVFS_handle *handle;
int *resp_error;
@@ -616,7 +623,7 @@ static int listattr_setup_resp(PINT_serv
PVFS_perror("Metafile listattr_setup_resp",js_p->error_code);
*resp_error = -PVFS_EIO;
js_p->error_code = s_op->u.listattr.nhandles == 0 ? 0 : MORE_WORK;
- return 1;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_LISTATTR_DEBUG,
@@ -628,7 +635,7 @@ static int listattr_setup_resp(PINT_serv
PVFS_perror("Metafile listattr_setup_resp", js_p->error_code);
*resp_error = js_p->error_code;
js_p->error_code = s_op->u.listattr.nhandles == 0 ? 0 : MORE_WORK;
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
else if ((resp_attr->objtype == PVFS_TYPE_DATAFILE) &&
@@ -644,7 +651,7 @@ static int listattr_setup_resp(PINT_serv
PVFS_perror("Datafile listattr_setup_resp", js_p->error_code);
*resp_error = js_p->error_code;
js_p->error_code = s_op->u.listattr.nhandles == 0 ? 0 : MORE_WORK;
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
else if ((resp_attr->objtype == PVFS_TYPE_SYMLINK) &&
@@ -675,7 +682,7 @@ static int listattr_setup_resp(PINT_serv
*resp_error = js_p->error_code;
js_p->error_code = s_op->u.listattr.nhandles == 0 ? 0 : MORE_WORK;
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
@@ -690,12 +697,13 @@ static int listattr_setup_resp(PINT_serv
resp_attr->mask);
#endif
js_p->error_code = s_op->u.listattr.nhandles == 0 ? 0 : MORE_WORK;
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int listattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_cleanup(struct PINT_smcb *smcb, job_status_s *js_p)
{
int i;
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
if (s_op->u.listattr.attr_a)
{
@@ -708,13 +716,14 @@ static int listattr_cleanup(PINT_server_
free(s_op->u.listattr.ds_attr_a);
if (s_op->u.listattr.errors)
free(s_op->u.listattr.errors);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
-static int listattr_setup_op(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_setup_op(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
int ret;
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
job_id_t tmp_id;
s_op->u.listattr.handles = s_op->req->u.listattr.handles;
@@ -726,32 +735,32 @@ static int listattr_setup_op(
calloc(s_op->u.listattr.nhandles * sizeof(PVFS_object_attr), 1);
if (s_op->u.listattr.attr_a == NULL) {
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->u.listattr.ds_attr_a = (PVFS_ds_attributes *)
calloc(s_op->u.listattr.nhandles * sizeof(PVFS_ds_attributes), 1);
if (s_op->u.listattr.ds_attr_a == NULL) {
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->u.listattr.errors = (PVFS_error *)
calloc(s_op->u.listattr.nhandles * sizeof(PVFS_error), 1);
if (s_op->u.listattr.errors == NULL) {
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* Listattr response has to be allocated extra memory */
s_op->resp.u.listattr.error = (PVFS_error *)
calloc(s_op->u.listattr.nhandles * sizeof(PVFS_error), 1);
if (s_op->resp.u.listattr.error == NULL) {
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.listattr.attr = (PVFS_object_attr *)
calloc(s_op->u.listattr.nhandles * sizeof(PVFS_object_attr), 1);
if (s_op->resp.u.listattr.attr == NULL) {
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
/* initiate retrieval of the attributes from the dspace */
@@ -759,7 +768,7 @@ static int listattr_setup_op(
s_op->u.listattr.fs_id,
s_op->u.listattr.nhandles,
s_op->u.listattr.handles,
- s_op,
+ smcb,
s_op->u.listattr.errors,
s_op->u.listattr.ds_attr_a,
0,
@@ -770,9 +779,10 @@ static int listattr_setup_op(
return ret;
}
-static int listattr_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t tmp_id;
PVFS_handle *handle = NULL;
@@ -786,7 +796,7 @@ static int listattr_get_dirent_count(
*handle,
TROVE_KEYVAL_HANDLE_COUNT,
&s_op->u.listattr.keyval_handle_info,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -795,9 +805,10 @@ static int listattr_get_dirent_count(
return ret;
}
-static int listattr_interpret_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listattr_interpret_dirent_count(
+ 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;
/* from the keyval_handle_info, retrieve the dirent_count */
@@ -809,7 +820,7 @@ static int listattr_interpret_dirent_cou
lld(resp_attr->u.dir.dirent_count));
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
Index: list-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/list-eattr.sm,v
diff -p -u -r1.10 -r1.11
--- list-eattr.sm 29 Mar 2007 14:20:44 -0000 1.10
+++ list-eattr.sm 13 Apr 2007 05:14:30 -0000 1.11
@@ -25,14 +25,14 @@
#include "pint-util.h"
#include "pint-eattr.h"
-static int listeattr_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listeattr_list_eattrib(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listeattr_check_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int listeattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action listeattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listeattr_list_eattrib(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listeattr_check_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action listeattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -83,8 +83,10 @@ machine pvfs2_list_eattr_sm
* listeattr_setup_resp()
* Set up the response - allocate needed resources
*/
-static int listeattr_setup_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listeattr_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int i, tsz;
gossip_debug(GOSSIP_LISTEATTR_DEBUG, "listeattr requesting %d keys\n",
s_op->req->u.listeattr.nkey);
@@ -96,7 +98,7 @@ static int listeattr_setup_resp(PINT_ser
if (!s_op->resp.u.listeattr.key)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.listeattr.nkey = s_op->req->u.listeattr.nkey;
@@ -108,7 +110,7 @@ static int listeattr_setup_resp(PINT_ser
s_op->resp.u.listeattr.nkey = 0;
free (s_op->resp.u.listeattr.key);
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_LISTEATTR_DEBUG,"listeattr buffer size %d bytes\n",
tsz);
@@ -120,16 +122,17 @@ static int listeattr_setup_resp(PINT_ser
(char *)s_op->u.eattr.buffer + tsz;
tsz += s_op->req->u.listeattr.keysz[i];
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
* listeattr_list_eattrib()
* Here is where the eattrib get listed.
*/
-static int listeattr_list_eattrib(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listeattr_list_eattrib(
+ 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;
@@ -143,7 +146,7 @@ static int listeattr_list_eattrib(
s_op->req->u.listeattr.nkey,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -179,8 +182,10 @@ static void print_string(char *buffer, s
* will translate it so that it appears in the "system.pvfs2." name
* space on the client side.
*/
-static int listeattr_check_resp(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listeattr_check_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int num_found = 0;
int i = 0;
@@ -189,7 +194,7 @@ static int listeattr_check_resp(PINT_ser
{
s_op->resp.u.listeattr.token = js_p->count;
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* how many entries did we find that we can process? */
@@ -206,9 +211,9 @@ static int listeattr_check_resp(PINT_ser
{
/* there aren't any extended attr's; go ahead and return */
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
-
+
/* iterate through the keys that we found */
for(i=0; i<num_found; i++)
{
@@ -217,27 +222,29 @@ static int listeattr_check_resp(PINT_ser
NULL);
if(js_p->error_code != 0)
{
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.listeattr.key[i].buffer_sz =
s_op->resp.u.listeattr.key[i].read_sz;
- }
+ }
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* listeattr_cleanup()
* free resources alloc'd by state machine
*/
-static int listeattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action listeattr_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->resp.u.listeattr.key)
free(s_op->resp.u.listeattr.key);
if (s_op->u.eattr.buffer)
free(s_op->u.eattr.buffer);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: lookup.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/lookup.sm,v
diff -p -u -r1.52 -r1.53
--- lookup.sm 17 Feb 2007 21:16:48 -0000 1.52
+++ lookup.sm 13 Apr 2007 05:14:30 -0000 1.53
@@ -27,24 +27,24 @@ enum
LOOKUP_CHECK_DIR_ACLS = 24,
};
-static int lookup_init(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_read_object_metadata(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_verify_object_metadata(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_check_acls_if_needed(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_check_acls(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_read_directory_entry(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p);
-static int lookup_setup_resp(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action lookup_init(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_read_object_metadata(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_verify_object_metadata(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_check_acls_if_needed(
+ struct PINT_smcb *smcb, job_status_s* js_p);
+static PINT_sm_action lookup_check_acls(
+ struct PINT_smcb *smcb, job_status_s* js_p);
+static PINT_sm_action lookup_read_directory_entry(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_read_directory_entry_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action lookup_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -144,10 +144,19 @@ machine pvfs2_lookup_sm
* s_op->resp.u.lookup_path.handle_array.
*
*/
-static int lookup_init(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_init(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
char *ptr = NULL;
+ gossip_debug(GOSSIP_SERVER_DEBUG, " STARTING LOOKUP REQUEST "
+ "(path:%s)(fs_id:%d)(handle:%llu)(attrmask:%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),
+ s_op->req->u.lookup_path.attrmask);
+
/* fill in the lookup portion of the PINT_server_op */
s_op->u.lookup.segp = NULL;
s_op->u.lookup.seg_nr = 0;
@@ -163,7 +172,7 @@ static int lookup_init(PINT_server_op *s
"sending error response\n",
s_op->req->u.lookup_path.path);
js_p->error_code = -PVFS_ENOTDIR;
- return 0;
+ return SM_ACTION_DEFERRED;
}
/* allocate the internal ds_attr_array */
@@ -185,7 +194,7 @@ static int lookup_init(PINT_server_op *s
if (!ptr)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.lookup_path.handle_array = (PVFS_handle *)ptr;
@@ -194,7 +203,7 @@ static int lookup_init(PINT_server_op *s
s_op->resp.u.lookup_path.attr_array = (PVFS_object_attr *)ptr;
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -210,9 +219,10 @@ static int lookup_init(PINT_server_op *s
*
* Posts the keyval read to trove.
*/
-static int lookup_read_object_metadata(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_read_object_metadata(
+ 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 j_id;
PVFS_handle handle = PVFS_HANDLE_NULL;
@@ -243,7 +253,7 @@ static int lookup_read_object_metadata(
/* get the dspace attributes/metadata */
ret = job_trove_dspace_getattr(
- s_op->req->u.lookup_path.fs_id, handle, s_op, ds_attr,
+ s_op->req->u.lookup_path.fs_id, handle, smcb, ds_attr,
0, js_p, &j_id, server_job_context);
return ret;
@@ -264,9 +274,10 @@ static int lookup_read_object_metadata(
* This function does not post an operation, but rather returns 1
* immediately.
*/
-static int lookup_verify_object_metadata(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_verify_object_metadata(
+ 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;
PVFS_object_attr *a_p = NULL;
PVFS_ds_attributes *ds_attr = NULL;
@@ -307,7 +318,7 @@ static int lookup_verify_object_metadata
"halting lookup and sending response\n");
js_p->error_code = STATE_ENOTDIR;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -320,7 +331,7 @@ static int lookup_verify_object_metadata
"halting lookup and sending response\n");
js_p->error_code = STATE_ENOTDIR;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* if we looked up all the segments, we are done */
@@ -330,7 +341,7 @@ static int lookup_verify_object_metadata
"sending response\n");
js_p->error_code = STATE_NOMORESEGS;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* if we reach this point, the object is a directory. Verify that we
@@ -344,7 +355,7 @@ static int lookup_verify_object_metadata
* out
*/
js_p->error_code = LOOKUP_CHECK_DIR_ACLS;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* find the segment that we should look up in the directory */
@@ -364,18 +375,19 @@ static int lookup_verify_object_metadata
s_op->u.lookup.segp);
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
* Post a keyval DB read of the posix acls to check and see if
* directory traversal is allowed or not
*/
-static int lookup_check_acls_if_needed(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_check_acls_if_needed(
+ struct PINT_smcb *smcb, job_status_s* js_p)
{
int ret = -PVFS_EINVAL;
job_id_t i;
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
/* If we get here with an invalid fsid and handle, we have to
* return -PVFS_EACCESS
@@ -384,7 +396,7 @@ static int lookup_check_acls_if_needed(
|| s_op->target_handle == PVFS_HANDLE_NULL)
{
js_p->error_code = -PVFS_EACCES;
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
@@ -396,7 +408,7 @@ static int lookup_check_acls_if_needed(
if (!s_op->val.buffer)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer_sz = PVFS_REQ_LIMIT_VAL_LEN;
@@ -411,12 +423,12 @@ static int lookup_check_acls_if_needed(
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
server_job_context);
- return ret;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -424,9 +436,10 @@ static int lookup_check_acls_if_needed(
* to proceed or not. i.e. executable privileges on directory
* for the requesting user or not.
*/
-static int lookup_check_acls(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_check_acls(
+ 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 *obj_attr = NULL;
int want = PVFS2_ACL_EXECUTE;
@@ -473,7 +486,7 @@ cleanup:
free(s_op->val.buffer);
memset(&s_op->key, 0, sizeof(PVFS_ds_keyval));
memset(&s_op->val, 0, sizeof(PVFS_ds_keyval));
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -492,9 +505,10 @@ cleanup:
*
* Posts the keyval read to trove.
*/
-static int lookup_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_read_directory_entry_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 = -PVFS_EINVAL;
PVFS_handle handle = PVFS_HANDLE_NULL;
job_id_t j_id;
@@ -522,7 +536,7 @@ static int lookup_read_directory_entry_h
ret = job_trove_keyval_read(
s_op->req->u.lookup_path.fs_id, handle, &s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
@@ -533,9 +547,10 @@ static int lookup_read_directory_entry_h
* Synopsis: Given a handle for a dspace holding directory entries,
* look up the current segment and obtain its handle.
*/
-static int lookup_read_directory_entry(
- PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_read_directory_entry(
+ 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 j_id;
@@ -560,15 +575,17 @@ static int lookup_read_directory_entry(
s_op->req->u.lookup_path.fs_id, s_op->u.lookup.dirent_handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &j_id,
+ NULL, smcb, 0, js_p, &j_id,
server_job_context);
return ret;
}
-static int lookup_setup_resp(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
/*
NOTE: we may have handle_count N with attr_count N-1 in the case
@@ -588,6 +605,7 @@ static int lookup_setup_resp(PINT_server
else if(js_p->error_code < 0)
{
/* preserve error code in this case and fall through */
+ gossip_debug(GOSSIP_SERVER_DEBUG, " lookup error in previous step\n");
}
else
{
@@ -615,7 +633,7 @@ static int lookup_setup_resp(PINT_server
s_op->req->u.lookup_path.path);
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -633,8 +651,10 @@ static int lookup_setup_resp(PINT_server
* s_op->resp.u.lookup_path.handle_array)
* - the server operation structure itself
*/
-static int lookup_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action lookup_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->resp.u.lookup_path.handle_array)
{
free(s_op->resp.u.lookup_path.handle_array);
@@ -646,7 +666,7 @@ static int lookup_cleanup(PINT_server_op
free(s_op->u.lookup.ds_attr_array);
s_op->u.lookup.ds_attr_array = NULL;
}
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: mgmt-get-dirdata-handle.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-get-dirdata-handle.sm,v
diff -p -u -r1.7 -r1.8
--- mgmt-get-dirdata-handle.sm 17 Feb 2007 21:16:48 -0000 1.7
+++ mgmt-get-dirdata-handle.sm 13 Apr 2007 05:14:30 -0000 1.8
@@ -14,12 +14,12 @@
#include "gossip.h"
#include "pvfs2-internal.h"
-static int mgmt_get_dirdata_handle_from_parent(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mgmt_get_dirdata_handle_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mgmt_get_dirdata_handle_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action mgmt_get_dirdata_handle_from_parent(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mgmt_get_dirdata_handle_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mgmt_get_dirdata_handle_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -61,8 +61,9 @@ machine pvfs2_mgmt_get_dirdata_handle_sm
%%
static int mgmt_get_dirdata_handle_from_parent(
- PINT_server_op *s_op, job_status_s *js_p)
+ 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;
@@ -86,15 +87,16 @@ static int mgmt_get_dirdata_handle_from_
s_op->req->u.mgmt_get_dirdata_handle.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &i,
+ NULL, smcb, 0, js_p, &i,
server_job_context);
return ret;
}
-static int mgmt_get_dirdata_handle_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_get_dirdata_handle_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)
{
s_op->resp.u.mgmt_get_dirdata_handle.handle =
@@ -113,13 +115,13 @@ static int mgmt_get_dirdata_handle_setup
"handle from parent %llu\n",
llu(s_op->req->u.mgmt_get_dirdata_handle.handle));
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int mgmt_get_dirdata_handle_cleanup(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_get_dirdata_handle_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: mgmt-remove-dirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-remove-dirent.sm,v
diff -p -u -r1.11 -r1.12
--- mgmt-remove-dirent.sm 5 Apr 2007 14:59:22 -0000 1.11
+++ mgmt-remove-dirent.sm 13 Apr 2007 05:14:30 -0000 1.12
@@ -14,12 +14,12 @@
#include "gossip.h"
#include "pvfs2-internal.h"
-static int mgmt_remove_dirent_get_dirdata_handle_from_parent(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mgmt_remove_dirent(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mgmt_remove_dirent_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action mgmt_remove_dirent_get_dirdata_handle_from_parent(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mgmt_remove_dirent(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mgmt_remove_dirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -61,8 +61,9 @@ machine pvfs2_mgmt_remove_dirent_sm
%%
static int mgmt_remove_dirent_get_dirdata_handle_from_parent(
- PINT_server_op *s_op, job_status_s *js_p)
+ 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;
@@ -87,15 +88,16 @@ static int mgmt_remove_dirent_get_dirdat
s_op->req->u.mgmt_remove_dirent.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &i,
+ NULL, smcb, 0, js_p, &i,
server_job_context);
return ret;
}
-static int mgmt_remove_dirent(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_remove_dirent(
+ 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 j_id;
@@ -115,7 +117,7 @@ static int mgmt_remove_dirent(
NULL,
TROVE_SYNC | TROVE_KEYVAL_HANDLE_COUNT,
NULL,
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -124,10 +126,10 @@ static int mgmt_remove_dirent(
return ret;
}
-static int mgmt_remove_dirent_cleanup(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_remove_dirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: mgmt-remove-object.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mgmt-remove-object.sm,v
diff -p -u -r1.11 -r1.12
--- mgmt-remove-object.sm 17 Feb 2007 21:16:48 -0000 1.11
+++ mgmt-remove-object.sm 13 Apr 2007 05:14:30 -0000 1.12
@@ -14,10 +14,10 @@
#include "gossip.h"
#include "pvfs2-internal.h"
-static int mgmt_remove_dspace(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mgmt_remove_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action mgmt_remove_dspace(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mgmt_remove_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -51,9 +51,10 @@ machine pvfs2_mgmt_remove_object_sm
%%
-static int mgmt_remove_dspace(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_remove_dspace(
+ 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 j_id;
@@ -66,7 +67,7 @@ static int mgmt_remove_dspace(
s_op->req->u.mgmt_remove_object.fs_id,
s_op->req->u.mgmt_remove_object.handle,
TROVE_SYNC,
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -75,10 +76,10 @@ static int mgmt_remove_dspace(
return ret;
}
-static int mgmt_remove_cleanup(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mgmt_remove_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: mkdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/mkdir.sm,v
diff -p -u -r1.48 -r1.49
--- mkdir.sm 17 Feb 2007 21:16:48 -0000 1.48
+++ mkdir.sm 13 Apr 2007 05:14:30 -0000 1.49
@@ -15,20 +15,20 @@
#include "pvfs2-internal.h"
#include "pint-util.h"
-static int mkdir_create(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_setattrib(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_create_dirdata_dspace(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_write_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_error(
- PINT_server_op *s_op, job_status_s *js_p);
-static int mkdir_prep_sm(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action mkdir_create(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_setattrib(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_create_dirdata_dspace(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_write_dirdata_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_error(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action mkdir_prep_sm(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -118,9 +118,10 @@ machine pvfs2_mkdir_sm
* NOTE: returned handle will pop out in js_p->handle (the job status
* struct).
*/
-static int mkdir_create(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_create(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
-
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t i;
@@ -137,7 +138,7 @@ static int mkdir_create(PINT_server_op *
s_op->u.mkdir.fs_id, &s_op->u.mkdir.handle_extent_array,
PVFS_TYPE_DIRECTORY, NULL,
TROVE_SYNC,
- s_op, 0, js_p, &i,
+ smcb, 0, js_p, &i,
server_job_context);
return ret;
@@ -154,8 +155,10 @@ static int mkdir_create(PINT_server_op *
* Synopsis:
*
*/
-static int mkdir_setattrib(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_setattrib(
+ 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_ds_attributes *ds_attr = NULL;
@@ -177,14 +180,15 @@ static int mkdir_setattrib(PINT_server_o
s_op->u.mkdir.fs_id, s_op->resp.u.mkdir.handle,
ds_attr,
TROVE_SYNC,
- s_op, 0, js_p, &j_id, server_job_context);
+ smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int mkdir_create_dirdata_dspace(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_create_dirdata_dspace(
+ 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_ENOMEM;
job_id_t i;
PVFS_handle_extent_array extent_array;
@@ -207,7 +211,7 @@ static int mkdir_create_dirdata_dspace(
ret = job_trove_dspace_create(
s_op->u.mkdir.fs_id, &extent_array, PVFS_TYPE_DIRDATA, NULL,
TROVE_SYNC,
- s_op, 0, js_p, &i,
+ smcb, 0, js_p, &i,
server_job_context);
free(extent_array.extent_array);
@@ -216,15 +220,16 @@ static int mkdir_create_dirdata_dspace(
return ret;
}
-static int mkdir_write_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_write_dirdata_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 = -PVFS_EINVAL;
job_id_t i;
if (js_p->error_code)
{
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
@@ -252,20 +257,22 @@ static int mkdir_write_dirdata_handle(
s_op->u.mkdir.fs_id, s_op->resp.u.mkdir.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &i, server_job_context);
+ NULL, smcb, 0, js_p, &i, server_job_context);
return ret;
}
-static int mkdir_error(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_error(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
s_op->resp.u.mkdir.handle = 0;
if (js_p->error_code > -1)
{
js_p->error_code = -PVFS_EINVAL;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -279,14 +286,16 @@ static int mkdir_error(PINT_server_op *s
* Synopsis: free memory and return
*
*/
-static int mkdir_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
-static int mkdir_prep_sm(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action mkdir_prep_sm(
+ 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 *a_p = NULL;
PVFS_ds_attributes *ds_attr = NULL;
@@ -299,7 +308,7 @@ static int mkdir_prep_sm(
if (a_p->objtype != PVFS_TYPE_DIRECTORY)
{
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_MKDIR_DEBUG, " attrs to write: [owner = %d, "
@@ -311,7 +320,7 @@ static int mkdir_prep_sm(
PVFS_object_attr_to_ds_attr(a_p, ds_attr);
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/module.mk.in,v
diff -p -u -r1.48 -r1.49
--- module.mk.in 29 Mar 2007 14:20:44 -0000 1.48
+++ module.mk.in 13 Apr 2007 05:14:30 -0000 1.49
@@ -38,7 +38,8 @@ ifdef BUILD_SERVER
$(DIR)/get-eattr.c \
$(DIR)/set-eattr.c \
$(DIR)/del-eattr.c \
- $(DIR)/list-eattr.c
+ $(DIR)/list-eattr.c \
+ $(DIR)/unexpected.c
# c files that should be added to server library
SERVERSRC += \
Index: noop.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/noop.sm,v
diff -p -u -r1.5 -r1.6
--- noop.sm 17 Feb 2007 21:16:48 -0000 1.5
+++ noop.sm 13 Apr 2007 05:14:30 -0000 1.6
@@ -12,7 +12,8 @@
#include "pvfs2-server.h"
-static int noop_cleanup(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action noop_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -44,9 +45,10 @@ machine pvfs2_noop_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int noop_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action noop_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
Index: perf-mon.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/perf-mon.sm,v
diff -p -u -r1.12 -r1.13
--- perf-mon.sm 17 Feb 2007 21:16:48 -0000 1.12
+++ perf-mon.sm 13 Apr 2007 05:14:30 -0000 1.13
@@ -15,8 +15,10 @@
#include "pvfs2-server.h"
#include "pint-perf-counter.h"
-static int perf_mon_cleanup(PINT_server_op *s_op, job_status_s* js_p);
-static int perf_mon_do_work(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action perf_mon_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action perf_mon_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
static uint64_t* static_start_time_array_ms = NULL;
static uint64_t* static_interval_array_ms = NULL;
@@ -64,20 +66,24 @@ machine pvfs2_perf_mon_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int perf_mon_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action perf_mon_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->resp.u.mgmt_perf_mon.perf_array)
free(s_op->resp.u.mgmt_perf_mon.perf_array);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* perf_mon_do_work()
*
* gathers statistics and builds response
*/
-static int perf_mon_do_work(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action perf_mon_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
struct timeval tv;
int i;
int valid_count = 0;
@@ -88,7 +94,7 @@ static int perf_mon_do_work(PINT_server_
#ifdef __PVFS2_DISABLE_PERF_COUNTERS__
gossip_err("Error: perf_mon request received, but perf counters are disabled.\n");
js_p->error_code = -PVFS_ENOSYS;
- return(1);
+ return SM_ACTION_COMPLETE;
#endif
/* allocate memory to hold statistics */
@@ -98,7 +104,7 @@ static int perf_mon_do_work(PINT_server_
if(!s_op->resp.u.mgmt_perf_mon.perf_array)
{
js_p->error_code = -PVFS_ENOMEM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* fill in some of the response */
@@ -119,7 +125,7 @@ static int perf_mon_do_work(PINT_server_
free(s_op->resp.u.mgmt_perf_mon.perf_array);
s_op->resp.u.mgmt_perf_mon.perf_array = NULL;
js_p->error_code = ret;
- return(1);
+ return SM_ACTION_COMPLETE;
}
PINT_perf_retrieve(PINT_server_pc,
@@ -211,7 +217,7 @@ static int perf_mon_do_work(PINT_server_
}
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* reallocate_static_arrays()
Index: perf-update.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/perf-update.sm,v
diff -p -u -r1.9 -r1.10
--- perf-update.sm 17 Feb 2007 21:16:48 -0000 1.9
+++ perf-update.sm 13 Apr 2007 05:14:30 -0000 1.10
@@ -15,8 +15,10 @@
#include "pint-perf-counter.h"
#include "server-config.h"
-static int perf_update_do_work(PINT_server_op *s_op, job_status_s* js_p);
-static int perf_update_error(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action perf_update_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action perf_update_error(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -43,13 +45,14 @@ machine pvfs2_perf_update_sm
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int perf_update_error(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action perf_update_error(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_err("Error: stopping server performance monitoring.\n");
PINT_perf_finalize(PINT_server_pc);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* perf_update_do_work()
@@ -57,7 +60,8 @@ static int perf_update_error(PINT_server
* resets counters, updates metrices, etc- this is intended to be called
* repeatedly on a regular interval
*/
-static int perf_update_do_work(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action perf_update_do_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
job_id_t tmp_id;
uint64_t current_mask = 0;
@@ -94,7 +98,7 @@ static int perf_update_do_work(PINT_serv
/* post another timer */
return(job_req_sched_post_timer(user_opts->perf_update_interval,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
Index: prelude.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/prelude.sm,v
diff -p -u -r1.67 -r1.68
--- prelude.sm 20 Mar 2007 18:32:31 -0000 1.67
+++ prelude.sm 13 Apr 2007 05:14:30 -0000 1.68
@@ -22,16 +22,16 @@
* - post the request to the request scheduler
* - check permissions
*/
-static int prelude_req_sched(
- PINT_server_op *s_op, job_status_s *js_p);
-static int prelude_perm_check(
- PINT_server_op *s_op, job_status_s *js_p);
-static int prelude_getattr_if_needed(
- PINT_server_op *s_op, job_status_s *js_p);
-static int prelude_check_acls_if_needed(
- PINT_server_op *s_op, job_status_s *js_p);
-static int prelude_check_acls(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action prelude_req_sched(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action prelude_perm_check(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action prelude_getattr_if_needed(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action prelude_check_acls_if_needed(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action prelude_check_acls(
+ struct PINT_smcb *smcb, job_status_s *js_p);
enum {
PRELUDE_RUN_ACL_CHECKS = 1,
@@ -80,9 +80,10 @@ nested machine pvfs2_prelude_sm
*
* posts a request scheduler job
*/
-static int prelude_req_sched(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action prelude_req_sched(
+ 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;
gossip_debug(GOSSIP_SERVER_DEBUG,
@@ -107,7 +108,7 @@ static int 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, s_op, 0, js_p,
+ ret = job_req_sched_post(s_op->req, 0, smcb, 0, js_p,
&(s_op->scheduled_id), server_job_context);
PINT_perf_count(PINT_server_pc, PINT_PERF_REQSCHED, 1, PINT_PERF_ADD);
@@ -119,9 +120,10 @@ static int prelude_req_sched(
* reads basic attributes of target object, if there is a particular
* target object for the operation
*/
-static int prelude_getattr_if_needed(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action prelude_getattr_if_needed(
+ 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;
job_id_t tmp_id;
@@ -145,7 +147,7 @@ static int prelude_getattr_if_needed(
ret, llu(s_op->target_handle));
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* if the handle is 0, that indicates that the request does not
@@ -155,7 +157,7 @@ static int prelude_getattr_if_needed(
if (s_op->target_handle == PVFS_HANDLE_NULL)
{
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* all other operations fall to this point and read basic
@@ -167,8 +169,7 @@ static int prelude_getattr_if_needed(
"for handle %llu\n", llu(s_op->target_handle));
ret = job_trove_dspace_getattr(
- s_op->target_fs_id, s_op->target_handle,
- s_op, &(s_op->ds_attr),
+ s_op->target_fs_id, s_op->target_handle, smcb, &(s_op->ds_attr),
0, js_p, &tmp_id, server_job_context);
return ret;
@@ -458,9 +459,10 @@ static int permit_operation(PVFS_fs_id f
* permission checking, it will be replaced by a couple of states that
* actually perform this task later
*/
-static int prelude_perm_check(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action prelude_perm_check(
+ 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 *obj_attr = NULL;
PVFS_ds_attributes *ds_attr = NULL;
PVFS_uid translated_uid = s_op->req->credentials.uid;
@@ -515,7 +517,7 @@ static int prelude_perm_check(
if (permit_operation(fsid, rdonly, s_op->addr) < 0)
{
js_p->error_code = -PVFS_EROFS;
- return 1;
+ return SM_ACTION_COMPLETE;
}
else
{
@@ -545,7 +547,7 @@ static int prelude_perm_check(
if (js_p->error_code)
{
js_p->error_code = -PVFS_ERROR_CODE(-js_p->error_code);
- return(1);
+ return SM_ACTION_COMPLETE;
}
gossip_debug(
@@ -664,13 +666,14 @@ static int prelude_perm_check(
/* If regular checks fail, we need to run acl checks */
if (js_p->error_code == -PVFS_EACCES && !skip_acl_flag)
js_p->error_code = PRELUDE_RUN_ACL_CHECKS;
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int prelude_check_acls_if_needed(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action prelude_check_acls_if_needed(
+ 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;
@@ -685,7 +688,7 @@ static int prelude_check_acls_if_needed(
|| s_op->target_handle == PVFS_HANDLE_NULL)
{
js_p->error_code = -PVFS_EACCES;
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
@@ -697,7 +700,7 @@ static int prelude_check_acls_if_needed(
if (!s_op->val.buffer)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->val.buffer_sz = PVFS_REQ_LIMIT_VAL_LEN;
@@ -712,7 +715,7 @@ static int prelude_check_acls_if_needed(
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -720,9 +723,10 @@ static int prelude_check_acls_if_needed(
return ret;
}
-static int prelude_check_acls(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action prelude_check_acls(
+ 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 *obj_attr = NULL;
int want = 0;
@@ -781,7 +785,7 @@ cleanup:
free(s_op->val.buffer);
memset(&s_op->key, 0, sizeof(PVFS_ds_keyval));
memset(&s_op->val, 0, sizeof(PVFS_ds_keyval));
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
Index: proto-error.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/proto-error.sm,v
diff -p -u -r1.5 -r1.6
--- proto-error.sm 17 Feb 2007 21:16:48 -0000 1.5
+++ proto-error.sm 13 Apr 2007 05:14:30 -0000 1.6
@@ -13,8 +13,10 @@
#include "pvfs2-server.h"
#include "server-config.h"
-static int proto_error_cleanup(PINT_server_op *s_op, job_status_s* js_p);
-static int proto_error_init(PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action proto_error_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action proto_error_init(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -39,8 +41,10 @@ machine pvfs2_proto_error_sm
*
* encode and send a response indicating a protocol error
*/
-static int proto_error_init(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action proto_error_init(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t tmp_id;
struct server_configuration_s *user_opts = get_server_config_struct();
@@ -63,7 +67,7 @@ static int proto_error_init(PINT_server_
* some clues as to what went wrong
*/
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* send the response */
@@ -75,7 +79,7 @@ static int proto_error_init(PINT_server_
s_op->tag,
s_op->encoded.buffer_type,
0,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -90,9 +94,10 @@ static int proto_error_init(PINT_server_
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int proto_error_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action proto_error_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
Index: pvfs2-server.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.c,v
diff -p -u -r1.237 -r1.238
--- pvfs2-server.c 5 Apr 2007 20:58:37 -0000 1.237
+++ pvfs2-server.c 13 Apr 2007 05:14:30 -0000 1.238
@@ -31,7 +31,7 @@
#include "pvfs2-storage.h"
#include "PINT-reqproto-encode.h"
#include "pvfs2-server.h"
-#include "state-machine-fns.h"
+#include "state-machine.h"
#include "mkspace.h"
#include "server-config.h"
#include "quicklist.h"
@@ -93,9 +93,9 @@ static int signal_recvd_flag = 0;
static pid_t server_controlling_pid = 0;
/* A list of all serv_op's posted for unexpected message alone */
-static QLIST_HEAD(posted_sop_list);
+QLIST_HEAD(posted_sop_list);
/* A list of all serv_op's posted for expected messages alone */
-static QLIST_HEAD(inprogress_sop_list);
+QLIST_HEAD(inprogress_sop_list);
/* A list of all serv_op's that are started automatically without requests */
static QLIST_HEAD(noreq_sop_list);
@@ -146,10 +146,10 @@ static int server_shutdown(
PINT_server_status_flag status,
int ret, int sig);
static void server_sig_handler(int sig);
-static int server_post_unexpected_recv(job_status_s * js_p);
+int server_post_unexpected_recv(job_status_s * js_p);
static int server_parse_cmd_line_args(int argc, char **argv);
-static int server_state_machine_start(
- PINT_server_op *s_op, job_status_s *js_p);
+int server_state_machine_start(
+ struct PINT_smcb *smcb, job_status_s *js_p);
#ifdef __PVFS2_SEGV_BACKTRACE__
static void bt_sighandler(int sig, siginfo_t *info, void *secret);
#endif
@@ -418,7 +418,7 @@ int main(int argc, char **argv)
{
int ret = -1, siglevel = 0;
char *fs_conf = NULL, *server_conf = NULL;
- PINT_server_op *tmp_op = NULL;
+ struct PINT_smcb *tmp_op = NULL;
uint64_t debug_mask = 0;
#ifdef WITH_MTRACE
@@ -622,76 +622,26 @@ int main(int argc, char **argv)
*/
for (i = 0; i < comp_ct; i++)
{
- int unexpected_msg = 0;
- PINT_server_op *s_op = server_completed_job_p_array[i];
+ /* int unexpected_msg = 0; */
+ struct PINT_smcb *smcb = server_completed_job_p_array[i];
+ gossip_debug(GOSSIP_SERVER_DEBUG, "PVFS2 Server: job "
+ "completed smcb %p\n", smcb);
+
+ /* NOTE: PINT_state_machine_next() is a function that
+ * is shared with the client-side state machine
+ * processing, so it is defined in the src/common
+ * directory.
+ */
+ ret = PINT_state_machine_next(
+ smcb, &server_job_status_array[i]);
- /* Completed jobs might be ongoing, or might be new
- * (unexpected) ones. We handle the first step of either
- * type here.
- */
- if (s_op->op == BMI_UNEXPECTED_OP)
- {
- unexpected_msg = 1;
- memset(&server_job_status_array[i], 0,
- sizeof(job_status_s));
- ret = server_state_machine_start(
- s_op, &server_job_status_array[i]);
- if (ret < 0)
- {
- PVFS_perror_gossip("Error: server_state_machine_start", ret);
- /* TODO: tell BMI to drop this address? */
- /* set return code to zero to allow server to continue
- * processing
- */
- ret = 0;
- }
- }
- else
- {
- /* NOTE: PINT_state_machine_next() is a function that
- * is shared with the client-side state machine
- * processing, so it is defined in the src/common
- * directory.
- */
- ret = PINT_state_machine_next(
- s_op, &server_job_status_array[i]);
- }
-
- /* Either of the above might have completed immediately
- * (ret == 1). While the job continues to complete
- * immediately, we continue to service it.
- */
- while (ret == 1)
- {
- ret = PINT_state_machine_next(
- s_op, &server_job_status_array[i]);
- }
-
- if (ret < 0)
+ if (SM_ACTION_ISERR(ret)) /* ret < 0 */
{
PVFS_perror_gossip("Error: state machine processing error", ret);
ret = 0;
}
- if (unexpected_msg)
- {
- /* If this was a new (unexpected) job, we need to post
- * a replacement unexpected job so that we can
- * continue to receive incoming requests.
- */
- ret = server_post_unexpected_recv(
- &server_job_status_array[i]);
- if (ret < 0)
- {
- /* TODO: do something here, the return value was
- * not being checked for failure before. I just
- * put something here to make it exit for the
- * moment. -Phil
- */
- gossip_lerr("Error: post unexpected failure not handled.\n");
- goto server_shutdown;
- }
- }
+ /* else ret == SM_ACTION_DEFERED */
}
}
@@ -1714,19 +1664,30 @@ static int server_parse_cmd_line_args(in
*
* Returns 0 on success, -PVFS_error on failure.
*/
-static int server_post_unexpected_recv(job_status_s *js_p)
+int server_post_unexpected_recv(job_status_s *js_p)
{
int ret = -PVFS_EINVAL;
- job_id_t j_id;
- PINT_server_op *s_op = NULL;
+ /* job_id_t j_id; */
+ struct PINT_smcb *smcb = NULL;
+ struct PINT_server_op *s_op;
+
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_post_unexpected_recv\n");
if (js_p)
{
- s_op = (PINT_server_op *) malloc(sizeof(PINT_server_op));
- if (s_op == NULL)
+ ret = PINT_smcb_alloc(&smcb, BMI_UNEXPECTED_OP,
+ sizeof(struct PINT_server_op),
+ server_op_state_get_machine,
+ server_state_machine_terminate,
+ server_job_context);
+ if (ret < 0)
{
- return -PVFS_ENOMEM;
+ gossip_lerr("Error: failed to allocate SMCB "
+ "of op type %x\n", BMI_UNEXPECTED_OP);
+ return ret;
}
+ s_op = (struct PINT_server_op *)PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
memset(s_op, 0, sizeof(PINT_server_op));
s_op->op = BMI_UNEXPECTED_OP;
s_op->target_handle = PVFS_HANDLE_NULL;
@@ -1734,6 +1695,9 @@ static int server_post_unexpected_recv(j
/* Add an unexpected s_ops to the list */
qlist_add_tail(&s_op->next, &posted_sop_list);
+#if 1
+ ret = PINT_state_machine_start(smcb, js_p);
+#else
/*
TODO: Consider the optimization of enabling immediate
completion in this part of the code (see the mailing list
@@ -1742,15 +1706,16 @@ static int server_post_unexpected_recv(j
note: unexp_bmi_buff is really a struct that describes an
unexpected message (it is an output parameter).
*/
- ret = job_bmi_unexp(&s_op->unexp_bmi_buff, s_op, 0,
+ ret = job_bmi_unexp(&s_op->unexp_bmi_buff, smcb, 0,
js_p, &j_id, JOB_NO_IMMED_COMPLETE,
server_job_context);
if (ret < 0)
{
PVFS_perror_gossip("Error: job_bmi_unexp failure", ret);
- free(s_op);
- s_op = NULL;
+ PINT_smcb_free(&smcb);
}
+#endif
+
}
return ret;
}
@@ -1775,10 +1740,13 @@ static int server_purge_unexpected_recv_
PINT_server_op *s_op = qlist_entry(tmp, PINT_server_op, next);
/* Remove s_op from the posted_sop_list */
- qlist_del(&s_op->next);
+ /* don't see a reason to remove this */
+ /* will be removed in state machine */
+ /* if and when message completes after cancellation */
+ /* qlist_del(&s_op->next); */
- /* free the operation structure itself */
- free(s_op);
+ /* mark the message for cancellation */
+ s_op->op_cancelled = 1;
}
return 0;
}
@@ -1790,13 +1758,17 @@ static int server_purge_unexpected_recv_
*
* returns 0 on success, -PVFS_errno on failure
*/
-static int server_state_machine_start(
- PINT_server_op *s_op,
+int server_state_machine_start(
+ PINT_smcb *smcb,
job_status_s *js_p)
{
+ PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
PVFS_id_gen_t tmp_id;
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_state_machine_start %p\n",smcb);
+
ret = PINT_decode(s_op->unexp_bmi_buff.buffer,
PINT_DECODE_REQ,
&s_op->decoded,
@@ -1814,11 +1786,11 @@ static int server_state_machine_start(
* response that gives a helpful error on client side even
* though we can't interpret what the client was asking for
*/
- s_op->op = PVFS_SERV_PROTO_ERROR;
+ ret = PINT_smcb_set_op(smcb, PVFS_SERV_PROTO_ERROR);
}
else if (ret == 0)
{
- s_op->op = s_op->req->op;
+ ret = PINT_smcb_set_op(smcb, s_op->req->op);
}
else
{
@@ -1836,9 +1808,8 @@ static int server_state_machine_start(
s_op->addr = s_op->unexp_bmi_buff.addr;
s_op->tag = s_op->unexp_bmi_buff.tag;
- s_op->current_state = PINT_state_machine_locate(s_op);
- if (!s_op->current_state)
+ if (!ret)
{
gossip_err("Error: server does not implement request type: %d\n",
(int)s_op->req->op);
@@ -1846,8 +1817,8 @@ static int server_state_machine_start(
return -PVFS_ENOSYS;
}
- s_op->resp.op = s_op->op;
- return PINT_state_machine_invoke(s_op,js_p);
+ s_op->resp.op = s_op->req->op;
+ return PINT_state_machine_invoke(smcb, js_p);
}
/* server_state_machine_alloc_noreq()
@@ -1859,34 +1830,36 @@ static int server_state_machine_start(
*/
int server_state_machine_alloc_noreq(
enum PVFS_server_op op,
- PINT_server_op **new_op)
+ struct PINT_smcb **new_op)
{
int ret = -PVFS_EINVAL;
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_state_machine_alloc_noreq %d\n",op);
+
if (new_op)
{
- *new_op = (PINT_server_op*)malloc(sizeof(PINT_server_op));
- if (!(*new_op))
+ PINT_server_op *tmp_op;
+ ret = PINT_smcb_alloc(new_op, op,
+ sizeof(struct PINT_server_op),
+ server_op_state_get_machine,
+ server_state_machine_terminate,
+ server_job_context);
+ if (ret < 0)
{
- return -PVFS_ENOMEM;
+ gossip_lerr("Error: failed to allocate SMCB "
+ "of op type %x\n", op);
+ return ret;
}
- memset(*new_op, 0, sizeof(PINT_server_op));
- (*new_op)->op = op;
- (*new_op)->target_handle = PVFS_HANDLE_NULL;
- (*new_op)->target_fs_id = PVFS_FS_ID_NULL;
+ tmp_op = PINT_sm_frame(*new_op, PINT_FRAME_CURRENT);
+ tmp_op->op = op;
+ tmp_op->target_handle = PVFS_HANDLE_NULL;
+ tmp_op->target_fs_id = PVFS_FS_ID_NULL;
- /* NOTE: We do not add these state machines to the in-progress or posted sop lists */
-
- /* find the state machine for this op type */
- (*new_op)->current_state = PINT_state_machine_locate(*new_op);
+ /* NOTE: We do not add these state machines to the
+ * in-progress or posted sop lists
+ */
- if (!((*new_op)->current_state))
- {
- gossip_lerr("Error: failed to start state machine "
- "of op type %x\n", op);
- free(*new_op);
- return -PVFS_ENOSYS;
- }
ret = 0;
}
return ret;
@@ -1903,11 +1876,15 @@ int server_state_machine_alloc_noreq(
*
* returns 0 on success, -PVFS_error on failure
*/
-int server_state_machine_start_noreq(PINT_server_op *new_op)
+int server_state_machine_start_noreq(struct PINT_smcb *smcb)
{
+ struct PINT_server_op *new_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
job_status_s tmp_status;
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_state_machine_start_noreq %p\n",smcb);
+
tmp_status.error_code = 0;
if (new_op)
@@ -1916,24 +1893,12 @@ int server_state_machine_start_noreq(PIN
qlist_add_tail(&new_op->next, &noreq_sop_list);
/* execute first state */
- ret = PINT_state_machine_invoke(new_op, &tmp_status);
+ ret = PINT_state_machine_start(smcb, &tmp_status);
if (ret < 0)
{
gossip_lerr("Error: failed to start state machine.\n");
return ret;
}
-
- /* continue as long as states are immediately completing */
- while(ret == 1)
- {
- ret = PINT_state_machine_next(new_op, &tmp_status);
- }
-
- if (ret < 0)
- {
- gossip_lerr("Error: unhandled state machine processing "
- "error (most likely an unhandled job error).\n");
- }
}
return ret;
}
@@ -1947,9 +1912,13 @@ int server_state_machine_start_noreq(PIN
*
* returns 0
*/
-int server_state_machine_complete(PINT_server_op *s_op)
+int server_state_machine_complete(PINT_smcb *smcb)
{
+ PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
PVFS_id_gen_t tmp_id;
+
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_state_machine_complete %p\n",smcb);
/* set a timestamp on the completion of the state machine */
id_gen_fast_register(&tmp_id, s_op);
@@ -1969,10 +1938,17 @@ int server_state_machine_complete(PINT_s
/* Remove s_op from the inprogress_sop_list */
qlist_del(&s_op->next);
- /* free the operation structure itself */
- free(s_op);
+ return SM_ACTION_TERMINATE;
+}
- return 0;
+int server_state_machine_terminate(
+ struct PINT_smcb *smcb, job_status_s *js_p)
+{
+ /* free the operation structure itself */
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_state_machine_terminate %p\n",smcb);
+ PINT_smcb_free(&smcb);
+ return SM_ACTION_TERMINATE;
}
struct server_configuration_s *get_server_config_struct(void)
@@ -2009,6 +1985,36 @@ static int parse_port_from_host_id(char*
}
return(port_num);
+}
+
+/* server_op_get_machine()
+ *
+ * looks up the state machine for the op * given and returns it, or
+ * NULL of the op is out of range.
+ * pointer to this function set in the control block of server state
+ * machines.
+ */
+struct PINT_state_machine_s *server_op_state_get_machine(int op)
+{
+ gossip_debug(GOSSIP_SERVER_DEBUG,
+ "server_op_state_get_machine %d\n",op);
+
+ switch (op)
+ {
+ case BMI_UNEXPECTED_OP :
+ {
+ return &pvfs2_unexpected_sm;
+ break;
+ }
+ default :
+ {
+ if (op >= 0 && op < PVFS_SERV_NUM_OPS)
+ return PINT_server_req_table[op].sm;
+ else
+ return NULL;
+ break;
+ }
+ }
}
static TROVE_method_id trove_coll_to_method_callback(TROVE_coll_id coll_id)
Index: pvfs2-server.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/pvfs2-server.h,v
diff -p -u -r1.146 -r1.147
--- pvfs2-server.h 29 Mar 2007 14:20:44 -0000 1.146
+++ pvfs2-server.h 13 Apr 2007 05:14:30 -0000 1.147
@@ -30,6 +30,7 @@
#include "PINT-reqproto-encode.h"
#include "msgpairarray.h"
#include "pvfs2-req-proto.h"
+#include "state-machine.h"
/* skip everything except #includes if __SM_CHECK_DEP is already
* defined; this allows us to get the dependencies right for
@@ -39,8 +40,6 @@
#ifndef __SM_CHECK_DEP
extern job_context_id server_job_context;
-/* size of stack for nested state machines */
-#define PINT_STATE_STACK_SIZE 8
#define PVFS2_SERVER_DEFAULT_TIMEOUT_MS 100
#define BMI_UNEXPECTED_OP 999
@@ -316,13 +315,8 @@ struct PINT_server_eattr_op
typedef struct PINT_server_op
{
struct qlist_head next; /* used to queue structures used for unexp style messages */
+ int op_cancelled; /* indicates unexp message was cancelled */
enum PVFS_server_op op; /* type of operation that we are servicing */
- /* the following fields are used in state machine processing to keep
- * track of the current state
- */
- int stackptr;
- union PINT_state_array_values *current_state;
- union PINT_state_array_values *state_stack[PINT_STATE_STACK_SIZE];
/* holds id from request scheduler so we can release it later */
job_id_t scheduled_id;
@@ -432,6 +426,7 @@ extern struct PINT_state_machine_s pvfs2
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;
@@ -459,22 +454,32 @@ extern struct PINT_state_machine_s pvfs2
struct server_configuration_s *get_server_config_struct(void);
/* exported state machine resource reclamation function */
-int server_state_machine_complete(PINT_server_op *s_op);
+int server_post_unexpected_recv(job_status_s *js_p);
+int server_state_machine_start( PINT_smcb *smcb, job_status_s *js_p);
+int server_state_machine_complete(PINT_smcb *smcb);
+int server_state_machine_terminate(PINT_smcb *smcb, job_status_s *js_p);
+
+/* lists of server ops */
+extern struct qlist_head posted_sop_list;
+extern struct qlist_head inprogress_sop_list;
/* starts state machines not associated with an incoming request */
int server_state_machine_alloc_noreq(
- enum PVFS_server_op op, PINT_server_op** new_op);
+ enum PVFS_server_op op, struct PINT_smcb ** new_op);
int server_state_machine_start_noreq(
- PINT_server_op *new_op);
+ struct PINT_smcb *new_op);
/* INCLUDE STATE-MACHINE.H DOWN HERE */
+#if 0
#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)
+#endif
-#include "state-machine.h"
#include "pvfs2-internal.h"
+
+struct PINT_state_machine_s *server_op_state_get_machine(int);
#endif /* __SM_CHECK_DEP */
#endif /* __PVFS_SERVER_H */
Index: readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/readdir.sm,v
diff -p -u -r1.49 -r1.50
--- readdir.sm 15 Mar 2007 21:45:32 -0000 1.49
+++ readdir.sm 13 Apr 2007 05:14:30 -0000 1.50
@@ -22,16 +22,16 @@ enum
STATE_ENOTDIR = 7
};
-static int readdir_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int readdir_read_dirdata_handle(
- PINT_server_op *s_op, job_status_s* js_p);
-static int readdir_iterate_on_entries(
- PINT_server_op *s_op, job_status_s* js_p);
-static int readdir_verify_directory_metadata(
- PINT_server_op *s_op, job_status_s* js_p);
-static int readdir_setup_resp(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action readdir_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action readdir_read_dirdata_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action readdir_iterate_on_entries(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action readdir_verify_directory_metadata(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action readdir_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -85,9 +85,10 @@ machine pvfs2_readdir_sm
%%
-static int readdir_verify_directory_metadata(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action readdir_verify_directory_metadata(
+ 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 *attr = &s_op->attr;
js_p->error_code = 0;
@@ -106,12 +107,13 @@ static int readdir_verify_directory_meta
}
s_op->u.readdir.directory_version = (uint64_t)attr->mtime;
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int readdir_read_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action readdir_read_dirdata_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 = -PVFS_EINVAL;
job_id_t i;
@@ -132,15 +134,16 @@ static int readdir_read_dirdata_handle(
s_op->req->u.readdir.fs_id, s_op->req->u.readdir.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p, &i,
+ NULL, smcb, 0, js_p, &i,
server_job_context);
return ret;
}
-static int readdir_iterate_on_entries(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action readdir_iterate_on_entries(
+ 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 j = 0, memory_size = 0, kv_array_size = 0;
char *memory_buffer = NULL;
@@ -153,13 +156,13 @@ static int readdir_iterate_on_entries(
if (s_op->req->u.readdir.dirent_count == 0)
{
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
if (s_op->req->u.readdir.dirent_count > PVFS_REQ_LIMIT_DIRENT_COUNT)
{
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -178,7 +181,7 @@ static int readdir_iterate_on_entries(
if (!memory_buffer)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* set up all the pointers into the one big buffer */
@@ -212,28 +215,28 @@ static int readdir_iterate_on_entries(
s_op->req->u.readdir.token, s_op->key_a, s_op->val_a,
s_op->req->u.readdir.dirent_count,
0,
- NULL, s_op, 0, js_p,
+ NULL, smcb, 0, js_p,
&j_id, server_job_context);
return ret;
}
-static int readdir_setup_resp(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action readdir_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 == STATE_ENOTDIR)
{
gossip_debug(GOSSIP_READDIR_DEBUG,
" handle didn't refer to a directory\n");
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
else if(js_p->error_code != 0)
{
PVFS_perror_gossip("readdir_setup_resp failed: ", js_p->error_code);
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->resp.u.readdir.directory_version =
@@ -248,12 +251,13 @@ static int readdir_setup_resp(
*/
s_op->resp.u.readdir.token = js_p->position;
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int readdir_cleanup(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action readdir_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);
@@ -261,7 +265,7 @@ static int readdir_cleanup(
s_op->val_a = NULL;
s_op->resp.u.readdir.dirent_array = NULL;
}
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: remove.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/remove.sm,v
diff -p -u -r1.55 -r1.56
--- remove.sm 17 Feb 2007 21:16:48 -0000 1.55
+++ remove.sm 13 Apr 2007 05:14:30 -0000 1.56
@@ -59,24 +59,25 @@ enum
STATE_TYPE_DATAFILE = 2,
};
-static int remove_check_object_type(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_verify_object_metadata(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_remove_dspace(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_read_dirdata_handle(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_check_dirdata_entries(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_remove_dirdata_dspace(
- PINT_server_op *s_op, job_status_s *js_p);
-static int remove_setup_work(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action remove_check_object_type(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_verify_object_metadata(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_remove_dspace(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_read_dirdata_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_check_dirdata_entries(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_remove_dirdata_dspace(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action remove_setup_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+extern PINT_server_trove_keys_s Trove_Common_Keys[];
%%
@@ -178,20 +179,21 @@ machine pvfs2_remove_sm
* retrive object attributes earlier
*
*/
-static int remove_check_object_type(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_check_object_type(
+ 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->attr.objtype == PVFS_TYPE_DATAFILE)
{
/* it must be a datafile, transition to try reading datafile
* attribs with dspace_getattr()
*/
js_p->error_code = STATE_TYPE_DATAFILE;
- return(1);
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/*
@@ -206,9 +208,10 @@ static int remove_check_object_type(PINT
* Note: errors from the previous state are redirected elsewhere, so
* we know that we have metadata if we make it here.
*/
-static int remove_verify_object_metadata(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_verify_object_metadata(
+ 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 *a_p;
a_p = &s_op->attr;
@@ -232,12 +235,13 @@ static int remove_verify_object_metadata
"dirdata object before removing directory itself.\n");
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int remove_read_dirdata_handle(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_read_dirdata_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;
job_id_t j_id;
@@ -259,21 +263,22 @@ static int remove_read_dirdata_handle(PI
s_op->u.remove.fs_id, s_op->u.remove.handle,
&s_op->key, &s_op->val,
0,
- NULL, s_op, 0, js_p,
+ NULL, smcb, 0, js_p,
&j_id, server_job_context);
return ret;
}
-static int remove_get_dirent_count(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action remove_get_dirent_count(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t tmp_id;
if (js_p->error_code)
{
- return 1;
+ return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
@@ -286,7 +291,7 @@ static int remove_get_dirent_count(
1,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -295,9 +300,10 @@ static int remove_get_dirent_count(
return ret;
}
-static int remove_check_dirdata_entries(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action remove_check_dirdata_entries(
+ 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)
{
if(js_p->count > 0)
@@ -317,7 +323,8 @@ static int remove_check_dirdata_entries(
js_p->error_code = 0;
}
- return 1;
+ /* setup position for next state (remove[_dirdata]_keyvals) */
+ return SM_ACTION_COMPLETE;
}
/*
@@ -326,9 +333,10 @@ static int remove_check_dirdata_entries(
* Remove the dirdata dspace using the handle that we ready in the
* read_dirdata_handle state.
*/
-static int remove_remove_dirdata_dspace(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_remove_dirdata_dspace(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t j_id;
gossip_debug(GOSSIP_SERVER_DEBUG,
@@ -339,7 +347,7 @@ static int remove_remove_dirdata_dspace(
s_op->u.remove.fs_id,
s_op->u.remove.dirdata_handle,
0, /* don't sync here, we do a dspace remove on the dir handle next */
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -354,9 +362,10 @@ static int remove_remove_dirdata_dspace(
* Remove the dspace using the handle from the incoming request
* (which was verified in previous states).
*/
-static int remove_remove_dspace(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_remove_dspace(
+ 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 j_id;
gossip_debug(GOSSIP_SERVER_DEBUG, "(%p) remove: removing dspace "
@@ -366,7 +375,7 @@ static int remove_remove_dspace(PINT_ser
ret = job_trove_dspace_remove(
s_op->u.remove.fs_id, s_op->u.remove.handle,
TROVE_SYNC,
- s_op, 0, js_p,
+ smcb, 0, js_p,
&j_id, server_job_context);
return ret;
@@ -378,19 +387,20 @@ static int remove_remove_dspace(PINT_ser
* Free all memory associated with this request and return 0, indicating
* we're done processing.
*/
-static int remove_cleanup(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action remove_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
-static int remove_setup_work(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action remove_setup_work(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
s_op->u.remove.handle = s_op->req->u.remove.handle;
s_op->u.remove.fs_id = s_op->req->u.remove.fs_id;
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
Index: rmdirent.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/rmdirent.sm,v
diff -p -u -r1.53 -r1.54
--- rmdirent.sm 17 Feb 2007 21:16:48 -0000 1.53
+++ rmdirent.sm 13 Apr 2007 05:14:30 -0000 1.54
@@ -19,20 +19,20 @@ enum
UPDATE_DIR_ATTR_REQUIRED = 133
};
-static int rmdirent_verify_parent_metadata_and_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p);
-static int rmdirent_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int rmdirent_remove_directory_entry(
- PINT_server_op *s_op, job_status_s* js_p);
-static int rmdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p);
-static int rmdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p);
-static int rmdirent_remove_directory_entry_failure(
- PINT_server_op *s_op, job_status_s* js_p);
-static int rmdirent_setup_resp(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action rmdirent_verify_parent_metadata_and_read_directory_entry_handle(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_remove_directory_entry(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_check_for_req_dir_update(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_update_directory_attr(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_remove_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action rmdirent_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -100,8 +100,9 @@ machine pvfs2_rmdirent_sm
%%
static int rmdirent_verify_parent_metadata_and_read_directory_entry_handle(
- PINT_server_op *s_op, job_status_s* js_p)
+ 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;
@@ -135,7 +136,7 @@ static int rmdirent_verify_parent_metada
&s_op->val,
0,
NULL,
- s_op,
+ smcb,
0,
js_p,
&i,
@@ -151,9 +152,10 @@ static int rmdirent_verify_parent_metada
* from the dirdata object.
*
*/
-static int rmdirent_remove_directory_entry(PINT_server_op *s_op,
- job_status_s* js_p)
+static int rmdirent_remove_directory_entry(
+ 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 j_id;
TROVE_ds_flags flags;
@@ -182,7 +184,7 @@ static int rmdirent_remove_directory_ent
&s_op->key,
&s_op->val,
flags,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
/*
* Removing an entry causes an update of directory timestamps
@@ -191,20 +193,22 @@ static int rmdirent_remove_directory_ent
return ret;
}
-static int rmdirent_check_for_req_dir_update(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action rmdirent_check_for_req_dir_update(
+ 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->u.rmdirent.dir_attr_update_required))
{
js_p->error_code = UPDATE_DIR_ATTR_REQUIRED;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int rmdirent_update_directory_attr(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action rmdirent_update_directory_attr(
+ 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 tmp_attr, *tmp_attr_ptr = &tmp_attr;
@@ -215,7 +219,7 @@ static int rmdirent_update_directory_att
{
PVFS_perror_gossip("previous keyval remove failed",
js_p->error_code);
- return 1;
+ return SM_ACTION_COMPLETE;
}
memset(&tmp_attr, 0, sizeof(PVFS_object_attr));
@@ -230,7 +234,7 @@ static int rmdirent_update_directory_att
s_op->req->u.rmdirent.fs_id, s_op->req->u.rmdirent.parent_handle,
ds_attr,
TROVE_SYNC,
- s_op, 0, js_p, &j_id, server_job_context);
+ smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
@@ -250,8 +254,8 @@ static int rmdirent_update_directory_att
* This state always returns 1, and it allows another function to
* handle actually returning the error value.
*/
-static int rmdirent_remove_directory_entry_failure(PINT_server_op *s_op,
- job_status_s *js_p)
+static PINT_sm_action rmdirent_remove_directory_entry_failure(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
switch (js_p->error_code)
{
@@ -263,12 +267,13 @@ static int rmdirent_remove_directory_ent
break;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int rmdirent_setup_resp(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action rmdirent_setup_resp(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
/* Set the handle if it was removed */
if(js_p->error_code == 0)
{
@@ -291,13 +296,13 @@ static int rmdirent_setup_resp(PINT_serv
* we found it, so that later states can use it to set the resp.status
* field.
*/
- return(1);
+ return SM_ACTION_COMPLETE;
}
-static int rmdirent_cleanup(PINT_server_op *s_op,
- job_status_s* js_p)
+static PINT_sm_action rmdirent_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: set-attr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/set-attr.sm,v
diff -p -u -r1.70 -r1.71
--- set-attr.sm 17 Feb 2007 21:16:48 -0000 1.70
+++ set-attr.sm 13 Apr 2007 05:14:30 -0000 1.71
@@ -20,18 +20,18 @@ enum
STATE_SYMLINK = 8
};
-static int setattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
-static int setattr_setobj_attribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int setattr_write_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int setattr_write_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int setattr_write_symlink_target_if_required(
- PINT_server_op *s_op, job_status_s *js_p);
-static int setattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action setattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setattr_setobj_attribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setattr_write_metafile_datafile_handles_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setattr_write_metafile_distribution_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setattr_write_symlink_target_if_required(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setattr_verify_attribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -95,9 +95,10 @@ machine pvfs2_set_attr_sm
%%
-static int setattr_verify_attribs(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setattr_verify_attribs(
+ 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 *a_p = NULL, *req_a_p = NULL;
a_p = &s_op->attr;
@@ -129,7 +130,7 @@ static int setattr_verify_attribs(
/* set an error to bail out of set-attr processing */
js_p->error_code = -PVFS_EACCES;
- return 1;
+ return SM_ACTION_COMPLETE;
}
else if (req_a_p->objtype == PVFS_TYPE_NONE)
{
@@ -241,11 +242,13 @@ static int setattr_verify_attribs(
js_p->error_code = -PVFS_EACCES;
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int setattr_setobj_attribs(PINT_server_op *s_op, job_status_s *js_p)
+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;
@@ -288,7 +291,7 @@ static int setattr_setobj_attribs(PINT_s
{
gossip_debug(GOSSIP_SETATTR_DEBUG, "Cannot change perms of symlink: Permission denied\n");
js_p->error_code = -PVFS_EPERM;
- return(1);
+ return SM_ACTION_COMPLETE;
}
}
@@ -319,14 +322,15 @@ static int setattr_setobj_attribs(PINT_s
s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle,
ds_attr,
TROVE_SYNC,
- s_op, 0, js_p, &j_id, server_job_context);
+ smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int setattr_write_metafile_datafile_handles_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setattr_write_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 = 0, dfile_count = 0;
job_id_t j_id;
@@ -345,7 +349,7 @@ static int setattr_write_metafile_datafi
gossip_err("The requested dfile count of %d is invalid; "
"aborting operation.\n", dfile_count);
js_p->error_code = -PVFS_EOVERFLOW;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* set up key and value structure for keyval write */
@@ -372,26 +376,25 @@ static int setattr_write_metafile_datafi
s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle,
&(s_op->key), &(s_op->val),
0,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int setattr_write_metafile_distribution_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setattr_write_metafile_distribution_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 = 0;
job_id_t j_id;
- assert(js_p->error_code == 0);
-
/* if we don't need to fill in the distribution, skip it */
if (!(s_op->req->u.setattr.attr.mask & PVFS_ATTR_META_DIST))
{
gossip_debug(GOSSIP_SETATTR_DEBUG,
"skipping distribution write\n");
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* set up key and value structure for keyval write */
@@ -408,7 +411,7 @@ static int setattr_write_metafile_distri
if(!s_op->val.buffer)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->free_val = 1;
@@ -424,14 +427,15 @@ static int setattr_write_metafile_distri
s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle,
&(s_op->key), &(s_op->val),
TROVE_SYNC,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
-static int setattr_write_symlink_target_if_required(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setattr_write_symlink_target_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 = 0;
job_id_t j_id;
@@ -441,7 +445,7 @@ static int setattr_write_symlink_target_
gossip_debug(GOSSIP_SETATTR_DEBUG,
"skipping symlink target write\n");
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
assert(s_op->req->u.setattr.attr.u.sym.target_path_len > 0);
@@ -468,7 +472,7 @@ static int setattr_write_symlink_target_
s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle,
&(s_op->key), &(s_op->val),
TROVE_SYNC,
- NULL, s_op, 0, js_p, &j_id, server_job_context);
+ NULL, smcb, 0, js_p, &j_id, server_job_context);
return ret;
}
@@ -484,13 +488,15 @@ static int setattr_write_symlink_target_
* Synopsis: free memory and return
*
*/
-static int setattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setattr_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->free_val)
{
free(s_op->val.buffer);
}
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
Index: set-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/set-eattr.sm,v
diff -p -u -r1.15 -r1.16
--- set-eattr.sm 29 Mar 2007 14:20:44 -0000 1.15
+++ set-eattr.sm 13 Apr 2007 05:14:30 -0000 1.16
@@ -15,12 +15,14 @@
#include "pint-util.h"
#include "pint-eattr.h"
-static int seteattr_verify_eattribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int seteattr_setobj_eattribs(
- PINT_server_op *s_op, job_status_s *js_p);
-static int seteattr_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+extern PINT_server_trove_keys_s Trove_Common_Keys[];
+
+static PINT_sm_action seteattr_verify_eattribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action seteattr_setobj_eattribs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action seteattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -66,8 +68,9 @@ machine pvfs2_set_eattr_sm
* It also prints debugging information.
*/
static int seteattr_verify_eattribs(
- PINT_server_op *s_op, job_status_s *js_p)
+ 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 *a_p = NULL;
a_p = &s_op->attr;
int i;
@@ -89,11 +92,11 @@ static int seteattr_verify_eattribs(
&s_op->req->u.seteattr.val[i]);
if(!js_p->error_code)
{
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
/*
@@ -112,8 +115,9 @@ static int seteattr_verify_eattribs(
* (TROVE_NOOVERWRITE, TROVE_ONLYOVERWRITE)
*/
static int seteattr_setobj_eattribs(
- PINT_server_op *s_op, job_status_s *js_p)
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = 0;
PVFS_ds_flags trove_flags = 0;
job_id_t j_id;
@@ -143,7 +147,7 @@ static int seteattr_setobj_eattribs(
s_op->req->u.seteattr.nkey,
trove_flags,
NULL,
- s_op,
+ smcb,
0,
js_p,
&j_id,
@@ -163,10 +167,11 @@ static int seteattr_setobj_eattribs(
* Synopsis: free memory and return
*
*/
-static int seteattr_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static int seteattr_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
/* do I need to free memory from decoding key and val?*/
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/*
@@ -178,4 +183,3 @@ static int seteattr_cleanup(PINT_server_
*
* vim: ft=c ts=8 sts=4 sw=4 expandtab
*/
-
Index: setparam.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/setparam.sm,v
diff -p -u -r1.31 -r1.32
--- setparam.sm 17 Feb 2007 21:16:48 -0000 1.31
+++ setparam.sm 13 Apr 2007 05:14:30 -0000 1.32
@@ -16,10 +16,10 @@
#include "pint-event.h"
#include "pvfs2-internal.h"
-static int setparam_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int setparam_work(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action setparam_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action setparam_work(
+ struct PINT_smcb *smcb, job_status_s *js_p);
static int check_fs_id(PVFS_fs_id fs_id);
@@ -59,8 +59,10 @@ machine pvfs2_setparam_sm
*
* actually does the "work" involved in setting a runtime server parameter
*/
-static int setparam_work(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action setparam_work(
+ 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, tmp_on = 0, old_event_on = 0;
job_id_t tmp_id;
uint64_t tmp_mask = 0;
@@ -78,17 +80,17 @@ static int setparam_work(PINT_server_op
gossip_set_debug_mask(
1, s_op->req->u.mgmt_setparam.value);
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_INVALID:
gossip_lerr("Error: mgmt_setparam for unknown parameter %d.\n",
(int)s_op->req->u.mgmt_setparam.param);
js_p->error_code = -PVFS_ENOSYS;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_FSID_CHECK:
s_op->resp.u.mgmt_setparam.old_value = 0;
js_p->error_code = check_fs_id(
(PVFS_fs_id)s_op->req->u.mgmt_setparam.value);
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_ROOT_CHECK:
tmp_handle = (PVFS_handle)s_op->req->u.mgmt_setparam.value;
s_op->resp.u.mgmt_setparam.old_value = 0;
@@ -98,7 +100,7 @@ static int setparam_work(PINT_server_op
ret = job_trove_dspace_verify(
s_op->req->u.mgmt_setparam.fs_id, tmp_handle,
0,
- s_op, 0, js_p, &tmp_id, server_job_context);
+ smcb, 0, js_p, &tmp_id, server_job_context);
return(ret);
case PVFS_SERV_PARAM_EVENT_ON:
ret = 0;
@@ -109,7 +111,7 @@ static int setparam_work(PINT_server_op
old_api_mask, old_op_mask);
s_op->resp.u.mgmt_setparam.old_value = old_event_on;
js_p->error_code = ret;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_EVENT_MASKS:
PINT_event_get_masks(
&old_event_on, &old_api_mask, &old_op_mask);
@@ -119,7 +121,7 @@ static int setparam_work(PINT_server_op
s_op->resp.u.mgmt_setparam.old_value = old_api_mask +
((int64_t)old_op_mask << 32);
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_SYNC_META:
user_opts = get_server_config_struct();
fs_conf = PINT_config_find_fs_id(user_opts,
@@ -132,7 +134,7 @@ static int setparam_work(PINT_server_op
fs_conf->trove_sync_meta = 0;
}
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_SYNC_DATA:
user_opts = get_server_config_struct();
fs_conf = PINT_config_find_fs_id(user_opts,
@@ -155,18 +157,18 @@ static int setparam_work(PINT_server_op
}
}
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
case PVFS_SERV_PARAM_MODE:
/* no work to do here; request scheduler has already handled */
js_p->error_code = 0;
- return(1);
+ return SM_ACTION_COMPLETE;
}
gossip_lerr("Error: mgmt_setparam for unknown parameter %d.\n",
(int)s_op->req->u.mgmt_setparam.param);
js_p->error_code = -PVFS_ENOSYS;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* setparam_cleanup()
@@ -174,11 +176,12 @@ static int setparam_work(PINT_server_op
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int setparam_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action setparam_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
gossip_debug(GOSSIP_SERVER_DEBUG, " - setparam returning %d\n",
js_p->error_code);
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
/* check_fs_id()
Index: small-io.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/small-io.sm,v
diff -p -u -r1.17 -r1.18
--- small-io.sm 17 Feb 2007 21:16:48 -0000 1.17
+++ small-io.sm 13 Apr 2007 05:14:30 -0000 1.18
@@ -18,9 +18,12 @@
#include "pint-distribution.h"
#include "pint-request.h"
-static int small_io_start_job(PINT_server_op *s_op, job_status_s *js_p);
-static int small_io_check_size(PINT_server_op *s_op, job_status_s *js_p);
-static int small_io_cleanup(PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action small_io_start_job(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action small_io_check_size(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action small_io_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -60,8 +63,10 @@ machine pvfs2_small_io_sm
%%
-static int small_io_start_job(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action small_io_start_job(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
+ struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret;
job_id_t tmp_id;
PINT_Request_state * file_req_state;
@@ -81,9 +86,9 @@ static int small_io_start_job(PINT_serve
if(s_op->req->u.small_io.io_type == PVFS_IO_READ &&
s_op->ds_attr.b_size == 0)
{
- /* nothing to read. return 0 */
+ /* nothing to read. return SM_ACTION_DEFERRED */
js_p->error_code = 0;
- return 1;
+ return SM_ACTION_COMPLETE;
}
file_req_state = PINT_new_request_state(
@@ -120,7 +125,7 @@ static int small_io_start_job(PINT_serve
{
gossip_err("small_io: Failed to process file request\n");
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* figure out if the fs config has trove data sync turned on or off
@@ -130,7 +135,7 @@ static int small_io_start_job(PINT_serve
{
gossip_err("small_io: server config is NULL!\n");
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
fs_config = PINT_config_find_fs_id(
@@ -141,7 +146,7 @@ static int small_io_start_job(PINT_serve
"config from fs_id of: %d\n",
s_op->req->u.small_io.fs_id);
js_p->error_code = -PVFS_EINVAL;
- return 1;
+ return SM_ACTION_COMPLETE;
}
if(s_op->req->u.small_io.io_type == PVFS_IO_WRITE)
@@ -158,7 +163,7 @@ static int small_io_start_job(PINT_serve
&s_op->resp.u.small_io.result_size,
(fs_config->trove_sync_data ? TROVE_SYNC : 0),
NULL,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -176,7 +181,7 @@ static int small_io_start_job(PINT_serve
if(!s_op->resp.u.small_io.buffer)
{
js_p->error_code = -PVFS_ENOMEM;
- return 1;
+ return SM_ACTION_COMPLETE;
}
s_op->u.small_io.result_bytes = result.bytes;
@@ -192,7 +197,7 @@ static int small_io_start_job(PINT_serve
&s_op->resp.u.small_io.result_size,
(fs_config->trove_sync_data ? TROVE_SYNC : 0),
NULL,
- s_op,
+ smcb,
0,
js_p,
&tmp_id,
@@ -201,7 +206,7 @@ static int small_io_start_job(PINT_serve
{
gossip_err("small-io: Failed to post trove bstream read\n");
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
}
@@ -210,8 +215,10 @@ static int small_io_start_job(PINT_serve
return ret;
}
-static int small_io_check_size(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action small_io_check_size(
+ 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->req->u.small_io.io_type == PVFS_IO_READ)
{
if(s_op->resp.u.small_io.result_size !=
@@ -224,11 +231,13 @@ static int small_io_check_size(PINT_serv
}
}
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int small_io_cleanup(PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action small_io_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->req->u.small_io.io_type == PVFS_IO_READ &&
s_op->resp.u.small_io.buffer)
{
@@ -236,7 +245,7 @@ static int small_io_cleanup(PINT_server_
s_op->req->u.small_io.total_bytes, BMI_SEND);
}
- return server_state_machine_complete(s_op);
+ return server_state_machine_complete(smcb);
}
/*
Index: statfs.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/statfs.sm,v
diff -p -u -r1.14 -r1.15
--- statfs.sm 17 Feb 2007 21:16:48 -0000 1.14
+++ statfs.sm 13 Apr 2007 05:14:30 -0000 1.15
@@ -19,10 +19,10 @@
#include <sys/sysinfo.h>
#endif
-static int statfs_cleanup(
- PINT_server_op *s_op, job_status_s* js_p);
-static int statfs_do_statfs(
- PINT_server_op *s_op, job_status_s* js_p);
+static PINT_sm_action statfs_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action statfs_do_statfs(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -59,8 +59,10 @@ machine pvfs2_statfs_sm
*
* issue the trove call to retrieve fs statistics
*/
-static int statfs_do_statfs(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action statfs_do_statfs(
+ 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;
TROVE_context_id tmp_context;
struct server_configuration_s *user_opts = get_server_config_struct();
@@ -73,7 +75,7 @@ static int statfs_do_statfs(PINT_server_
if (ret < 0)
{
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
/* find out how many total handles this server controls */
@@ -83,7 +85,7 @@ static int statfs_do_statfs(PINT_server_
if(ret < 0)
{
js_p->error_code = ret;
- return(1);
+ return SM_ACTION_COMPLETE;
}
/* we need a context to be able to make the getinfo call */
@@ -91,7 +93,7 @@ static int statfs_do_statfs(PINT_server_
if (ret < 0)
{
js_p->error_code = ret;
- return 1;
+ return SM_ACTION_COMPLETE;
}
ret = trove_collection_getinfo(
@@ -134,7 +136,7 @@ static int statfs_do_statfs(PINT_server_
#endif
js_p->error_code = ((ret != 1) ? ret : 0);
- return 1;
+ return SM_ACTION_COMPLETE;
}
@@ -143,9 +145,10 @@ static int statfs_do_statfs(PINT_server_
* cleans up any resources consumed by this state machine and ends
* execution of the machine
*/
-static int statfs_cleanup(PINT_server_op *s_op, job_status_s* js_p)
+static PINT_sm_action statfs_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return(server_state_machine_complete(s_op));
+ return(server_state_machine_complete(smcb));
}
Index: truncate.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/truncate.sm,v
diff -p -u -r1.6 -r1.7
--- truncate.sm 17 Feb 2007 21:16:48 -0000 1.6
+++ truncate.sm 13 Apr 2007 05:14:30 -0000 1.7
@@ -14,12 +14,12 @@
#include "server-config.h"
#include "pvfs2-server.h"
-static int truncate_resize(
- PINT_server_op *s_op, job_status_s *js_p);
-static int truncate_check_error(
- PINT_server_op *s_op, job_status_s *js_p);
-static int truncate_cleanup(
- PINT_server_op *s_op, job_status_s *js_p);
+static PINT_sm_action truncate_resize(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action truncate_check_error(
+ struct PINT_smcb *smcb, job_status_s *js_p);
+static PINT_sm_action truncate_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p);
%%
@@ -59,30 +59,31 @@ machine pvfs2_truncate_sm
%%
-static int truncate_resize(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action truncate_resize(
+ 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;
ret = job_trove_bstream_resize(
s_op->req->u.truncate.fs_id, s_op->req->u.truncate.handle,
s_op->req->u.truncate.size, s_op->req->u.truncate.flags,
- NULL, s_op, 0, js_p, &i, server_job_context);
+ NULL, smcb, 0, js_p, &i, server_job_context);
return ret;
}
-static int truncate_check_error(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action truncate_check_error(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return 1;
+ return SM_ACTION_COMPLETE;
}
-static int truncate_cleanup(
- PINT_server_op *s_op, job_status_s *js_p)
+static PINT_sm_action truncate_cleanup(
+ struct PINT_smcb *smcb, job_status_s *js_p)
{
- return (server_state_machine_complete(s_op));
+ return (server_state_machine_complete(smcb));
}
/*
More information about the Pvfs2-cvs
mailing list