[Pvfs2-cvs] commit by slang in pvfs2/src/client/sysint:
client-state-machine.h sys-create.sm
CVS commit program
cvs at parl.clemson.edu
Fri Jul 6 01:23:20 EDT 2007
Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv22962/src/client/sysint
Modified Files:
client-state-machine.h sys-create.sm
Log Message:
new layout parameter for PVFS_[i]sys_create
Index: client-state-machine.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/client-state-machine.h,v
diff -p -u -r1.168 -r1.169
--- client-state-machine.h 13 Apr 2007 05:14:16 -0000 1.168
+++ client-state-machine.h 6 Jul 2007 05:23:20 -0000 1.169
@@ -85,6 +85,7 @@ struct PINT_client_create_sm
int stored_error_code;
PINT_dist *dist;
+ PVFS_sys_layout layout;
PVFS_handle metafile_handle;
PVFS_handle *datafile_handles;
PVFS_BMI_addr_t *data_server_addrs;
Index: sys-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
diff -p -u -r1.106 -r1.107
--- sys-create.sm 15 Jun 2007 17:39:39 -0000 1.106
+++ sys-create.sm 6 Jul 2007 05:23:20 -0000 1.107
@@ -202,14 +202,15 @@ PVFS_error PVFS_isys_create(
PVFS_sys_attr attr,
const PVFS_credentials *credentials,
PVFS_sys_dist *dist,
+ PVFS_sys_layout *layout,
PVFS_sysresp_create *resp,
PVFS_sys_op_id *op_id,
void *user_ptr)
{
- int num_dfiles_req = 0;
PVFS_error ret = -PVFS_EINVAL;
PINT_smcb *smcb = NULL;
PINT_client_sm *sm_p = NULL;
+ int num_dfiles_req;
gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_isys_create entered\n");
@@ -263,6 +264,29 @@ PVFS_error PVFS_isys_create(
sm_p->u.create.stored_error_code = 0;
sm_p->u.create.retry_count = 0;
+ /* copy layout to sm struct */
+ if(layout)
+ {
+ sm_p->u.create.layout.algorithm = layout->algorithm;
+ if(layout->algorithm == PVFS_SYS_LAYOUT_LIST)
+ {
+ sm_p->u.create.layout.server_list.count = layout->server_list.count;
+ sm_p->u.create.layout.server_list.servers =
+ malloc(layout->server_list.count * sizeof(PVFS_BMI_addr_t));
+ if(!sm_p->u.create.layout.server_list.servers)
+ {
+ return -PVFS_ENOMEM;
+ }
+ memcpy(sm_p->u.create.layout.server_list.servers,
+ layout->server_list.servers,
+ layout->server_list.count * sizeof(PVFS_BMI_addr_t));
+ }
+ }
+ else
+ {
+ sm_p->u.create.layout.algorithm = PVFS_SYS_LAYOUT_ROUND_ROBIN;
+ }
+
sm_p->object_ref = parent_ref;
/* If the user specifies a distribution use that
@@ -293,7 +317,7 @@ PVFS_error PVFS_isys_create(
return -PVFS_ENOMEM;
}
}
-
+
/* If an application hint has been provided, use that to request dfile
else, if a tabfile hint has been provided, use that instead*/
num_dfiles_req = 0;
@@ -345,6 +369,7 @@ PVFS_error PVFS_sys_create(
PVFS_sys_attr attr,
const PVFS_credentials *credentials,
PVFS_sys_dist *dist,
+ PVFS_sys_layout *layout,
PVFS_sysresp_create *resp)
{
PVFS_error ret = -PVFS_EINVAL, error = 0;
@@ -353,7 +378,7 @@ PVFS_error PVFS_sys_create(
gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_sys_create entered\n");
ret = PVFS_isys_create(object_name, parent_ref, attr, credentials,
- dist, resp, &op_id, NULL);
+ dist, layout, resp, &op_id, NULL);
if (ret)
{
PVFS_perror_gossip("PVFS_isys_create call", ret);
@@ -648,12 +673,19 @@ static PINT_sm_action create_datafiles_s
server_config = PINT_get_server_config_struct(
sm_p->object_ref.fs_id);
- ret = PINT_cached_config_get_next_io(
+ ret = PINT_cached_config_map_servers(
server_config,
sm_p->object_ref.fs_id,
- sm_p->u.create.num_data_files,
+ &sm_p->u.create.num_data_files,
+ &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;
+ }
PINT_put_server_config_struct(server_config);
@@ -663,7 +695,24 @@ static PINT_sm_action create_datafiles_s
js_p->error_code = ret;
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)))
+ {
+ free(sm_p->msgarray);
+ }
+ 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)
+ {
+ gossip_err("create: failed to allocate msgarray\n");
+ js_p->error_code = -PVFS_ENOMEM;
+ return 1;
+ }
+ 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++)
{
@@ -689,11 +738,6 @@ static PINT_sm_action create_datafiles_s
msg_p->retry_flag = PVFS_MSGPAIR_NO_RETRY;
msg_p->comp_fn = create_datafiles_comp_fn;
msg_p->svr_addr = sm_p->u.create.data_server_addrs[i];
-
- gossip_debug(GOSSIP_VARSTRIP_DEBUG,
- "Data file number: %d - Server name: %s\n",
- i, PVFS_mgmt_map_addr(msg_p->fs_id, sm_p->cred_p,
- msg_p->svr_addr, NULL));
}
return SM_ACTION_COMPLETE;
}
@@ -1021,6 +1065,11 @@ static PINT_sm_action create_cleanup(
{
PINT_dist_free(sm_p->u.create.dist);
sm_p->u.create.dist = NULL;
+ }
+
+ if(sm_p->u.create.layout.algorithm == PVFS_SYS_LAYOUT_LIST)
+ {
+ free(sm_p->u.create.layout.server_list.servers);
}
if (sm_p->msgarray != &(sm_p->msgpair))
More information about the Pvfs2-cvs
mailing list