[Pvfs2-cvs] commit by pw in pvfs2/src/client/sysint: sys-create.sm
CVS commit program
cvs at parl.clemson.edu
Tue Jul 24 13:30:30 EDT 2007
Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv8194/src/client/sysint
Modified Files:
sys-create.sm
Log Message:
Move various allocations after layout determines num data files.
Index: sys-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
diff -u -p -p -u -r1.107 -r1.108
--- sys-create.sm 6 Jul 2007 05:23:20 -0000 1.107
+++ sys-create.sm 24 Jul 2007 17:30:30 -0000 1.108
@@ -625,6 +625,32 @@ static PINT_sm_action create_datafiles_s
js_p->error_code = 0;
+ server_config = PINT_get_server_config_struct(
+ sm_p->object_ref.fs_id);
+
+ 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.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);
+
+ if (ret)
+ {
+ gossip_err("Failed to retrieve data server addresses\n");
+ 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 */
@@ -633,8 +659,7 @@ static PINT_sm_action create_datafiles_s
free(sm_p->msgarray);
}
sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
- (sm_p->u.create.num_data_files *
- sizeof(PINT_sm_msgpair_state)));
+ (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");
@@ -669,49 +694,6 @@ static PINT_sm_action create_datafiles_s
js_p->error_code = -PVFS_ENOMEM;
return SM_ACTION_COMPLETE;
}
-
- server_config = PINT_get_server_config_struct(
- sm_p->object_ref.fs_id);
-
- 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.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);
-
- if (ret)
- {
- gossip_err("Failed to retrieve data server addresses\n");
- 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++)
More information about the Pvfs2-cvs
mailing list