[Pvfs2-cvs] commit by dbonnie in pvfs2/src/client/sysint:
client-state-machine.c client-state-machine.h fs-add.sm
mgmt-create-dirent.sm mgmt-event-mon-list.sm
mgmt-get-config.c mgmt-get-dfile-array.sm
mgmt-get-dirdata-handle.sm mgmt-iterate-handles-list.sm
mgmt-noop.sm mgmt-perf-mon-list.sm mgmt-remove-dirent.sm
mgmt-remove-object.sm mgmt-repair-file.sm
mgmt-setparam-list.sm mgmt-statfs-list.sm remove.sm
server-get-config.sm sys-create.sm sys-del-eattr.sm
sys-flush.sm sys-get-eattr.sm sys-getattr.sm sys-io.sm
sys-list-eattr.sm sys-lookup.sm sys-mkdir.sm sys-readdir.sm
sys-readdirplus.sm sys-remove.sm sys-rename.sm
sys-set-eattr.sm sys-setattr.sm sys-small-io.sm sys-statfs.sm
sys-symlink.sm sys-truncate.sm
CVS commit program
cvs at parl.clemson.edu
Fri May 16 11:15:32 EDT 2008
Update of /anoncvs/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv1762/src/client/sysint
Modified Files:
Tag: cu-security-branch
client-state-machine.c client-state-machine.h fs-add.sm
mgmt-create-dirent.sm mgmt-event-mon-list.sm mgmt-get-config.c
mgmt-get-dfile-array.sm mgmt-get-dirdata-handle.sm
mgmt-iterate-handles-list.sm mgmt-noop.sm
mgmt-perf-mon-list.sm mgmt-remove-dirent.sm
mgmt-remove-object.sm mgmt-repair-file.sm
mgmt-setparam-list.sm mgmt-statfs-list.sm remove.sm
server-get-config.sm sys-create.sm sys-del-eattr.sm
sys-flush.sm sys-get-eattr.sm sys-getattr.sm sys-io.sm
sys-list-eattr.sm sys-lookup.sm sys-mkdir.sm sys-readdir.sm
sys-readdirplus.sm sys-remove.sm sys-rename.sm
sys-set-eattr.sm sys-setattr.sm sys-small-io.sm sys-statfs.sm
sys-symlink.sm sys-truncate.sm
Log Message:
Updated branch with code from HEAD
Index: client-state-machine.c
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/client-state-machine.c,v
diff -p -u -r1.94 -r1.94.2.1
--- client-state-machine.c 14 Feb 2008 23:15:26 -0000 1.94
+++ client-state-machine.c 16 May 2008 15:15:30 -0000 1.94.2.1
@@ -23,6 +23,8 @@
#include "gossip.h"
#include "pvfs2-util.h"
#include "id-generator.h"
+#include "ncache.h"
+#include "acache.h"
#define MAX_RETURNED_JOBS 256
@@ -352,7 +354,7 @@ PVFS_error PINT_client_state_machine_pos
PINT_sm_action sm_ret;
PVFS_error ret = -PVFS_EINVAL;
job_status_s js;
- int pvfs_sys_op = PINT_smcb_op(smcb);
+ int pvfs_sys_op __attribute__((unused)) = PINT_smcb_op(smcb);
PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(GOSSIP_CLIENT_DEBUG,
@@ -945,6 +947,84 @@ int PVFS_mgmt_wait(
out_error,
"mgmt");
}
+
+PVFS_error PVFS_sys_set_info(
+ enum PVFS_sys_setinfo_opt option,
+ unsigned int arg)
+{
+ PVFS_error ret = -PVFS_ENOSYS;
+
+ switch(option)
+ {
+ case PVFS_SYS_NCACHE_TIMEOUT_MSECS:
+ ret = PINT_ncache_set_info(NCACHE_TIMEOUT_MSECS, arg);
+ break;
+ case PVFS_SYS_ACACHE_TIMEOUT_MSECS:
+ ret = PINT_acache_set_info(ACACHE_TIMEOUT_MSECS, arg);
+ break;
+ case PVFS_SYS_MSG_TIMEOUT_SECS:
+ case PVFS_SYS_MSG_RETRY_LIMIT:
+ case PVFS_SYS_MSG_RETRY_DELAY_MSECS:
+ ret = -PVFS_ENOSYS;
+ break;
+#if 0
+ /* need some other code cleanup before these can be implemented */
+ case PVFS_SYS_MSG_TIMEOUT_SECS:
+ PINT_sys_msg_timeout_secs = arg;
+ ret = 0;
+ break;
+ case PVFS_SYS_MSG_RETRY_LIMIT:
+ PINT_sys_msg_retry_limit = arg;
+ ret = 0;
+ break;
+ case PVFS_SYS_MSG_RETRY_DELAY_MSECS:
+ PINT_sys_msg_retry_delay_msecs = arg;
+ ret = 0;
+ break;
+#endif
+ }
+
+ return(ret);
+}
+
+PVFS_error PVFS_sys_get_info(
+ enum PVFS_sys_setinfo_opt option,
+ unsigned int* arg)
+{
+ PVFS_error ret = -PVFS_ENOSYS;
+
+ switch(option)
+ {
+ case PVFS_SYS_NCACHE_TIMEOUT_MSECS:
+ ret = PINT_ncache_get_info(NCACHE_TIMEOUT_MSECS, arg);
+ break;
+ case PVFS_SYS_ACACHE_TIMEOUT_MSECS:
+ ret = PINT_acache_get_info(ACACHE_TIMEOUT_MSECS, arg);
+ break;
+ case PVFS_SYS_MSG_TIMEOUT_SECS:
+ case PVFS_SYS_MSG_RETRY_LIMIT:
+ case PVFS_SYS_MSG_RETRY_DELAY_MSECS:
+ ret = -PVFS_ENOSYS;
+ break;
+#if 0
+ case PVFS_SYS_MSG_TIMEOUT_SECS:
+ *arg = PINT_sys_msg_timeout_secs;
+ ret = 0;
+ break;
+ case PVFS_SYS_MSG_RETRY_LIMIT:
+ *arg = PINT_sys_msg_retry_limit;
+ ret = 0;
+ break;
+ case PVFS_SYS_MSG_RETRY_DELAY_MSECS:
+ *arg = PINT_sys_msg_retry_delay_msecs;
+ ret = 0;
+ break;
+#endif
+ }
+
+ return(ret);
+}
+
/*
* Local variables:
Index: client-state-machine.h
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/client-state-machine.h,v
diff -p -u -r1.173 -r1.173.4.1
--- client-state-machine.h 8 Jan 2008 18:38:00 -0000 1.173
+++ client-state-machine.h 16 May 2008 15:15:30 -0000 1.173.4.1
@@ -29,12 +29,6 @@
#include "pint-perf-counter.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 msgpairarray.sm which relies
- * on conflicting headers for dependency information
- */
-#ifndef __SM_CHECK_DEP
-
#define MAX_LOOKUP_SEGMENTS PVFS_REQ_LIMIT_PATH_SEGMENT_COUNT
#define MAX_LOOKUP_CONTEXTS PVFS_REQ_LIMIT_MAX_SYMLINK_RESOLUTION_COUNT
@@ -155,14 +149,12 @@ typedef struct PINT_client_io_ctx
/* the data handle we're responsible for doing I/O on */
PVFS_handle data_handle;
- /* a reference to the msgpair we're using for communication */
- PINT_sm_msgpair_state msg;
-
job_id_t flow_job_id;
job_status_s flow_status;
flow_descriptor flow_desc;
PVFS_msg_tag_t session_tag;
+ PINT_sm_msgpair_state msg;
PINT_client_sm_recv_state write_ack;
/*
@@ -518,16 +510,7 @@ typedef struct PINT_client_sm
/* fetch_config state used by the nested fetch config state machines */
struct PINT_server_fetch_config_sm_state fetch_config;
- /* msgpair array ptr used when operations can be performed
- * concurrently. this must be allocated within the upper-level
- * state machine and is used with the msgpairarray sm.
- * If you have a single msgpair, use the msgpair working space
- * and pint msgarray at it.
- */
- int msgarray_count; /* number of msgpairs in array */
- PINT_sm_msgpair_state *msgarray; /* array of msgpairs to process */
- PINT_sm_msgpair_params msgarray_params;
- PINT_sm_msgpair_state msgpair; /* working space for a single msgpair */
+ PINT_sm_msgarray_op msgarray_op;
PVFS_object_ref object_ref;
PVFS_object_ref parent_ref;
@@ -696,63 +679,27 @@ do {
} \
} while(0)
-#define PINT_init_msgarray_params(msgarray_params_ptr, __fsid) \
-do { \
- PINT_sm_msgpair_params *mpp = msgarray_params_ptr; \
- struct server_configuration_s *server_config = \
- PINT_get_server_config_struct(__fsid); \
- mpp->job_context = pint_client_sm_context; \
- if (server_config) \
- { \
- mpp->job_timeout = server_config->client_job_bmi_timeout; \
- mpp->retry_limit = server_config->client_retry_limit; \
- mpp->retry_delay = server_config->client_retry_delay_ms; \
- } \
- else \
- { \
- mpp->job_timeout = PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT; \
- mpp->retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT; \
- mpp->retry_delay = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT; \
- } \
- PINT_put_server_config_struct(server_config); \
+#define PINT_init_msgarray_params(client_sm_p, __fsid) \
+do { \
+ PINT_sm_msgpair_params *mpp = &client_sm_p->msgarray_op.params; \
+ struct server_configuration_s *server_config = \
+ PINT_get_server_config_struct(__fsid); \
+ mpp->job_context = pint_client_sm_context; \
+ if (server_config) \
+ { \
+ mpp->job_timeout = server_config->client_job_bmi_timeout; \
+ mpp->retry_limit = server_config->client_retry_limit; \
+ mpp->retry_delay = server_config->client_retry_delay_ms; \
+ } \
+ else \
+ { \
+ mpp->job_timeout = PVFS2_CLIENT_JOB_BMI_TIMEOUT_DEFAULT; \
+ mpp->retry_limit = PVFS2_CLIENT_RETRY_LIMIT_DEFAULT; \
+ mpp->retry_delay = PVFS2_CLIENT_RETRY_DELAY_MS_DEFAULT; \
+ } \
+ PINT_put_server_config_struct(server_config); \
} while(0)
-#define PINT_init_msgpair(sm_p, msg_p) \
-do { \
- msg_p = &sm_p->msgpair; \
- memset(msg_p, 0, sizeof(PINT_sm_msgpair_state)); \
- if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))\
- { \
- free(sm_p->msgarray); \
- sm_p->msgarray = NULL; \
- } \
- sm_p->msgarray = msg_p; \
- sm_p->msgarray_count = 1; \
-} while(0)
-
-
-/************************************
- * state-machine.h included here
- ************************************/
-#if 0
-#define PINT_OP_STATE PINT_client_sm
-
-/* This macro allows the generic state-machine-fns.h locate function
- * to access the appropriate sm struct based on the client operation index
- * from the above enum. Because the enum starts management operations at
- * 70, the management table was separated out from the sys table and the
- * necessary checks and subtractions are made in this macro.
- */
-#define PINT_OP_STATE_GET_MACHINE(_op) \
- ((_op <= PVFS_OP_SYS_MAXVAL) ? (PINT_client_sm_sys_table[_op - 1].sm) : \
- ((_op <= PVFS_OP_MGMT_MAXVAL) ? \
- (PINT_client_sm_mgmt_table[_op - PVFS_OP_SYS_MAXVAL - 1].sm) : \
- ((_op == PVFS_SERVER_GET_CONFIG) ? (&pvfs2_server_get_config_sm) : \
- (_op == PVFS_SERVER_FETCH_CONFIG) ? (&pvfs2_server_fetch_config_sm) : \
- ((_op == PVFS_CLIENT_JOB_TIMER) ? (&pvfs2_client_job_timer_sm) : \
- ((_op == PVFS_CLIENT_PERF_COUNT_TIMER) ? (&pvfs2_client_perf_count_timer_sm) : NULL)))))
-#endif
-
struct PINT_client_op_entry_s
{
struct PINT_state_machine_s * sm;
@@ -815,7 +762,6 @@ extern struct PINT_state_machine_s pvfs2
struct PINT_state_machine_s *client_op_state_get_machine(int);
int client_state_machine_terminate(struct PINT_smcb *, job_status_s *);
-#endif /* __SM_CHECK_DEP */
#endif /* __PVFS2_CLIENT_STATE_MACHINE_H */
/*
Index: fs-add.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/fs-add.sm,v
diff -p -u -r1.18 -r1.18.2.1
--- fs-add.sm 18 Feb 2008 17:39:26 -0000 1.18
+++ fs-add.sm 16 May 2008 15:15:30 -0000 1.18.2.1
@@ -172,14 +172,12 @@ PVFS_error PVFS_isys_fs_add(
* PINT_init_msgarray_params(), because we don't yet have a server
* configuration file to override default parameters.
*/
- sm_p->msgarray_params.job_context = pint_client_sm_context;
- sm_p->msgarray_params.job_timeout = 30; /* 30 second job timeout */
- sm_p->msgarray_params.retry_delay = 2000; /* 2 second retry delay */
- sm_p->msgarray_params.retry_limit = 5; /* retry up to 5 times */
-
- sm_p->msgarray_count = 1;
- sm_p->msgarray = &(sm_p->msgpair);
+ sm_p->msgarray_op.params.job_context = pint_client_sm_context;
+ sm_p->msgarray_op.params.job_timeout = 30; /* 30 second job timeout */
+ sm_p->msgarray_op.params.retry_delay = 2000; /* 2 second retry delay */
+ sm_p->msgarray_op.params.retry_limit = 5; /* retry up to 5 times */
+ PINT_msgpair_init(&sm_p->msgarray_op);
PINT_init_sysint_credentials(sm_p->cred_p, &creds);
return PINT_client_state_machine_post(
@@ -308,10 +306,9 @@ static PINT_sm_action pvfs2_server_prepa
js_p->error_code = -PVFS_ENOMEM;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = count;
- sm_p->msgarray = (PINT_sm_msgpair_state *) malloc(
- count * sizeof(PINT_sm_msgpair_state));
- if (!sm_p->msgarray)
+
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, count);
+ if (ret != 0)
{
fprintf(stderr, "Could not allocate msgarray for fetch_config\n");
free(sm_p->fetch_config.addr_array);
@@ -320,7 +317,7 @@ static PINT_sm_action pvfs2_server_prepa
sm_p->fetch_config.fs_config_bufs = NULL;
free(sm_p->fetch_config.fs_config_buf_size);
sm_p->fetch_config.fs_config_buf_size = NULL;
- js_p->error_code = -PVFS_ENOMEM;
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
js_p->error_code = 0;
Index: mgmt-create-dirent.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-create-dirent.sm,v
diff -p -u -r1.17 -r1.17.8.1
--- mgmt-create-dirent.sm 30 Aug 2007 00:13:41 -0000 1.17
+++ mgmt-create-dirent.sm 16 May 2008 15:15:30 -0000 1.17.8.1
@@ -97,7 +97,7 @@ PVFS_error PVFS_imgmt_create_dirent(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->parent_ref = parent_ref;
sm_p->u.mgmt_create_dirent.entry = entry;
@@ -167,7 +167,8 @@ static int mgmt_create_dirent_setup_msgp
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
gossip_debug(
GOSSIP_CLIENT_DEBUG, " creating dirent entry %s with "
@@ -197,6 +198,8 @@ static int mgmt_create_dirent_setup_msgp
gossip_err("Failed to map server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -205,7 +208,7 @@ static int mgmt_create_dirent_comp_fn(
{
PINT_smcb *smcb = v_p;
PINT_client_sm *sm_p __attribute__((unused)) =
- PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_CRDIRENT);
Index: mgmt-event-mon-list.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-event-mon-list.sm,v
diff -p -u -r1.30 -r1.30.8.1
--- mgmt-event-mon-list.sm 30 Aug 2007 00:13:41 -0000 1.30
+++ mgmt-event-mon-list.sm 16 May 2008 15:15:30 -0000 1.30.8.1
@@ -67,6 +67,7 @@ PVFS_error PVFS_imgmt_event_mon_list(
{
PINT_smcb *smcb = NULL;
PINT_client_sm *sm_p = NULL;
+ int ret;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"PVFS_imgmt_event_mon_list entered\n");
@@ -88,7 +89,7 @@ PVFS_error PVFS_imgmt_event_mon_list(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.event_mon_list.fs_id = fs_id;
sm_p->u.event_mon_list.event_matrix = event_matrix;
@@ -97,13 +98,11 @@ PVFS_error PVFS_imgmt_event_mon_list(
sm_p->u.event_mon_list.addr_array = addr_array;
sm_p->u.event_mon_list.details = details;
- sm_p->msgarray_count = server_count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- server_count * sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, server_count);
+ if(ret != 0)
{
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
return PINT_client_state_machine_post(
@@ -163,10 +162,8 @@ static PINT_sm_action mgmt_event_mon_lis
js_p->error_code = 0;
- for (i = 0; i < sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
PINT_SERVREQ_MGMT_EVENT_MON_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -178,6 +175,8 @@ static PINT_sm_action mgmt_event_mon_lis
msg_p->comp_fn = event_mon_list_comp_fn;
msg_p->svr_addr = sm_p->u.event_mon_list.addr_array[i];
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -195,15 +194,15 @@ static PINT_sm_action mgmt_event_mon_lis
for(i = 0; i < sm_p->u.event_mon_list.server_count; i++)
{
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
if (errct <
sm_p->u.event_mon_list.details->count_allocated)
{
sm_p->u.event_mon_list.details->error[errct].error =
- sm_p->msgarray[i].op_status;
+ sm_p->msgarray_op.msgarray[i].op_status;
sm_p->u.event_mon_list.details->error[errct].addr =
- sm_p->msgarray[i].svr_addr;
+ sm_p->msgarray_op.msgarray[i].svr_addr;
errct++;
}
else
@@ -216,10 +215,7 @@ static PINT_sm_action mgmt_event_mon_lis
error = -PVFS_EDETAIL;
}
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
sm_p->error_code = error;
@@ -233,12 +229,12 @@ static int event_mon_list_comp_fn(void*
{
int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* if this particular request was successful, then store the
* performance information in an array to be returned to caller
*/
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
memcpy(sm_p->u.event_mon_list.event_matrix[i],
resp_p->u.mgmt_event_mon.event_array,
@@ -249,13 +245,13 @@ static int event_mon_list_comp_fn(void*
/* if this is the last response, check all of the status values and
* return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for(j = 0; j < sm_p->msgarray_count; j++)
+ for(j = 0; j < sm_p->msgarray_op.count; j++)
{
- if (sm_p->msgarray[j].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[j].op_status != 0)
{
- return sm_p->msgarray[j].op_status;
+ return sm_p->msgarray_op.msgarray[j].op_status;
}
}
}
Index: mgmt-get-config.c
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-get-config.c,v
diff -p -u -r1.6 -r1.6.2.1
--- mgmt-get-config.c 14 Feb 2008 00:04:39 -0000 1.6
+++ mgmt-get-config.c 16 May 2008 15:15:30 -0000 1.6.2.1
@@ -61,7 +61,7 @@ int PVFS_mgmt_get_config(
sm_p->u.get_config.persist_config_buffers = 1;
- PINT_init_msgarray_params(&sm_p->msgarray_params, *fsid);
+ PINT_init_msgarray_params(sm_p, *fsid);
PINT_init_sysint_credentials(sm_p->cred_p, &creds);
@@ -82,12 +82,11 @@ int PVFS_mgmt_get_config(
mntent.pvfs_fs_name = cur_fs->file_system_name;
sm_p->u.get_config.config = config;
- sm_p->msgpair.enc_type = cur_fs->encoding;
+ sm_p->msgarray_op.msgpair.enc_type = cur_fs->encoding;
sm_p->u.get_config.mntent = &mntent;
- sm_p->msgarray_count = 1;
- sm_p->msgarray = &(sm_p->msgpair);
+ PINT_msgpair_init(&sm_p->msgarray_op);
ret = PINT_client_state_machine_post(
smcb, &op_id, NULL);
Index: mgmt-get-dfile-array.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-get-dfile-array.sm,v
diff -p -u -r1.32 -r1.32.8.1
--- mgmt-get-dfile-array.sm 18 Oct 2007 18:22:32 -0000 1.32
+++ mgmt-get-dfile-array.sm 16 May 2008 15:15:30 -0000 1.32.8.1
@@ -80,7 +80,7 @@ PVFS_error PVFS_imgmt_get_dfile_array(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->object_ref = ref;
sm_p->u.get_dfile_array.dfile_array = dfile_array;
Index: mgmt-get-dirdata-handle.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-get-dirdata-handle.sm,v
diff -p -u -r1.13 -r1.13.8.1
--- mgmt-get-dirdata-handle.sm 30 Aug 2007 00:13:41 -0000 1.13
+++ mgmt-get-dirdata-handle.sm 16 May 2008 15:15:30 -0000 1.13.8.1
@@ -98,7 +98,7 @@ PVFS_error PVFS_imgmt_get_dirdata_handle
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->parent_ref = parent_ref;
sm_p->u.mgmt_get_dirdata_handle.dirdata_handle = out_dirdata_handle;
@@ -161,7 +161,7 @@ static int mgmt_get_dirdata_handle_setup
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
PINT_SERVREQ_MGMT_GET_DIRDATA_HANDLE_FILL(
msg_p->req,
@@ -186,6 +186,8 @@ static int mgmt_get_dirdata_handle_setup
gossip_err("Failed to map server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -193,7 +195,7 @@ static int mgmt_get_dirdata_handle_comp_
void *v_p, struct PVFS_server_resp *resp_p, int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_MGMT_GET_DIRDATA_HANDLE);
Index: mgmt-iterate-handles-list.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-iterate-handles-list.sm,v
diff -p -u -r1.29 -r1.29.8.1
--- mgmt-iterate-handles-list.sm 30 Aug 2007 00:13:41 -0000 1.29
+++ mgmt-iterate-handles-list.sm 16 May 2008 15:15:30 -0000 1.29.8.1
@@ -70,6 +70,7 @@ PVFS_error PVFS_imgmt_iterate_handles_li
{
PINT_smcb *smcb = NULL;
PINT_client_sm *sm_p = NULL;
+ int ret;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"PVFS_imgmt_iterate_handles_list() entered.\n");
@@ -91,7 +92,7 @@ PVFS_error PVFS_imgmt_iterate_handles_li
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.iterate_handles_list.fs_id = fs_id;
sm_p->u.iterate_handles_list.server_count = server_count;
@@ -101,14 +102,11 @@ PVFS_error PVFS_imgmt_iterate_handles_li
sm_p->u.iterate_handles_list.position_array = position_array;
sm_p->u.iterate_handles_list.details = details;
- sm_p->msgarray_count = server_count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- server_count * sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, server_count);
+ if(ret != 0)
{
- PVFS_util_release_credentials(sm_p->cred_p);
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
return PINT_client_state_machine_post(
@@ -171,16 +169,15 @@ static PINT_sm_action mgmt_iterate_handl
/* setup msgpair array */
j=0;
- for(i=0; i < sm_p->u.iterate_handles_list.server_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[j];
/* skip servers that have already reached end */
/* TODO: use a better #define or something for ITERATE_END */
if(sm_p->u.iterate_handles_list.position_array[i]
== PVFS_ITERATE_END)
{
- sm_p->msgarray_count--;
+ sm_p->msgarray_op.count--;
sm_p->u.iterate_handles_list.handle_count_array[i] = 0;
}
else
@@ -201,7 +198,8 @@ static PINT_sm_action mgmt_iterate_handl
}
/* TODO: be nicer about this, user called function too many times */
- assert(sm_p->msgarray_count > 0);
+ assert(sm_p->msgarray_op.count > 0);
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
/* immediate return: next state jumps to msgpairarray machine */
js_p->error_code = 0;
@@ -222,15 +220,15 @@ static PINT_sm_action mgmt_iterate_handl
for(i = 0; i < sm_p->u.iterate_handles_list.server_count; i++)
{
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
if (errct <
sm_p->u.iterate_handles_list.details->count_allocated)
{
sm_p->u.iterate_handles_list.details->error[
- errct].error = sm_p->msgarray[i].op_status;
+ errct].error = sm_p->msgarray_op.msgarray[i].op_status;
sm_p->u.iterate_handles_list.details->error[
- errct].addr = sm_p->msgarray[i].svr_addr;
+ errct].addr = sm_p->msgarray_op.msgarray[i].svr_addr;
errct++;
}
else
@@ -243,10 +241,7 @@ static PINT_sm_action mgmt_iterate_handl
error = -PVFS_EDETAIL;
}
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
sm_p->error_code = error;
@@ -260,17 +255,17 @@ static int iterate_handles_list_comp_fn(
{
int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* if this particular request was successful, then collect info from
* response
*/
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
/* first, we have to match this up with the correct array entry */
for (j=0; j<sm_p->u.iterate_handles_list.server_count; j++)
{
- if (sm_p->msgarray[i].svr_addr
+ if (sm_p->msgarray_op.msgarray[i].svr_addr
== sm_p->u.iterate_handles_list.addr_array[j])
{
break;
@@ -291,15 +286,9 @@ static int iterate_handles_list_comp_fn(
/* if this is the last response, check all of the status values and
* return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j<sm_p->msgarray_count; j++)
- {
- if (sm_p->msgarray[j].op_status != 0)
- {
- return(sm_p->msgarray[j].op_status);
- }
- }
+ return PINT_msgarray_status(&sm_p->msgarray_op);
}
return 0;
Index: mgmt-noop.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-noop.sm,v
diff -p -u -r1.33 -r1.33.8.1
--- mgmt-noop.sm 30 Aug 2007 00:13:41 -0000 1.33
+++ mgmt-noop.sm 16 May 2008 15:15:30 -0000 1.33.8.1
@@ -77,11 +77,12 @@ PVFS_error PVFS_imgmt_noop(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
- sm_p->msgpair.fs_id = fs_id;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_NO_RETRY;
- sm_p->msgpair.svr_addr = addr;
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ sm_p->msgarray_op.msgpair.fs_id = fs_id;
+ sm_p->msgarray_op.msgpair.retry_flag = PVFS_MSGPAIR_NO_RETRY;
+ sm_p->msgarray_op.msgpair.svr_addr = addr;
gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_mgmt_noop calling "
"PINT_client_state_machine_post()\n");
@@ -129,11 +130,9 @@ static PINT_sm_action mgmt_noop_setup_ms
gossip_debug(GOSSIP_CLIENT_DEBUG,
"noop state: mgmt_noop_setup_msgpair\n");
- PINT_SERVREQ_MGMT_NOOP_FILL(sm_p->msgpair.req, *sm_p->cred_p);
-
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
+ PINT_SERVREQ_MGMT_NOOP_FILL(sm_p->msgarray_op.msgpair.req, *sm_p->cred_p);
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
js_p->error_code = 0;
return SM_ACTION_COMPLETE;
}
Index: mgmt-perf-mon-list.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-perf-mon-list.sm,v
diff -p -u -r1.34 -r1.34.8.1
--- mgmt-perf-mon-list.sm 18 Oct 2007 18:05:51 -0000 1.34
+++ mgmt-perf-mon-list.sm 16 May 2008 15:15:31 -0000 1.34.8.1
@@ -71,6 +71,7 @@ PVFS_error PVFS_imgmt_perf_mon_list(
{
PINT_smcb *smcb;
PINT_client_sm *sm_p;
+ int ret;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"PVFS_imgmt_perf_mon_list entered\n");
@@ -93,7 +94,7 @@ PVFS_error PVFS_imgmt_perf_mon_list(
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.perf_mon_list.fs_id = fs_id;
sm_p->u.perf_mon_list.perf_matrix = perf_matrix;
@@ -104,14 +105,11 @@ PVFS_error PVFS_imgmt_perf_mon_list(
sm_p->u.perf_mon_list.end_time_ms_array = end_time_ms_array;
sm_p->u.perf_mon_list.details = details;
- sm_p->msgarray_count = server_count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- server_count * sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, server_count);
+ if(ret != 0)
{
- PVFS_util_release_credentials(sm_p->cred_p);
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
return PINT_client_state_machine_post(
@@ -175,10 +173,8 @@ static PINT_sm_action mgmt_perf_mon_list
"mgmt_perf_mon_list_setup_msgpair\n");
/* setup msgpair array */
- for (i=0; i < sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
PINT_SERVREQ_MGMT_PERF_MON_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -194,6 +190,8 @@ static PINT_sm_action mgmt_perf_mon_list
/* immediate return: next state jumps to msgpairarray machine */
js_p->error_code = 0;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -211,15 +209,15 @@ static PINT_sm_action mgmt_perf_mon_list
for(i = 0; i < sm_p->u.perf_mon_list.server_count; i++)
{
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
if (errct <
sm_p->u.perf_mon_list.details->count_allocated)
{
sm_p->u.perf_mon_list.details->error[errct].error =
- sm_p->msgarray[i].op_status;
+ sm_p->msgarray_op.msgarray[i].op_status;
sm_p->u.perf_mon_list.details->error[errct].addr =
- sm_p->msgarray[i].svr_addr;
+ sm_p->msgarray_op.msgarray[i].svr_addr;
errct++;
}
else
@@ -232,10 +230,7 @@ static PINT_sm_action mgmt_perf_mon_list
error = -PVFS_EDETAIL;
}
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
sm_p->error_code = error;
@@ -249,12 +244,12 @@ static int perf_mon_list_comp_fn(void* v
{
int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* if this particular request was successful, then store the
* performance information in an array to be returned to caller
*/
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
sm_p->u.perf_mon_list.next_id_array[i] =
resp_p->u.mgmt_perf_mon.suggested_next_id;
@@ -269,13 +264,13 @@ static int perf_mon_list_comp_fn(void* v
/* if this is the last response, check all of the status values and
* return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
+ for (j=0; j < sm_p->msgarray_op.count; j++)
{
- if (sm_p->msgarray[j].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[j].op_status != 0)
{
- return(sm_p->msgarray[j].op_status);
+ return(sm_p->msgarray_op.msgarray[j].op_status);
}
}
}
Index: mgmt-remove-dirent.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-remove-dirent.sm,v
diff -p -u -r1.14 -r1.14.8.1
--- mgmt-remove-dirent.sm 30 Aug 2007 00:13:41 -0000 1.14
+++ mgmt-remove-dirent.sm 16 May 2008 15:15:31 -0000 1.14.8.1
@@ -96,7 +96,7 @@ PVFS_error PVFS_imgmt_remove_dirent(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->parent_ref = parent_ref;
sm_p->u.mgmt_remove_dirent.entry = entry;
@@ -164,7 +164,8 @@ static PINT_sm_action mgmt_remove_dirent
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_MGMT_REMOVE_DIRENT_FILL(
msg_p->req,
@@ -188,8 +189,10 @@ static PINT_sm_action mgmt_remove_dirent
if (ret)
{
gossip_err("Failed to map server address\n");
- js_p->error_code = ret;
+ js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -198,7 +201,7 @@ static int mgmt_remove_dirent_comp_fn(
{
PINT_smcb *smcb = v_p;
PINT_client_sm *sm_p __attribute__((unused)) =
- PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_MGMT_REMOVE_DIRENT);
Index: mgmt-remove-object.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-remove-object.sm,v
diff -p -u -r1.14 -r1.14.8.1
--- mgmt-remove-object.sm 30 Aug 2007 00:13:41 -0000 1.14
+++ mgmt-remove-object.sm 16 May 2008 15:15:31 -0000 1.14.8.1
@@ -94,7 +94,7 @@ PVFS_error PVFS_imgmt_remove_object(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, object_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, object_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->object_ref = object_ref;
@@ -161,7 +161,8 @@ static PINT_sm_action mgmt_remove_object
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_MGMT_REMOVE_OBJECT_FILL(
msg_p->req,
@@ -184,8 +185,10 @@ static PINT_sm_action mgmt_remove_object
if (ret)
{
gossip_err("Failed to map server address\n");
- js_p->error_code = ret;
+ js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -194,7 +197,7 @@ static int mgmt_remove_object_comp_fn(
{
PINT_smcb *smcb = v_p;
PINT_client_sm *sm_p __attribute__((unused)) =
- PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_MGMT_REMOVE_OBJECT);
Index: mgmt-repair-file.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-repair-file.sm,v
diff -p -u -r1.1 -r1.1.6.1
--- mgmt-repair-file.sm 7 Dec 2007 23:07:45 -0000 1.1
+++ mgmt-repair-file.sm 16 May 2008 15:15:31 -0000 1.1.6.1
@@ -206,7 +206,7 @@ PVFS_error PVFS_imgmt_repair_file(
}
memset(sm_p->u.create.datafile_handles, 0,sizeof(PVFS_handle));
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.create.object_name = object_name;
sm_p->u.create.create_resp = resp;
@@ -224,7 +224,7 @@ PVFS_error PVFS_imgmt_repair_file(
free(sm_p);
return -PVFS_ENOMEM;
}
-
+
/*Set requested number of dfiles to 1*/
num_dfiles_req = 1;
Index: mgmt-setparam-list.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-setparam-list.sm,v
diff -p -u -r1.36 -r1.36.8.1
--- mgmt-setparam-list.sm 30 Aug 2007 00:13:41 -0000 1.36
+++ mgmt-setparam-list.sm 16 May 2008 15:15:31 -0000 1.36.8.1
@@ -95,7 +95,7 @@ PVFS_error PVFS_imgmt_setparam_list(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.setparam_list.fs_id = fs_id;
sm_p->u.setparam_list.param = param;
@@ -105,13 +105,11 @@ PVFS_error PVFS_imgmt_setparam_list(
sm_p->u.setparam_list.count = count;
sm_p->u.setparam_list.details = details;
- sm_p->msgarray_count = count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- count * sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, count);
+ if(ret != 0)
{
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
if (sm_p->u.setparam_list.root_check_status_array)
@@ -182,17 +180,15 @@ static PINT_sm_action mgmt_setparam_list
"mgmt_setparam_list_setup_msgpair\n");
/* setup msgpair array */
- for (i=0; i < sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
PINT_SERVREQ_MGMT_SETPARAM_FILL(
msg_p->req,
*sm_p->cred_p,
sm_p->u.setparam_list.fs_id,
sm_p->u.setparam_list.param,
sm_p->u.setparam_list.value);
-
+
msg_p->fs_id = sm_p->u.setparam_list.fs_id;
msg_p->handle = PVFS_HANDLE_NULL;
msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
@@ -216,6 +212,8 @@ static PINT_sm_action mgmt_setparam_list
/* immediate return: next state jumps to msgpairarray machine */
js_p->error_code = 0;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -240,14 +238,14 @@ static PINT_sm_action mgmt_setparam_list
}
else
{
- status = sm_p->msgarray[i].op_status;
+ status = sm_p->msgarray_op.msgarray[i].op_status;
}
if (errct < sm_p->u.setparam_list.details->count_allocated)
{
sm_p->u.setparam_list.details->error[errct].error = status;
sm_p->u.setparam_list.details->error[errct].addr =
- sm_p->msgarray[i].svr_addr;
+ sm_p->msgarray_op.msgarray[i].svr_addr;
errct++;
}
else
@@ -267,10 +265,7 @@ static PINT_sm_action mgmt_setparam_list
sm_p->u.setparam_list.root_check_status_array = NULL;
}
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
sm_p->error_code = error;
@@ -289,10 +284,10 @@ static int collect_old_values_comp_fn(
void *v_p, struct PVFS_server_resp *resp_p, int i)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
int j;
- if ((sm_p->msgarray[i].op_status == 0) &&
+ if ((sm_p->msgarray_op.msgarray[i].op_status == 0) &&
(sm_p->u.setparam_list.old_value_array))
{
sm_p->u.setparam_list.old_value_array[i] =
@@ -302,13 +297,13 @@ static int collect_old_values_comp_fn(
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j = 0; j < sm_p->msgarray_count; j++)
+ for (j = 0; j < sm_p->msgarray_op.count; j++)
{
- if (sm_p->msgarray[j].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[j].op_status != 0)
{
- return sm_p->msgarray[j].op_status;
+ return sm_p->msgarray_op.msgarray[j].op_status;
}
}
}
@@ -330,14 +325,14 @@ static int root_check_comp_fn(
int j = 0;
int owners = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/*
store the op_status before it's overwritten with the return
value of this comp_fn by the msgpairarray code
*/
sm_p->u.setparam_list.root_check_status_array[i] =
- sm_p->msgarray[i].op_status;
+ sm_p->msgarray_op.msgarray[i].op_status;
/* need to return non-zero status at the end if any of the statuses
* are nonzero
Index: mgmt-statfs-list.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/mgmt-statfs-list.sm,v
diff -p -u -r1.43 -r1.43.8.1
--- mgmt-statfs-list.sm 30 Aug 2007 00:13:41 -0000 1.43
+++ mgmt-statfs-list.sm 16 May 2008 15:15:31 -0000 1.43.8.1
@@ -86,6 +86,7 @@ PVFS_error PVFS_imgmt_statfs_list(
{
PINT_smcb *smcb = NULL;
PINT_client_sm *sm_p = NULL;
+ int ret;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"PVFS_imgmt_statfs_list entered\n");
@@ -106,7 +107,7 @@ PVFS_error PVFS_imgmt_statfs_list(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.statfs_list.fs_id = fs_id;
sm_p->u.statfs_list.stat_array = stat_array;
@@ -117,14 +118,11 @@ PVFS_error PVFS_imgmt_statfs_list(
memset(sm_p->u.statfs_list.stat_array, 0,
(count * sizeof(struct PVFS_mgmt_server_stat)));
- sm_p->msgarray_count = count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (count * sizeof(PINT_sm_msgpair_state)));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, count);
+ if(ret != 0)
{
- PVFS_util_release_credentials(sm_p->cred_p);
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
return PINT_client_state_machine_post(
@@ -184,10 +182,8 @@ static PINT_sm_action mgmt_statfs_list_s
js_p->error_code = 0;
- for(i = 0; i<sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
PINT_SERVREQ_STATFS_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -199,6 +195,8 @@ static PINT_sm_action mgmt_statfs_list_s
msg_p->comp_fn = statfs_list_comp_fn;
msg_p->svr_addr = sm_p->u.statfs_list.addr_array[i];
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -216,14 +214,14 @@ static PINT_sm_action mgmt_statfs_list_c
for(i = 0; i < sm_p->u.statfs_list.count; i++)
{
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
if (errct < sm_p->u.statfs_list.details->count_allocated)
{
sm_p->u.statfs_list.details->error[errct].error =
- sm_p->msgarray[i].op_status;
+ sm_p->msgarray_op.msgarray[i].op_status;
sm_p->u.statfs_list.details->error[errct].addr =
- sm_p->msgarray[i].svr_addr;
+ sm_p->msgarray_op.msgarray[i].svr_addr;
errct++;
}
else
@@ -236,12 +234,7 @@ static PINT_sm_action mgmt_statfs_list_c
error = -PVFS_EDETAIL;
}
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
-
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
sm_p->error_code = error;
return SM_ACTION_COMPLETE;
@@ -253,12 +246,12 @@ static int statfs_list_comp_fn(void *v_p
{
int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* if this particular request was successful, then store the
* statfs information in an array to be returned to caller
*/
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
struct PVFS_mgmt_server_stat *sm_stat =
&sm_p->u.statfs_list.stat_array[i];
@@ -280,7 +273,7 @@ static int statfs_list_comp_fn(void *v_p
sm_stat->bmi_address = PVFS_mgmt_map_addr(
sm_p->u.statfs_list.fs_id, sm_p->cred_p,
- sm_p->msgarray[i].svr_addr, &sm_stat->server_type);
+ sm_p->msgarray_op.msgarray[i].svr_addr, &sm_stat->server_type);
assert(sm_stat->bmi_address);
assert(sm_stat->handles_total_count >=
@@ -290,13 +283,13 @@ static int statfs_list_comp_fn(void *v_p
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
+ for (j=0; j < sm_p->msgarray_op.count; j++)
{
- if (sm_p->msgarray[j].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[j].op_status != 0)
{
- return(sm_p->msgarray[j].op_status);
+ return(sm_p->msgarray_op.msgarray[j].op_status);
}
}
}
Index: remove.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/remove.sm,v
diff -p -u -r1.27 -r1.27.8.1
--- remove.sm 30 Aug 2007 00:13:41 -0000 1.27
+++ remove.sm 16 May 2008 15:15:31 -0000 1.27.8.1
@@ -187,19 +187,18 @@ static PINT_sm_action remove_datafile_re
attr = &sm_p->getattr.attr;
assert(attr);
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- attr->u.meta.dfile_count * sizeof(PINT_sm_msgpair_state));
- if (!sm_p->msgarray)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op,
+ attr->u.meta.dfile_count);
+ if(ret != 0)
{
- js_p->error_code = -PVFS_ENOMEM;
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = attr->u.meta.dfile_count;
/* for each datafile, post a send/recv pair for the remove */
for (i = 0; i < attr->u.meta.dfile_count; i++)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
+ PINT_sm_msgpair_state *msg_p = &sm_p->msgarray_op.msgarray[i];
gossip_debug(GOSSIP_CLIENT_DEBUG,
" datafile_remove: removing handle %llu\n",
@@ -218,14 +217,14 @@ static PINT_sm_action remove_datafile_re
}
/* fill in address of each server to contact */
- ret = PINT_serv_msgpairarray_resolve_addrs(
- sm_p->msgarray_count, sm_p->msgarray);
-
+ ret = PINT_serv_msgpairarray_resolve_addrs(&sm_p->msgarray_op);
if (ret < 0)
{
gossip_err("Error: failed to resolve server addresses.\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -241,7 +240,8 @@ static PINT_sm_action remove_object_remo
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_REMOVE_FILL(
msg_p->req,
@@ -262,7 +262,9 @@ static PINT_sm_action remove_object_remo
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
- return SM_ACTION_COMPLETE;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
+ return SM_ACTION_COMPLETE;
}
static PINT_sm_action remove_datafile_remove_failure(
@@ -307,11 +309,7 @@ static PINT_sm_action remove_helper_clea
PINT_acache_invalidate(sm_p->object_ref);
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
if (js_p->error_code)
{
Index: server-get-config.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/server-get-config.sm,v
diff -p -u -r1.31 -r1.31.2.1
--- server-get-config.sm 24 Jan 2008 22:08:16 -0000 1.31
+++ server-get-config.sm 16 May 2008 15:15:31 -0000 1.31.2.1
@@ -161,14 +161,12 @@ int PINT_server_get_config(
* PINT_init_msgarray_params(), because we don't yet have a server
* configuration file to override default parameters.
*/
- sm_p->msgarray_params.job_context = pint_client_sm_context;
- sm_p->msgarray_params.job_timeout = 30; /* 30 second job timeout */
- sm_p->msgarray_params.retry_delay = 2000; /* 2 second retry delay */
- sm_p->msgarray_params.retry_limit = 5; /* retry up to 5 times */
-
- sm_p->msgarray_count = 1;
- sm_p->msgarray = &(sm_p->msgpair);
+ sm_p->msgarray_op.params.job_context = pint_client_sm_context;
+ sm_p->msgarray_op.params.job_timeout = 30; /* 30 second job timeout */
+ sm_p->msgarray_op.params.retry_delay = 2000; /* 2 second retry delay */
+ sm_p->msgarray_op.params.retry_limit = 5; /* retry up to 5 times */
+ PINT_msgpair_init(&sm_p->msgarray_op);
PINT_init_sysint_credentials(sm_p->cred_p, &creds);
sm_p->u.get_config.mntent = mntent_p;
sm_p->u.get_config.config = config;
@@ -262,10 +260,10 @@ static PINT_sm_action server_get_config_
if (ENCODING_IS_VALID(sm_p->u.get_config.mntent->encoding))
{
- sm_p->msgpair.enc_type = sm_p->u.get_config.mntent->encoding;
+ sm_p->msgarray_op.msgpair.enc_type = sm_p->u.get_config.mntent->encoding;
}
- msg_p = &sm_p->msgarray[0];
+ msg_p = &sm_p->msgarray_op.msgpair;
ret = BMI_addr_lookup(&serv_addr,
sm_p->u.get_config.mntent->the_pvfs_config_server);
@@ -285,6 +283,7 @@ static PINT_sm_action server_get_config_
msg_p->comp_fn = server_get_config_comp_fn;
msg_p->svr_addr = serv_addr;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
js_p->error_code = 0;
return SM_ACTION_COMPLETE;
}
@@ -332,7 +331,8 @@ static PINT_sm_action server_get_config_
if (!cur_fs)
{
gossip_err("Warning:\n Cannot retrieve information about "
- "pvfstab entry %s\n",
+ "filesystem %s at tab entry: %s\n",
+ sm_p->u.get_config.mntent->pvfs_fs_name,
sm_p->u.get_config.mntent->the_pvfs_config_server);
/*
@@ -376,9 +376,8 @@ static int server_get_config_comp_fn(
struct PVFS_server_resp *resp_p,
int i)
{
- int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* only posted one msgpair */
assert(i==0);
@@ -386,7 +385,7 @@ static int server_get_config_comp_fn(
/* if this particular request was successful, then store the server
* response and let the caller sort it out */
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
sm_p->u.get_config.fs_config_buf =
strdup(resp_p->u.getconfig.fs_config_buf);
@@ -397,15 +396,9 @@ static int server_get_config_comp_fn(
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
- {
- if (sm_p->msgarray[j].op_status != 0)
- {
- return(sm_p->msgarray[j].op_status);
- }
- }
+ return PINT_msgarray_status(&sm_p->msgarray_op);
}
return 0;
}
@@ -455,25 +448,23 @@ static int PINT_fetch_config_list(int ns
* PINT_init_msgarray_params(), because we don't yet have a server
* configuration file to override default parameters.
*/
- sm_p->msgarray_params.job_context = pint_client_sm_context;
- sm_p->msgarray_params.job_timeout = 30; /* 30 second job timeout */
- sm_p->msgarray_params.retry_delay = 2000; /* 2 second retry delay */
- sm_p->msgarray_params.retry_limit = 5; /* retry up to 5 times */
+ sm_p->msgarray_op.params.job_context = pint_client_sm_context;
+ sm_p->msgarray_op.params.job_timeout = 30; /* 30 second job timeout */
+ sm_p->msgarray_op.params.retry_delay = 2000; /* 2 second retry delay */
+ sm_p->msgarray_op.params.retry_limit = 5; /* retry up to 5 times */
PINT_init_sysint_credentials(sm_p->cred_p, &creds);
sm_p->fetch_config.nservers = nservers;
sm_p->fetch_config.addr_array = servers;
sm_p->fetch_config.fs_config_bufs = fs_config_bufs;
sm_p->fetch_config.fs_config_buf_size = fs_config_buf_size;
- sm_p->msgarray_count = nservers;
- sm_p->msgarray = (PINT_sm_msgpair_state *) malloc(
- nservers * sizeof(PINT_sm_msgpair_state));
- if (!sm_p->msgarray)
+
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, nservers);
+ if(ret != 0)
{
PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ return ret;
}
-
ret = PINT_client_state_machine_post(
smcb, &op_id, NULL);
if (ret)
@@ -505,10 +496,9 @@ static PINT_sm_action server_fetch_confi
gossip_debug(GOSSIP_CLIENT_DEBUG,
"fetch_config state: server_fetch_config_setup_msgpair\n");
- for (i = 0; i < sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
- sm_p->msgarray[i].enc_type = sm_p->msgpair.enc_type;
+ sm_p->msgarray_op.msgarray[i].enc_type = sm_p->msgarray_op.msgpair.enc_type;
PINT_SERVREQ_GETCONFIG_FILL(msg_p->req, *sm_p->cred_p);
msg_p->fs_id = PVFS_FS_ID_NULL;
@@ -519,6 +509,8 @@ static PINT_sm_action server_fetch_confi
}
js_p->error_code = 0;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -526,10 +518,7 @@ static PINT_sm_action server_fetch_confi
job_status_s *js_p)
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
/* preserve js_p->error_code */
return SM_ACTION_COMPLETE;
@@ -540,14 +529,13 @@ static int server_fetch_config_comp_fn(
struct PVFS_server_resp *resp_p,
int i)
{
- int j = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
/* if this particular request was successful, then store the server
* response and let the caller sort it out */
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
sm_p->fetch_config.fs_config_bufs[i] =
strdup(resp_p->u.getconfig.fs_config_buf);
@@ -558,15 +546,9 @@ static int server_fetch_config_comp_fn(
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
- {
- if (sm_p->msgarray[j].op_status != 0)
- {
- return(sm_p->msgarray[j].op_status);
- }
- }
+ return PINT_msgarray_status(&sm_p->msgarray_op);
}
return 0;
}
Index: sys-create.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-create.sm,v
diff -p -u -r1.115 -r1.115.2.1
--- sys-create.sm 14 Feb 2008 00:04:39 -0000 1.115
+++ sys-create.sm 16 May 2008 15:15:31 -0000 1.115.2.1
@@ -231,7 +231,7 @@ PVFS_error PVFS_isys_create(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.create.object_name = object_name;
sm_p->u.create.create_resp = resp;
@@ -393,7 +393,7 @@ static PINT_sm_action create_init(
js_p->error_code = 0;
return job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
}
@@ -412,15 +412,15 @@ static int create_create_comp_fn(void *v
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
-
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
+
gossip_debug(GOSSIP_CLIENT_DEBUG, "create_create_comp_fn\n");
assert(resp_p->op == PVFS_SERV_CREATE);
if (resp_p->status != 0)
{
- return resp_p->status;
+ return resp_p->status;
}
/* otherwise, just stash the newly created meta handle */
@@ -438,7 +438,7 @@ static int create_datafiles_comp_fn(void
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG,
"create_datafiles_comp_fn[%d]\n",index);
@@ -487,16 +487,16 @@ static int create_setattr_comp_fn(void *
int res;
PVFS_object_ref refn;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG, "create_setattr_comp_fn\n");
assert(resp_p->op == PVFS_SERV_SETATTR);
- refn.fs_id = sm_p->msgpair.fs_id;
- refn.handle = sm_p->msgpair.handle;
+ refn.fs_id = sm_p->msgarray_op.msgpair.fs_id;
+ refn.handle = sm_p->msgarray_op.msgpair.handle;
res = PINT_copy_object_attr(&sm_p->u.create.cache_attr,
- &sm_p->msgpair.req.u.setattr.attr);
+ &sm_p->msgarray_op.msgpair.req.u.setattr.attr);
if(res != 0)
{
return res;
@@ -538,6 +538,7 @@ static PINT_sm_action create_dspace_crea
int ret = -PVFS_EINVAL;
PVFS_handle_extent_array meta_handle_extent_array;
PINT_sm_msgpair_state *msg_p = NULL;
+ int server_type;
gossip_debug(GOSSIP_CLIENT_DEBUG, "create state: "
"dspace_create_setup_msgpair\n");
@@ -556,7 +557,8 @@ static PINT_sm_action create_dspace_crea
gossip_debug(GOSSIP_CLIENT_DEBUG," create: posting create req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
ret = PINT_cached_config_get_next_meta(
sm_p->object_ref.fs_id,
@@ -569,6 +571,16 @@ static PINT_sm_action create_dspace_crea
return SM_ACTION_COMPLETE;
}
+ /* resolve and print selected server only if gossip debugging enabled */
+ if(gossip_debug_on && (gossip_debug_mask & GOSSIP_CLIENT_DEBUG))
+ {
+ gossip_debug(GOSSIP_CLIENT_DEBUG,
+ "PVFS_isys_create() selected meta server: %s\n",
+ PINT_cached_config_map_addr(sm_p->object_ref.fs_id,
+ msg_p->svr_addr,
+ &server_type));
+ }
+
PINT_SERVREQ_CREATE_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -581,6 +593,7 @@ static PINT_sm_action create_dspace_crea
msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
msg_p->comp_fn = create_create_comp_fn;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -589,6 +602,8 @@ static PINT_sm_action create_datafiles_s
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0;
+ PINT_sm_msgpair_state *msg_p;
+ int server_type;
gossip_debug(GOSSIP_CLIENT_DEBUG, "create state: "
"datafiles_setup_msgpair_array\n");
@@ -628,13 +643,6 @@ static PINT_sm_action create_datafiles_s
&sm_p->u.create.layout,
sm_p->u.create.data_server_addrs,
sm_p->u.create.io_handle_extent_array);
- if(ret < 0)
- {
- gossip_err("create: failed to map the layout to a set of IO servers\n");
- js_p->error_code = ret;
- return 1;
- }
-
if (ret)
{
gossip_err("Failed to retrieve data server addresses\n");
@@ -642,27 +650,30 @@ static PINT_sm_action create_datafiles_s
return SM_ACTION_COMPLETE;
}
- memset(&sm_p->msgpair, 0, sizeof(PINT_sm_msgpair_state));
-
- /* allocate msgarray and set msgarray_count */
- if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))
+ /* resolve and print selected server only if gossip debugging enabled */
+ if(gossip_debug_on && (gossip_debug_mask & GOSSIP_CLIENT_DEBUG))
{
- free(sm_p->msgarray);
+ for(i = 0; i < sm_p->u.create.num_data_files; i++)
+ {
+ gossip_debug(GOSSIP_CLIENT_DEBUG,
+ "PVFS_isys_create() selected data server: %s\n",
+ PINT_cached_config_map_addr(sm_p->object_ref.fs_id,
+ sm_p->u.create.data_server_addrs[i],
+ &server_type));
+ }
}
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (sm_p->u.create.num_data_files * sizeof(PINT_sm_msgpair_state)));
- if (sm_p->msgarray == NULL)
+
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, sm_p->u.create.num_data_files);
+ if(ret != 0)
{
- gossip_err("create: failed to allocate msgarray\n");
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize msgpair array\n");
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = sm_p->u.create.num_data_files;
/* for each datafile, prepare to post a create send/recv pair */
- for(i = 0; i < sm_p->u.create.num_data_files; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
PINT_SERVREQ_CREATE_FILL(
msg_p->req,
@@ -685,6 +696,8 @@ static PINT_sm_action create_datafiles_s
msg_p->comp_fn = create_datafiles_comp_fn;
msg_p->svr_addr = sm_p->u.create.data_server_addrs[i];
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -713,7 +726,8 @@ static PINT_sm_action create_setattr_set
gossip_debug(GOSSIP_CLIENT_DEBUG," create: posting setattr req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_SETATTR_FILL(
msg_p->req,
@@ -746,6 +760,8 @@ static PINT_sm_action create_setattr_set
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -779,7 +795,8 @@ static PINT_sm_action create_crdirent_se
llu(sm_p->object_ref.handle), sm_p->u.create.object_name,
llu(sm_p->u.create.metafile_handle));
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_CRDIRENT_FILL(
msg_p->req,
@@ -803,6 +820,8 @@ static PINT_sm_action create_crdirent_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -829,14 +848,14 @@ static PINT_sm_action create_delete_hand
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0, actual_count = 0;
PVFS_BMI_addr_t metafile_server_addr;
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG, "create state: "
"delete_handles_setup_msgpair_array\n");
js_p->error_code = 0;
- memset(&sm_p->msgpair, 0, sizeof(PINT_sm_msgpair_state));
-
+ PINT_msgpair_init(&sm_p->msgarray_op);
ret = PINT_cached_config_map_to_server(
&metafile_server_addr, sm_p->u.create.metafile_handle,
sm_p->object_ref.fs_id);
@@ -864,20 +883,15 @@ static PINT_sm_action create_delete_hand
}
}
- if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))
- {
- free(sm_p->msgarray);
- }
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (actual_count * sizeof(PINT_sm_msgpair_state)));
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, actual_count);
+ if (ret)
{
- gossip_err("create: failed to allocate msgarray\n");
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n", actual_count);
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = actual_count;
assert(sm_p->u.create.data_server_addrs);
@@ -885,9 +899,8 @@ static PINT_sm_action create_delete_hand
for the metafile and each datafile, prepare to post a remove
send/recv pair
*/
- for(i = 0; i < actual_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
gossip_debug(GOSSIP_CLIENT_DEBUG,
"create: posting data file remove req %d\n",i);
@@ -928,6 +941,8 @@ static PINT_sm_action create_delete_hand
"datafile handle %llu\n", llu(msg_p->handle));
}
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -975,7 +990,7 @@ static PINT_sm_action create_cleanup(
}
}
else if ((PVFS_ERROR_CLASS(-sm_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.create.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.create.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.create.stored_error_code = 0;
sm_p->u.create.retry_count++;
@@ -1018,11 +1033,7 @@ static PINT_sm_action create_cleanup(
free(sm_p->u.create.layout.server_list.servers);
}
- if (sm_p->msgarray != &(sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
Index: sys-del-eattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-del-eattr.sm,v
diff -p -u -r1.10 -r1.10.8.1
--- sys-del-eattr.sm 30 Aug 2007 00:13:41 -0000 1.10
+++ sys-del-eattr.sm 16 May 2008 15:15:31 -0000 1.10.8.1
@@ -81,7 +81,7 @@ PVFS_error PVFS_isys_deleattr(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.deleattr.key_p = key_p;
sm_p->error_code = 0;
@@ -128,35 +128,38 @@ static PINT_sm_action del_eattr_setup_ms
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"del_eattr state: del_eattr_setup_msgpair\n");
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
+
PINT_SERVREQ_DELEATTR_FILL(
- sm_p->msgpair.req,
+ msg_p->req,
(*sm_p->cred_p),
sm_p->object_ref.fs_id,
sm_p->object_ref.handle,
- (*sm_p->u.deleattr.key_p)
- );
+ (*sm_p->u.deleattr.key_p));
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
- sm_p->msgpair.fs_id = sm_p->object_ref.fs_id;
- sm_p->msgpair.handle = sm_p->object_ref.handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgpair.comp_fn = del_eattr_comp_fn;
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = del_eattr_comp_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr,
- sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr,
+ msg_p->handle,
+ msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
js_p->error_code = 0;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -180,7 +183,8 @@ static int del_eattr_comp_fn(
int j = 0;
int ret = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"del_eattr completion fn: del_eattr_comp_fn\n");
@@ -190,23 +194,23 @@ static int del_eattr_comp_fn(
/* no return value from del eattrib so just check status */
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
- ret = sm_p->msgarray[i].op_status;
+ ret = sm_p->msgarray_op.msgarray[i].op_status;
}
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
- {
- if (sm_p->msgarray[j].op_status != 0)
- {
- return(sm_p->msgarray[j].op_status);
- }
- }
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, j)
+ {
+ if (msg_p->op_status != 0)
+ {
+ return(msg_p->op_status);
+ }
+ }
}
return ret;
}
Index: sys-flush.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-flush.sm,v
diff -p -u -r1.41 -r1.41.8.1
--- sys-flush.sm 30 Aug 2007 00:13:41 -0000 1.41
+++ sys-flush.sm 16 May 2008 15:15:31 -0000 1.41.8.1
@@ -97,7 +97,7 @@ PVFS_error PVFS_isys_flush(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->object_ref = ref;
@@ -167,22 +167,18 @@ static int flush_datafile_setup_msgpaira
assert(attr->mask & PVFS_ATTR_META_DFILES);
assert(attr->u.meta.dfile_count > 0);
- /* datafile count + 1 metafile */
- sm_p->msgarray_count = (attr->u.meta.dfile_count + 1);
-
- /* allocate memory for datafile message pairs and the metafile */
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (sm_p->msgarray_count * sizeof(PINT_sm_msgpair_state)));
- if (!sm_p->msgarray)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, (attr->u.meta.dfile_count + 1));
+ if(ret != 0)
{
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n",
+ (attr->u.meta.dfile_count + 1));
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- for(i = 0; i < sm_p->msgarray_count; i++)
+ /* datafile count + 1 metafile */
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
if (i < attr->u.meta.dfile_count)
{
gossip_debug(GOSSIP_CLIENT_DEBUG,
@@ -201,7 +197,7 @@ static int flush_datafile_setup_msgpaira
}
else
{
- assert(i == (sm_p->msgarray_count - 1));
+ assert(i == (sm_p->msgarray_op.count - 1));
gossip_debug(GOSSIP_CLIENT_DEBUG,
" metafile_flush: flushing handle %llu\n",
@@ -219,13 +215,14 @@ static int flush_datafile_setup_msgpaira
}
}
- ret = PINT_serv_msgpairarray_resolve_addrs(
- sm_p->msgarray_count, sm_p->msgarray);
+ ret = PINT_serv_msgpairarray_resolve_addrs(&sm_p->msgarray_op);
if (ret)
{
gossip_err("Error: failed to resolve server addresses.\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -255,11 +252,7 @@ static int flush_cleanup(
PINT_SM_GETATTR_STATE_CLEAR(sm_p->getattr);
- if (sm_p->msgarray)
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
Index: sys-get-eattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-get-eattr.sm,v
diff -p -u -r1.12 -r1.12.8.1
--- sys-get-eattr.sm 30 Aug 2007 00:13:41 -0000 1.12
+++ sys-get-eattr.sm 16 May 2008 15:15:31 -0000 1.12.8.1
@@ -85,7 +85,7 @@ PVFS_error PVFS_isys_geteattr_list(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.geteattr.nkey = nkey;
sm_p->u.geteattr.key_array = key_array;
@@ -150,6 +150,7 @@ static PINT_sm_action get_eattr_setup_ms
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
int i;
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"get_eattr state: get_eattr_setup_msgpair\n");
@@ -165,32 +166,35 @@ static PINT_sm_action get_eattr_setup_ms
sm_p->u.geteattr.size_array[i] =
sm_p->u.geteattr.resp_p->val_array[i].buffer_sz;
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
+
PINT_SERVREQ_GETEATTR_FILL(
- sm_p->msgpair.req,
- (*sm_p->cred_p),
- sm_p->object_ref.fs_id,
- sm_p->object_ref.handle,
- sm_p->u.geteattr.nkey,
- sm_p->u.geteattr.key_array,
- sm_p->u.geteattr.size_array);
-
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
- sm_p->msgpair.fs_id = sm_p->object_ref.fs_id;
- sm_p->msgpair.handle = sm_p->object_ref.handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgpair.comp_fn = get_eattr_comp_fn;
+ msg_p->req,
+ (*sm_p->cred_p),
+ sm_p->object_ref.fs_id,
+ sm_p->object_ref.handle,
+ sm_p->u.geteattr.nkey,
+ sm_p->u.geteattr.key_array,
+ sm_p->u.geteattr.size_array);
+
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = get_eattr_comp_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr,
- sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr,
+ msg_p->handle,
+ msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
js_p->error_code = 0;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -221,7 +225,7 @@ static int get_eattr_comp_fn(
int ret = 0;
int decode_ret;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG,
"get_eattr completion fn: get_eattr_comp_fn\n");
@@ -238,7 +242,7 @@ static int get_eattr_comp_fn(
* val struct the user passed in
*/
- if (sm_p->msgarray[i].op_status == 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status == 0)
{
int k, mink;
mink = sm_p->u.geteattr.nkey;
@@ -305,19 +309,19 @@ static int get_eattr_comp_fn(
}
else
{
- ret = sm_p->msgarray[i].op_status;
+ ret = sm_p->msgarray_op.msgarray[i].op_status;
}
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
+ for (j=0; j < sm_p->msgarray_op.count; j++)
{
- if (sm_p->msgarray[j].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[j].op_status != 0)
{
- return(sm_p->msgarray[j].op_status);
+ return(sm_p->msgarray_op.msgarray[j].op_status);
}
}
}
Index: sys-getattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-getattr.sm,v
diff -p -u -r1.110 -r1.110.4.1
--- sys-getattr.sm 4 Jan 2008 16:37:12 -0000 1.110
+++ sys-getattr.sm 16 May 2008 15:15:31 -0000 1.110.4.1
@@ -194,7 +194,7 @@ PVFS_error PVFS_isys_getattr(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->error_code = 0;
sm_p->object_ref = ref;
@@ -204,7 +204,7 @@ PVFS_error PVFS_isys_getattr(
sm_p->getattr,
ref,
PVFS_util_sys_to_object_attr_mask(
- attrmask),
+ attrmask),
PVFS_TYPE_NONE,
0);
@@ -437,12 +437,14 @@ static PINT_sm_action getattr_object_get
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
PVFS_object_ref object_ref;
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG, "(%p) %s\n", sm_p, __func__);
js_p->error_code = 0;
- memset(&sm_p->msgpair, 0, sizeof(PINT_sm_msgpair_state));
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
object_ref = sm_p->getattr.object_ref;
@@ -451,33 +453,27 @@ static PINT_sm_action getattr_object_get
/* setup the msgpair to do a getattr operation */
PINT_SERVREQ_GETATTR_FILL(
- sm_p->msgpair.req,
+ msg_p->req,
*sm_p->cred_p,
object_ref.fs_id,
object_ref.handle,
sm_p->getattr.req_attrmask);
-
- sm_p->msgpair.fs_id = object_ref.fs_id;
- sm_p->msgpair.handle = object_ref.handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgpair.comp_fn = getattr_object_getattr_comp_fn;
+
+ msg_p->fs_id = object_ref.fs_id;
+ msg_p->handle = object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = getattr_object_getattr_comp_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr, sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr, msg_p->handle,
+ msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
- /* point msgarray to the statically allocated msgpair */
- if (sm_p->msgarray != NULL && sm_p->msgarray != &(sm_p->msgpair))
- {
- free(sm_p->msgarray);
- }
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -493,7 +489,7 @@ static int getattr_object_getattr_comp_f
{
PVFS_object_attr *attr = NULL;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_GETATTR);
@@ -551,7 +547,7 @@ static int getattr_object_getattr_comp_f
switch (attr->objtype)
{
case PVFS_TYPE_METAFILE:
- if (sm_p->msgpair.req.u.getattr.attrmask &
+ if (sm_p->msgarray_op.msgpair.req.u.getattr.attrmask &
PVFS_ATTR_META_DIST)
{
/* if we requested distribution attrs, did the distribution
@@ -561,7 +557,7 @@ static int getattr_object_getattr_comp_f
assert(attr->u.meta.dist && (attr->u.meta.dist_size > 0));
}
- if (sm_p->msgpair.req.u.getattr.attrmask &
+ if (sm_p->msgarray_op.msgpair.req.u.getattr.attrmask &
PVFS_ATTR_META_DFILES)
{
/* if we requested the datafile handles for the file, did
@@ -621,7 +617,7 @@ static int getattr_object_getattr_comp_f
static PINT_sm_action getattr_object_getattr_failure(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ struct PINT_client_sm *sm_p __attribute__((unused)) = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(
GOSSIP_CLIENT_DEBUG,
"(%p) getattr state: getattr_object_getattr_failure\n", sm_p);
@@ -642,26 +638,25 @@ static PINT_sm_action getattr_datafile_g
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0;
PVFS_object_attr *attr = NULL;
+ PINT_sm_msgpair_state *msg_p;
+ int index;
js_p->error_code = 0;
attr = &sm_p->getattr.attr;
assert(attr);
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- attr->u.meta.dfile_count * sizeof(PINT_sm_msgpair_state));
- if (!sm_p->msgarray)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, attr->u.meta.dfile_count);
+ if(ret != 0)
{
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n", attr->u.meta.dfile_count);
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = attr->u.meta.dfile_count;
-
/* for each datafile, post a send/recv pair to obtain the size */
- for(i = 0; i < sm_p->msgarray_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, index)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
assert(msg_p);
gossip_debug(GOSSIP_GETATTR_DEBUG,
@@ -681,13 +676,14 @@ static PINT_sm_action getattr_datafile_g
msg_p->comp_fn = getattr_datafile_getattr_comp_fn;
}
- ret = PINT_serv_msgpairarray_resolve_addrs(
- sm_p->msgarray_count, sm_p->msgarray);
+ ret = PINT_serv_msgpairarray_resolve_addrs(&sm_p->msgarray_op);
if (ret < 0)
{
gossip_lerr("Error: failed to resolve meta server addresses.\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -695,7 +691,7 @@ static int getattr_datafile_getattr_comp
void *v_p, struct PVFS_server_resp *resp_p, int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
if (resp_p->status != 0)
{
@@ -717,7 +713,7 @@ static int getattr_datafile_getattr_comp
static PINT_sm_action getattr_datafile_getattr_failure(
struct PINT_smcb *smcb, job_status_s *js_p)
{
- struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ struct PINT_client_sm *sm_p __attribute__((unused)) = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
gossip_debug(GOSSIP_CLIENT_DEBUG, "(%p) getattr state: "
"getattr_datafile_getattr_failure\n", sm_p);
return SM_ACTION_COMPLETE;
@@ -729,11 +725,7 @@ static PINT_sm_action getattr_datafile_g
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
if(js_p->error_code == 0)
{
- if (sm_p->msgarray)
- {
- free(sm_p->msgarray);
- }
- sm_p->msgarray = NULL;
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
}
return SM_ACTION_COMPLETE;
Index: sys-io.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-io.sm,v
diff -p -u -r1.159 -r1.159.4.1
--- sys-io.sm 19 Dec 2007 05:37:54 -0000 1.159
+++ sys-io.sm 16 May 2008 15:15:31 -0000 1.159.4.1
@@ -284,7 +284,7 @@ PVFS_error PVFS_isys_io(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.io.io_type = io_type;
sm_p->u.io.file_req = file_req;
@@ -296,7 +296,8 @@ PVFS_error PVFS_isys_io(
sm_p->u.io.encoding = cur_fs->encoding;
sm_p->u.io.stored_error_code = 0;
sm_p->u.io.retry_count = 0;
- sm_p->msgarray = NULL;
+ sm_p->msgarray_op.msgarray = NULL;
+ sm_p->msgarray_op.count = 0;
sm_p->u.io.datafile_index_array = NULL;
sm_p->u.io.datafile_count = 0;
sm_p->u.io.total_size = 0;
@@ -391,7 +392,7 @@ static PINT_sm_action io_init(
}
gossip_debug(GOSSIP_IO_DEBUG, " sys-io retrying with delay.\n");
return job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
}
return SM_ACTION_COMPLETE;
@@ -834,17 +835,17 @@ io_datafile_post_msgpairs_retry(
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
/* give up if beyond retry limit */
++sm_p->u.io.retry_count;
- if (sm_p->u.io.retry_count > sm_p->msgarray_params.retry_limit) {
+ if (sm_p->u.io.retry_count > sm_p->msgarray_op.params.retry_limit) {
gossip_debug(GOSSIP_CLIENT_DEBUG, "%s: retry %d exceeds limit %d\n",
- __func__, sm_p->u.io.retry_count, sm_p->msgarray_params.retry_delay);
+ __func__, sm_p->u.io.retry_count, sm_p->msgarray_op.params.retry_delay);
js_p->error_code = IO_DATAFILE_TRANSFERS_COMPLETE;
return SM_ACTION_COMPLETE;
}
gossip_debug(GOSSIP_CLIENT_DEBUG, "%s: retry %d, wait %d ms\n", __func__,
- sm_p->u.io.retry_count, sm_p->msgarray_params.retry_delay);
+ sm_p->u.io.retry_count, sm_p->msgarray_op.params.retry_delay);
- return job_req_sched_post_timer(sm_p->msgarray_params.retry_delay,
+ return job_req_sched_post_timer(sm_p->msgarray_op.params.retry_delay,
smcb, 0, js_p, NULL, pint_client_sm_context);
}
@@ -1046,7 +1047,7 @@ static PINT_sm_action io_datafile_comple
"%s: flow failed, not retrying\n", __func__);
/* forcing the count high insures that the sm won't restart */
- sm_p->u.io.retry_count = sm_p->msgarray_params.retry_limit;
+ sm_p->u.io.retry_count = sm_p->msgarray_op.params.retry_limit;
}
}
}
@@ -1091,7 +1092,7 @@ static PINT_sm_action io_datafile_comple
/* bump up the retry count to prevent the state machine from
* restarting after this error propigates
*/
- sm_p->u.io.retry_count = sm_p->msgarray_params.retry_limit;
+ sm_p->u.io.retry_count = sm_p->msgarray_op.params.retry_limit;
}
}
}
@@ -1254,7 +1255,7 @@ static PINT_sm_action io_analyze_results
if (((PVFS_ERROR_CLASS(-ret) == PVFS_ERROR_BMI) ||
(PVFS_ERROR_CLASS(-ret) == PVFS_ERROR_FLOW) ||
(ret == -ECONNRESET) || (ret == -PVFS_EPROTO)) &&
- (sm_p->u.io.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.io.retry_count < sm_p->msgarray_op.params.retry_limit))
{
assert(!PINT_smcb_cancelled(smcb));
Index: sys-list-eattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-list-eattr.sm,v
diff -p -u -r1.9 -r1.9.8.1
--- sys-list-eattr.sm 30 Aug 2007 00:13:42 -0000 1.9
+++ sys-list-eattr.sm 16 May 2008 15:15:31 -0000 1.9.8.1
@@ -84,7 +84,7 @@ PVFS_error PVFS_isys_listeattr(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.listeattr.nkey = nkey;
sm_p->u.listeattr.resp_p = resp_p;
@@ -136,6 +136,7 @@ static PINT_sm_action list_eattr_setup_m
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
int i;
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"list_eattr state: list_eattr_setup_msgpair\n");
@@ -149,33 +150,35 @@ static PINT_sm_action list_eattr_setup_m
sm_p->u.listeattr.size_array[i] =
sm_p->u.listeattr.resp_p->key_array[i].buffer_sz;
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
+
PINT_SERVREQ_LISTEATTR_FILL(
- sm_p->msgpair.req,
+ msg_p->req,
(*sm_p->cred_p),
sm_p->object_ref.fs_id,
sm_p->object_ref.handle,
sm_p->u.listeattr.pos_token,
sm_p->u.listeattr.nkey,
- sm_p->u.listeattr.size_array
- );
+ sm_p->u.listeattr.size_array);
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
- sm_p->msgpair.fs_id = sm_p->object_ref.fs_id;
- sm_p->msgpair.handle = sm_p->object_ref.handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgpair.comp_fn = list_eattr_comp_fn;
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = list_eattr_comp_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr,
- sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr,
+ msg_p->handle,
+ msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
js_p->error_code = 0;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -200,7 +203,7 @@ static int list_eattr_comp_fn(
{
int ret = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG,
"list_eattr completion fn: list_eattr_comp_fn\n");
@@ -212,9 +215,9 @@ static int list_eattr_comp_fn(
{
return resp_p->status;
}
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
- return sm_p->msgarray[i].op_status;
+ return sm_p->msgarray_op.msgarray[i].op_status;
}
sm_p->u.listeattr.resp_p->token = resp_p->u.listeattr.token;
sm_p->u.listeattr.resp_p->nkey = resp_p->u.listeattr.nkey;
Index: sys-lookup.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-lookup.sm,v
diff -p -u -r1.75 -r1.75.4.1
--- sys-lookup.sm 21 Jan 2008 21:09:37 -0000 1.75
+++ sys-lookup.sm 16 May 2008 15:15:31 -0000 1.75.4.1
@@ -479,7 +479,7 @@ PVFS_error PVFS_isys_ref_lookup(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.lookup.orig_pathname = relative_pathname;
sm_p->u.lookup.starting_refn = parent;
@@ -683,7 +683,8 @@ static PINT_sm_action lookup_segment_set
seg_to_lookup = cur_seg->seg_remaining ? cur_seg->seg_remaining :
cur_seg->seg_name;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_LOOKUP_PATH_FILL(
msg_p->req,
@@ -710,6 +711,8 @@ static PINT_sm_action lookup_segment_set
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -1099,7 +1102,7 @@ static int lookup_segment_lookup_comp_fn
{
int i = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
PINT_client_lookup_sm_segment *cur_seg = NULL;
int current_seg_index = sm_p->u.lookup.contexts[
sm_p->u.lookup.current_context].current_segment;
Index: sys-mkdir.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-mkdir.sm,v
diff -p -u -r1.63 -r1.63.2.1
--- sys-mkdir.sm 14 Feb 2008 00:04:39 -0000 1.63
+++ sys-mkdir.sm 16 May 2008 15:15:31 -0000 1.63.2.1
@@ -199,7 +199,7 @@ PVFS_error PVFS_isys_mkdir(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.mkdir.object_name = object_name;
PVFS_util_copy_sys_attr(&sm_p->u.mkdir.sys_attr, &attr);
@@ -268,7 +268,7 @@ static PINT_sm_action mkdir_init(
js_p->error_code = 0;
return job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
}
@@ -287,7 +287,7 @@ static int mkdir_msg_comp_fn(void *v_p,
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
PVFS_object_attr attr;
gossip_debug(GOSSIP_CLIENT_DEBUG, "mkdir_msg_comp_fn\n");
@@ -348,7 +348,8 @@ static PINT_sm_action mkdir_msg_setup_ms
gossip_debug(GOSSIP_CLIENT_DEBUG," mkdir: posting mkdir req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
ret = PINT_cached_config_get_next_meta(
sm_p->object_ref.fs_id,
@@ -373,6 +374,7 @@ static PINT_sm_action mkdir_msg_setup_ms
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = mkdir_msg_comp_fn;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -405,7 +407,8 @@ static PINT_sm_action mkdir_crdirent_set
llu(sm_p->u.mkdir.metafile_handle),
llu(sm_p->object_ref.handle));
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_CRDIRENT_FILL(
msg_p->req,
@@ -429,6 +432,8 @@ static PINT_sm_action mkdir_crdirent_set
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -457,7 +462,8 @@ static PINT_sm_action mkdir_delete_handl
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
ret = PINT_cached_config_map_to_server(
&metafile_server_addr, sm_p->u.mkdir.metafile_handle,
@@ -484,6 +490,8 @@ static PINT_sm_action mkdir_delete_handl
gossip_debug(GOSSIP_CLIENT_DEBUG, " Preparing to remove "
"directory handle %llu\n", llu(msg_p->handle));
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -531,7 +539,7 @@ static PINT_sm_action mkdir_cleanup(
(const PVFS_object_ref*) &(sm_p->object_ref));
}
else if ((PVFS_ERROR_CLASS(-sm_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.mkdir.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.mkdir.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.mkdir.stored_error_code = 0;
sm_p->u.mkdir.retry_count++;
@@ -682,30 +690,28 @@ static PINT_sm_action mkdir_seteattr_set
cur_index++;
}
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_SETEATTR_FILL(
- sm_p->msgpair.req,
+ msg_p->req,
(*sm_p->cred_p),
sm_p->object_ref.fs_id,
sm_p->u.mkdir.metafile_handle,
0,
eattr_count,
sm_p->u.mkdir.key_array,
- sm_p->u.mkdir.val_array
- );
+ sm_p->u.mkdir.val_array);
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
- sm_p->msgpair.fs_id = sm_p->object_ref.fs_id;
- sm_p->msgpair.handle = sm_p->u.mkdir.metafile_handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->u.mkdir.metafile_handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
/* NOTE: no comp_fn needed. */
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr,
- sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr,
+ msg_p->handle,
+ msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
@@ -715,6 +721,8 @@ static PINT_sm_action mkdir_seteattr_set
{
js_p->error_code = 0;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
Index: sys-readdir.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-readdir.sm,v
diff -p -u -r1.52 -r1.52.8.1
--- sys-readdir.sm 30 Aug 2007 00:13:42 -0000 1.52
+++ sys-readdir.sm 16 May 2008 15:15:31 -0000 1.52.8.1
@@ -136,7 +136,7 @@ PVFS_error PVFS_isys_readdir(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.readdir.readdir_resp = resp;
sm_p->object_ref = ref;
@@ -241,7 +241,8 @@ static PINT_sm_action readdir_msg_setup_
llu(sm_p->readdir.pos_token),
sm_p->readdir.dirent_limit);
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_READDIR_FILL(
msg_p->req,
@@ -265,6 +266,8 @@ static PINT_sm_action readdir_msg_setup_
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -273,7 +276,7 @@ static int readdir_msg_comp_fn(void *v_p
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG, "readdir_msg_comp_fn\n");
Index: sys-readdirplus.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-readdirplus.sm,v
diff -p -u -r1.9 -r1.9.2.1
--- sys-readdirplus.sm 12 Mar 2008 19:50:00 -0000 1.9
+++ sys-readdirplus.sm 16 May 2008 15:15:31 -0000 1.9.2.1
@@ -148,7 +148,7 @@ PVFS_error PVFS_isys_readdirplus(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->object_ref = ref;
/* point the sm dirent array and outcount to the readdirplus response field */
@@ -466,6 +466,7 @@ static PINT_sm_action readdirplus_fetch_
{
int i, ret;
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgpair_state *msg_p = NULL;
gossip_debug(GOSSIP_CLIENT_DEBUG, "readdirplus state: fetch_attrs_setup\n");
/* if there are no dirents then return NO_WORK */
@@ -491,21 +492,18 @@ static PINT_sm_action readdirplus_fetch_
js_p->error_code = -PVFS_EINVAL;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = sm_p->u.readdirplus.svr_count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)
- calloc(sm_p->msgarray_count, sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
- {
- sm_p->msgarray_count = 0;
- js_p->error_code = -PVFS_ENOMEM;
- gossip_err("Could not allocate memory %d\n", -PVFS_ENOMEM);
+ ret = PINT_msgpairarray_init(
+ &sm_p->msgarray_op, sm_p->u.readdirplus.svr_count);
+ if(ret != 0)
+ {
+ gossip_err("Failed to initialize %d msgpairs\n",
+ sm_p->u.readdirplus.svr_count);
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- for (i = 0; i < sm_p->msgarray_count; i++)
- {
- PINT_sm_msgpair_state *msg_p = NULL;
- msg_p = &sm_p->msgarray[i];
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
+ {
PINT_SERVREQ_LISTATTR_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -521,6 +519,7 @@ static PINT_sm_action readdirplus_fetch_
}
/* immediate return. next state jumps to msgpairarray machine */
js_p->error_code = 0;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -530,14 +529,14 @@ static int readdirplus_fetch_attrs_comp_
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_LISTATTR_DEBUG,
"readdirplus_fetch_attrs_comp_fn called\n");
assert(resp_p->op == PVFS_SERV_LISTATTR);
/* Mark all handles in this server range as having failed a stat */
- if (sm_p->msgarray[index].op_status != 0) {
+ if (sm_p->msgarray_op.msgarray[index].op_status != 0) {
int i, handle_index;
for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) {
get_handle_index(sm_p->u.readdirplus.input_handle_array,
@@ -547,10 +546,10 @@ static int readdirplus_fetch_attrs_comp_
NULL);
assert(handle_index >= 0);
sm_p->u.readdirplus.readdirplus_resp->stat_err_array[handle_index] =
- sm_p->msgarray[index].op_status;
+ sm_p->msgarray_op.msgarray[index].op_status;
}
}
- else if (sm_p->msgarray[index].op_status == 0)
+ else if (sm_p->msgarray_op.msgarray[index].op_status == 0)
{
/* fetch all errors from the servresp structure and copy the object attributes */
int i, handle_index;
@@ -580,14 +579,14 @@ static int readdirplus_fetch_attrs_comp_
/* if this is the last response, check all the status values
and return error codes if any requests failed
*/
- if (index == (sm_p->msgarray_count - 1))
+ if (index == (sm_p->msgarray_op.count - 1))
{
int i;
- for (i = 0; i < sm_p->msgarray_count; i++)
+ for (i = 0; i < sm_p->msgarray_op.count; i++)
{
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
- return sm_p->msgarray[i].op_status;
+ return sm_p->msgarray_op.msgarray[i].op_status;
}
}
/* destroy scratch space.. we need to reuse them in phase 2 */
@@ -688,12 +687,10 @@ static PINT_sm_action readdirplus_fetch_
{
int i, ret;
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_msgpair_state *msg_p;
+
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
/* don't need sizes */
if (!(sm_p->u.readdirplus.attrmask & PVFS_ATTR_META_ALL)
&& !(sm_p->u.readdirplus.attrmask & PVFS_ATTR_DATA_SIZE)) {
@@ -713,19 +710,18 @@ static PINT_sm_action readdirplus_fetch_
js_p->error_code = NO_WORK;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = sm_p->u.readdirplus.svr_count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)
- calloc(sm_p->msgarray_count, sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, sm_p->u.readdirplus.svr_count);
+ if(ret != 0)
{
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n",
+ sm_p->u.readdirplus.svr_count);
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- for (i = 0; i < sm_p->msgarray_count; i++)
- {
- PINT_sm_msgpair_state *msg_p = NULL;
- msg_p = &sm_p->msgarray[i];
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
+ {
PINT_SERVREQ_LISTATTR_FILL(
msg_p->req,
*sm_p->cred_p,
@@ -742,6 +738,8 @@ static PINT_sm_action readdirplus_fetch_
}
/* immediate return. next state jumps to msgpairarray machine */
js_p->error_code = 0;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -751,14 +749,14 @@ static int readdirplus_fetch_sizes_comp_
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_LISTATTR_DEBUG,
"readdirplus_fetch_sizes_comp_fn called\n");
assert(resp_p->op == PVFS_SERV_LISTATTR);
/* Mark all handles in this server range as having failed a stat */
- if (sm_p->msgarray[index].op_status != 0) {
+ if (sm_p->msgarray_op.msgarray[index].op_status != 0) {
int i, handle_index, aux_index;
for (i = 0; i < sm_p->u.readdirplus.handle_count[index]; i++) {
get_handle_index(sm_p->u.readdirplus.input_handle_array,
@@ -768,10 +766,10 @@ static int readdirplus_fetch_sizes_comp_
&aux_index);
assert(handle_index >= 0 && aux_index >= 0);
sm_p->u.readdirplus.readdirplus_resp->stat_err_array[handle_index] =
- sm_p->msgarray[index].op_status;
+ sm_p->msgarray_op.msgarray[index].op_status;
}
}
- else if (sm_p->msgarray[index].op_status == 0)
+ else if (sm_p->msgarray_op.msgarray[index].op_status == 0)
{
/* fetch all errors from the servresp structure and copy the object attributes */
int i, handle_index, aux_index;
@@ -800,16 +798,9 @@ static int readdirplus_fetch_sizes_comp_
/* If this is the last server response, check all the status values
* and stash any error codes if any of them failed
*/
- if (index == (sm_p->msgarray_count - 1))
+ if (index == (sm_p->msgarray_op.count - 1))
{
- int i;
- for (i = 0; i < sm_p->msgarray_count; i++)
- {
- if (sm_p->msgarray[i].op_status != 0)
- {
- return sm_p->msgarray[i].op_status;
- }
- }
+ return PINT_msgarray_status(&sm_p->msgarray_op);
}
return 0;
}
@@ -926,11 +917,7 @@ static PINT_sm_action readdirplus_cleanu
}
free(sm_p->u.readdirplus.obj_attr_array);
sm_p->u.readdirplus.obj_attr_array = NULL;
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
}
Index: sys-remove.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-remove.sm,v
diff -p -u -r1.105 -r1.105.8.1
--- sys-remove.sm 30 Aug 2007 00:13:42 -0000 1.105
+++ sys-remove.sm 16 May 2008 15:15:31 -0000 1.105.8.1
@@ -181,7 +181,7 @@ PVFS_error PVFS_isys_remove(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.remove.object_name = object_name;
sm_p->parent_ref = parent_ref;
@@ -261,7 +261,8 @@ static PINT_sm_action remove_rmdirent_se
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_RMDIRENT_FILL(
msg_p->req,
@@ -288,6 +289,8 @@ static PINT_sm_action remove_rmdirent_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -305,7 +308,8 @@ static PINT_sm_action remove_crdirent_se
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_CRDIRENT_FILL(
msg_p->req,
@@ -335,6 +339,8 @@ static PINT_sm_action remove_crdirent_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -344,7 +350,7 @@ static int remove_rmdirent_comp_fn(
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
assert(resp_p->op == PVFS_SERV_RMDIRENT);
@@ -427,11 +433,7 @@ static PINT_sm_action remove_cleanup(
PINT_ncache_invalidate((const char*) sm_p->u.remove.object_name,
(const PVFS_object_ref*) &(sm_p->parent_ref));
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
@@ -447,7 +449,7 @@ static PINT_sm_action remove_generic_tim
gossip_debug(GOSSIP_CLIENT_DEBUG, "remove state: generic_timer\n");
ret = job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
return ret;
@@ -462,7 +464,7 @@ static PINT_sm_action remove_crdirent_re
/* try again (up to a point) if we get a comm. failure. */
if ((PVFS_ERROR_CLASS(-js_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.remove.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.remove.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.remove.retry_count++;
js_p->error_code = CRDIRENT_RETRY;
@@ -501,7 +503,7 @@ static PINT_sm_action remove_rmdirent_re
/* try again (up to a point) if we get a comm. failure. */
if ((PVFS_ERROR_CLASS(-js_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.remove.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.remove.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.remove.retry_count++;
js_p->error_code = RMDIRENT_RETRY;
Index: sys-rename.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-rename.sm,v
diff -p -u -r1.56 -r1.56.8.1
--- sys-rename.sm 30 Aug 2007 00:13:42 -0000 1.56
+++ sys-rename.sm 16 May 2008 15:15:31 -0000 1.56.8.1
@@ -266,7 +266,7 @@ PVFS_error PVFS_isys_rename(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, old_parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, old_parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
/*
this state machine has several hardcoded 2's around because
@@ -366,7 +366,7 @@ static int rename_lookups_comp_fn(
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG, "rename_lookups_comp_fn\n");
@@ -427,7 +427,7 @@ static int rename_lookups_comp_fn(
/* set fs_id and handle for getattr nested sm */
sm_p->object_ref = sm_p->u.rename.refns[0];
- if(sm_p->msgarray[0].op_status == 0)
+ if(sm_p->msgarray_op.msgarray[0].op_status == 0)
{
PINT_SM_GETATTR_STATE_FILL(
sm_p->getattr,
@@ -442,7 +442,7 @@ static int rename_lookups_comp_fn(
else
{
/* if the first one failed, maintain its error code */
- return(sm_p->msgarray[0].op_status);
+ return(sm_p->msgarray_op.msgarray[0].op_status);
}
}
return 0;
@@ -464,7 +464,7 @@ static int rename_rmdirent_comp_fn(void
{
PINT_smcb *smcb = v_p;
PINT_client_sm *sm_p __attribute__((unused)) =
- PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG, "rename_rmdirent_comp_fn\n");
assert(resp_p->op == PVFS_SERV_RMDIRENT);
@@ -488,7 +488,7 @@ static int rename_chdirent_comp_fn(
void *v_p, struct PVFS_server_resp *resp_p, int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
gossip_debug(GOSSIP_CLIENT_DEBUG, "rename_chdirent_comp_fn\n");
@@ -517,22 +517,20 @@ static PINT_sm_action rename_lookups_set
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL, i = 0;
+ PINT_sm_msgpair_state *msg_p;
js_p->error_code = 0;
- sm_p->msgarray_count = 2;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- sm_p->msgarray_count * sizeof(PINT_sm_msgpair_state));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, 2);
+ if(ret != 0)
{
- gossip_err("rename: failed to allocate msgarray\n");
- return -PVFS_ENOMEM;
+ js_p->error_code = ret;
+ return SM_ACTION_COMPLETE;
}
/* prepare to post the lookup send/recv pairs */
- for(i = 0; i < 2; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- PINT_sm_msgpair_state *msg_p = &sm_p->msgarray[i];
gossip_debug(GOSSIP_CLIENT_DEBUG,
"rename: posting lookup[%d] (%lld,%d)\n",
@@ -563,6 +561,8 @@ static PINT_sm_action rename_lookups_set
break;
}
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -570,11 +570,7 @@ static PINT_sm_action rename_lookups_fai
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- if (sm_p->msgarray)
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -589,8 +585,9 @@ static PINT_sm_action rename_crdirent_se
gossip_debug(GOSSIP_CLIENT_DEBUG," rename: posting crdirent req\n");
- assert(sm_p->msgarray);
- PINT_init_msgpair(sm_p, msg_p);
+ assert(sm_p->msgarray_op.msgarray);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
/*
hook the 'old' handle up to the new parent with the 'new_entry'
@@ -618,6 +615,8 @@ static PINT_sm_action rename_crdirent_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -632,7 +631,7 @@ static PINT_sm_action rename_rmdirent_se
gossip_debug(GOSSIP_CLIENT_DEBUG," rename: posting rmdirent req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
/*
in the normal case, the state machine will lead us here and we
@@ -666,8 +665,10 @@ static PINT_sm_action rename_rmdirent_se
if (ret)
{
gossip_err("Failed to map meta server address\n");
- js_p->error_code = ret;
+ js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -764,7 +765,7 @@ static PINT_sm_action rename_chdirent_se
gossip_debug(GOSSIP_CLIENT_DEBUG," rename: posting chdirent req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
/*
here, we're exhanging the existing dirent under the 'new' parent
@@ -792,6 +793,8 @@ static PINT_sm_action rename_chdirent_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -858,12 +861,7 @@ static PINT_sm_action rename_cleanup(
PINT_SM_GETATTR_STATE_CLEAR(sm_p->getattr);
- if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
-
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
}
@@ -876,7 +874,7 @@ static PINT_sm_action rename_generic_tim
job_id_t tmp_id;
ret = job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
return ret;
@@ -889,7 +887,7 @@ static PINT_sm_action rename_crdirent_re
/* try again (up to a point) if we get a comm. failure. */
if ((PVFS_ERROR_CLASS(-js_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.rename.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.rename.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.rename.retry_count++;
js_p->error_code = RENAME_CRDIRENT_RETRY;
@@ -918,7 +916,7 @@ static PINT_sm_action rename_rmdirent_re
/* try again (up to a point) if we get a comm. failure. */
if ((PVFS_ERROR_CLASS(-js_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.rename.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.rename.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.rename.retry_count++;
js_p->error_code = RENAME_RMDIRENT_RETRY;
Index: sys-set-eattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-set-eattr.sm,v
diff -p -u -r1.11 -r1.11.8.1
--- sys-set-eattr.sm 30 Aug 2007 00:13:42 -0000 1.11
+++ sys-set-eattr.sm 16 May 2008 15:15:31 -0000 1.11.8.1
@@ -99,7 +99,7 @@ PVFS_error PVFS_isys_seteattr_list(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.seteattr.nkey = nkey;
sm_p->u.seteattr.key_array = key_array;
@@ -163,35 +163,36 @@ static PINT_sm_action set_eattr_setup_ms
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
int ret = -PVFS_EINVAL;
+ PINT_sm_msgpair_state *msg_p;
+
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
PINT_SERVREQ_SETEATTR_FILL(
- sm_p->msgpair.req,
+ msg_p->req,
(*sm_p->cred_p),
sm_p->object_ref.fs_id,
sm_p->object_ref.handle,
sm_p->u.seteattr.flags,
sm_p->u.seteattr.nkey,
sm_p->u.seteattr.key_array,
- sm_p->u.seteattr.val_array
- );
+ sm_p->u.seteattr.val_array);
- sm_p->msgarray = &(sm_p->msgpair);
- sm_p->msgarray_count = 1;
- sm_p->msgpair.fs_id = sm_p->object_ref.fs_id;
- sm_p->msgpair.handle = sm_p->object_ref.handle;
- sm_p->msgpair.retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgpair.comp_fn = set_eattr_comp_fn;
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = set_eattr_comp_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgpair.svr_addr,
- sm_p->msgpair.handle,
- sm_p->msgpair.fs_id);
+ &msg_p->svr_addr, msg_p->handle, msg_p->fs_id);
if (ret)
{
gossip_err("Failed to map meta server address\n");
js_p->error_code = 0;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -213,7 +214,8 @@ static int set_eattr_comp_fn(
int j = 0;
int ret = 0;
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
+ PINT_sm_msgpair_state *msg_p;
gossip_debug(GOSSIP_CLIENT_DEBUG,
"get_eattr completion fn: set_eattr_comp_fn\n");
@@ -223,23 +225,23 @@ static int set_eattr_comp_fn(
/* no return value from set eattrib so just check status */
- if (sm_p->msgarray[i].op_status != 0)
+ if (sm_p->msgarray_op.msgarray[i].op_status != 0)
{
- ret = sm_p->msgarray[i].op_status;
+ ret = sm_p->msgarray_op.msgarray[i].op_status;
}
/* if this is the last response, check all of the status values
* and return error code if any requests failed
*/
- if (i == (sm_p->msgarray_count -1))
+ if (i == (sm_p->msgarray_op.count -1))
{
- for (j=0; j < sm_p->msgarray_count; j++)
- {
- if (sm_p->msgarray[j].op_status != 0)
- {
- return(sm_p->msgarray[j].op_status);
- }
- }
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, j)
+ {
+ if (msg_p->op_status != 0)
+ {
+ return(msg_p->op_status);
+ }
+ }
}
return ret;
}
Index: sys-setattr.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-setattr.sm,v
diff -p -u -r1.51 -r1.51.8.1
--- sys-setattr.sm 30 Aug 2007 00:13:42 -0000 1.51
+++ sys-setattr.sm 16 May 2008 15:15:31 -0000 1.51.8.1
@@ -120,7 +120,7 @@ PVFS_error PVFS_isys_setattr(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->object_ref = ref;
@@ -203,7 +203,8 @@ static PINT_sm_action setattr_msg_setup_
gossip_debug(GOSSIP_CLIENT_DEBUG," setattr: posting setattr req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
objtype = ((sm_p->u.setattr.sys_attr.mask & PVFS_ATTR_SYS_TYPE) ?
sm_p->u.setattr.sys_attr.objtype : PVFS_TYPE_NONE);
@@ -239,6 +240,8 @@ static PINT_sm_action setattr_msg_setup_
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
Index: sys-small-io.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-small-io.sm,v
diff -p -u -r1.15 -r1.15.8.1
--- sys-small-io.sm 30 Aug 2007 00:13:42 -0000 1.15
+++ sys-small-io.sm 16 May 2008 15:15:32 -0000 1.15.8.1
@@ -76,22 +76,22 @@ static PINT_sm_action small_io_setup_msg
int ret;
PVFS_handle datafile_handle;
int regions = 0;
+ PINT_sm_msgpair_state *msg_p;
js_p->error_code = 0;
attr = &sm_p->getattr.attr;
assert(attr);
-
+
/* initialize msgarray */
- ret = PINT_msgpairarray_init(&sm_p->msgarray, sm_p->u.io.datafile_count);
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, sm_p->u.io.datafile_count);
if(ret < 0)
{
js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
- sm_p->msgarray_count = sm_p->u.io.datafile_count;
- for(i = 0; i < sm_p->u.io.datafile_count; ++i)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
datafile_handle = attr->u.meta.dfile_array[
sm_p->u.io.datafile_index_array[i]];
@@ -128,9 +128,9 @@ static PINT_sm_action small_io_setup_msg
result.segs = 0;
result.bytes = 0;
- result.offset_array = sm_p->msgarray[i].req.u.small_io.offsets;
- result.size_array = sm_p->msgarray[i].req.u.small_io.sizes;
- sm_p->msgarray[i].req.u.small_io.buffer = sm_p->u.io.buffer;
+ result.offset_array = msg_p->req.u.small_io.offsets;
+ result.size_array = msg_p->req.u.small_io.sizes;
+ msg_p->req.u.small_io.buffer = sm_p->u.io.buffer;
ret = PINT_process_request(
file_req_state, mem_req_state,
@@ -157,7 +157,7 @@ static PINT_sm_action small_io_setup_msg
* the response.
*/
PINT_SERVREQ_SMALL_IO_FILL(
- sm_p->msgarray[i].req,
+ msg_p->req,
*sm_p->cred_p,
sm_p->object_ref.fs_id,
datafile_handle,
@@ -170,13 +170,13 @@ static PINT_sm_action small_io_setup_msg
regions,
PINT_REQUEST_TOTAL_BYTES(sm_p->u.io.mem_req));
- sm_p->msgarray[i].fs_id = sm_p->object_ref.fs_id;
- sm_p->msgarray[i].handle = sm_p->object_ref.handle;
- sm_p->msgarray[i].retry_flag = PVFS_MSGPAIR_RETRY;
- sm_p->msgarray[i].comp_fn = small_io_completion_fn;
+ msg_p->fs_id = sm_p->object_ref.fs_id;
+ msg_p->handle = sm_p->object_ref.handle;
+ msg_p->retry_flag = PVFS_MSGPAIR_RETRY;
+ msg_p->comp_fn = small_io_completion_fn;
ret = PINT_cached_config_map_to_server(
- &sm_p->msgarray[i].svr_addr, datafile_handle,
+ &msg_p->svr_addr, datafile_handle,
sm_p->object_ref.fs_id);
if(ret < 0)
{
@@ -187,6 +187,8 @@ static PINT_sm_action small_io_setup_msg
}
js_p->error_code = 0;
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -201,7 +203,7 @@ static int small_io_completion_fn(void *
int index)
{
struct PINT_smcb *smcb = (struct PINT_smcb *)user_args;
- struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
+ struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
int ret = 0;
assert(resp_p->op == PVFS_SERV_SMALL_IO);
@@ -315,10 +317,7 @@ static int small_io_cleanup(
struct PINT_smcb *smcb, job_status_s *js_p)
{
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_msgpairarray_destroy(sm_p->msgarray);
- sm_p->msgarray = NULL;
- sm_p->msgarray_count = 0;
-
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
Index: sys-statfs.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-statfs.sm,v
diff -p -u -r1.8 -r1.8.2.1
--- sys-statfs.sm 14 Feb 2008 00:04:39 -0000 1.8
+++ sys-statfs.sm 16 May 2008 15:15:32 -0000 1.8.2.1
@@ -113,7 +113,7 @@ PVFS_error PVFS_isys_statfs(
return ret;
}
- PINT_init_msgarray_params(&sm_p->msgarray_params, fs_id);
+ PINT_init_msgarray_params(sm_p, fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.statfs_list.fs_id = fs_id;
sm_p->u.statfs_list.details = NULL;
@@ -122,16 +122,11 @@ PVFS_error PVFS_isys_statfs(
memset(sm_p->u.statfs_list.stat_array, 0,
(sm_p->u.statfs_list.count * sizeof(struct PVFS_mgmt_server_stat)));
- sm_p->msgarray_count = sm_p->u.statfs_list.count;
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (sm_p->msgarray_count * sizeof(PINT_sm_msgpair_state)));
- if (sm_p->msgarray == NULL)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, sm_p->u.statfs_list.count);
+ if(ret != 0)
{
- PVFS_util_release_credentials(sm_p->cred_p);
- free(sm_p->u.statfs_list.addr_array);
- free(sm_p->u.statfs_list.stat_array);
- PINT_smcb_free(smcb);
- return -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n", sm_p->u.statfs_list.count);
+ return ret;
}
return PINT_client_state_machine_post(
Index: sys-symlink.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-symlink.sm,v
diff -p -u -r1.71 -r1.71.2.1
--- sys-symlink.sm 14 Feb 2008 00:04:39 -0000 1.71
+++ sys-symlink.sm 16 May 2008 15:15:32 -0000 1.71.2.1
@@ -191,7 +191,7 @@ PVFS_error PVFS_isys_symlink(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, parent_ref.fs_id);
+ PINT_init_msgarray_params(sm_p, parent_ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.sym.link_name = entry_name;
sm_p->u.sym.link_target = target;
@@ -263,7 +263,7 @@ static PINT_sm_action symlink_init(
js_p->error_code = 0;
ret = job_req_sched_post_timer(
- sm_p->msgarray_params.retry_delay, smcb, 0, js_p, &tmp_id,
+ sm_p->msgarray_op.params.retry_delay, smcb, 0, js_p, &tmp_id,
pint_client_sm_context);
}
@@ -282,15 +282,15 @@ static int symlink_create_comp_fn(void *
int index)
{
PINT_smcb *smcb = v_p;
- PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
-
+ PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_MSGPAIR_PARENT_SM);
+
gossip_debug(GOSSIP_CLIENT_DEBUG, "symlink_create_comp_fn\n");
assert(resp_p->op == PVFS_SERV_CREATE);
if (resp_p->status != 0)
{
- return resp_p->status;
+ return resp_p->status;
}
/* otherwise, just store the newly symlink'd meta handle */
@@ -357,7 +357,8 @@ static PINT_sm_action symlink_dspace_cre
gossip_debug(GOSSIP_CLIENT_DEBUG," create: posting create req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
+ msg_p = &sm_p->msgarray_op.msgpair;
ret = PINT_cached_config_get_next_meta(
sm_p->object_ref.fs_id,
@@ -382,6 +383,7 @@ static PINT_sm_action symlink_dspace_cre
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = symlink_create_comp_fn;
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -405,7 +407,7 @@ static PINT_sm_action symlink_crdirent_s
gossip_debug(GOSSIP_CLIENT_DEBUG," symlink: posting crdirent req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
PINT_SERVREQ_CRDIRENT_FILL(
msg_p->req,
@@ -429,6 +431,8 @@ static PINT_sm_action symlink_crdirent_s
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -453,7 +457,7 @@ static PINT_sm_action symlink_setattr_se
gossip_debug(GOSSIP_CLIENT_DEBUG," symlink: posting setattr req\n");
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
/* force permissions to 777 for symbolic links */
sm_p->u.sym.sys_attr.perms = 0777;
@@ -488,6 +492,8 @@ static PINT_sm_action symlink_setattr_se
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -509,7 +515,7 @@ static PINT_sm_action symlink_delete_han
js_p->error_code = 0;
- PINT_init_msgpair(sm_p, msg_p);
+ PINT_msgpair_init(&sm_p->msgarray_op);
PINT_SERVREQ_REMOVE_FILL(
msg_p->req,
@@ -534,6 +540,8 @@ static PINT_sm_action symlink_delete_han
gossip_err("Failed to map meta server address\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -565,7 +573,7 @@ static PINT_sm_action symlink_cleanup(
(const PVFS_object_ref*) &(sm_p->object_ref));
}
else if ((PVFS_ERROR_CLASS(-sm_p->error_code) == PVFS_ERROR_BMI) &&
- (sm_p->u.sym.retry_count < sm_p->msgarray_params.retry_limit))
+ (sm_p->u.sym.retry_count < sm_p->msgarray_op.params.retry_limit))
{
sm_p->u.sym.stored_error_code = 0;
sm_p->u.sym.retry_count++;
@@ -581,11 +589,7 @@ static PINT_sm_action symlink_cleanup(
PINT_acache_invalidate(sm_p->object_ref);
}
- if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
PINT_SET_OP_COMPLETE;
return SM_ACTION_TERMINATE;
Index: sys-truncate.sm
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/sys-truncate.sm,v
diff -p -u -r1.56 -r1.56.8.1
--- sys-truncate.sm 30 Aug 2007 00:13:42 -0000 1.56
+++ sys-truncate.sm 16 May 2008 15:15:32 -0000 1.56.8.1
@@ -107,7 +107,7 @@ PVFS_error PVFS_isys_truncate(
}
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
- PINT_init_msgarray_params(&sm_p->msgarray_params, ref.fs_id);
+ PINT_init_msgarray_params(sm_p, ref.fs_id);
PINT_init_sysint_credentials(sm_p->cred_p, credentials);
sm_p->u.truncate.size = size;
sm_p->object_ref = ref;
@@ -183,13 +183,11 @@ static PINT_sm_action truncate_datafile_
return 1;
}
- sm_p->msgarray_count = attr->u.meta.dfile_count;
-
- sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- sm_p->msgarray_count * sizeof(PINT_sm_msgpair_state));
- if (!sm_p->msgarray)
+ ret = PINT_msgpairarray_init(&sm_p->msgarray_op, attr->u.meta.dfile_count);
+ if(ret != 0)
{
- js_p->error_code = -PVFS_ENOMEM;
+ gossip_err("Failed to initialize %d msgpairs\n", attr->u.meta.dfile_count);
+ js_p->error_code = ret;
return SM_ACTION_COMPLETE;
}
@@ -200,10 +198,8 @@ static PINT_sm_action truncate_datafile_
file_data.extend_flag = 1;
/* Construct truncate messages */
- for (i = 0; i < attr->u.meta.dfile_count; i++)
+ foreach_msgpair(&sm_p->msgarray_op, msg_p, i)
{
- msg_p = &sm_p->msgarray[i];
-
file_data.server_nr = i;
new_dfile_size =
attr->u.meta.dist->methods->logical_to_physical_offset(
@@ -233,14 +229,15 @@ static PINT_sm_action truncate_datafile_
}
sm_p->getattr.size = sm_p->u.truncate.size;
- ret = PINT_serv_msgpairarray_resolve_addrs(
- sm_p->msgarray_count, sm_p->msgarray);
+ ret = PINT_serv_msgpairarray_resolve_addrs(&sm_p->msgarray_op);
if (ret)
{
gossip_err("Error: failed to resolve server addresses.\n");
js_p->error_code = ret;
}
+
+ PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op);
return SM_ACTION_COMPLETE;
}
@@ -256,11 +253,7 @@ static PINT_sm_action truncate_cleanup(
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
sm_p->error_code = js_p->error_code;
- if (sm_p->msgarray && (sm_p->msgarray != &sm_p->msgpair))
- {
- free(sm_p->msgarray);
- sm_p->msgarray = NULL;
- }
+ PINT_msgpairarray_destroy(&sm_p->msgarray_op);
if(sm_p->error_code == 0)
{
More information about the Pvfs2-cvs
mailing list