[Pvfs2-cvs] commit by kunkel in pvfs2/src/client/sysint: sys-create.sm

CVS commit program cvs at parl.clemson.edu
Tue Aug 29 05:37:17 EDT 2006


Update of /projects/cvsroot/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv30210/src/client/sysint

Modified Files:
      Tag: kunkel-branch
	sys-create.sm 
Log Message:
Added function for hints which allows to specify hints in environemt 
variable.


Index: sys-create.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
diff -p -u -r1.92.4.3 -r1.92.4.4
--- sys-create.sm	19 Aug 2006 18:40:04 -0000	1.92.4.3
+++ sys-create.sm	29 Aug 2006 09:37:17 -0000	1.92.4.4
@@ -238,7 +238,8 @@ PVFS_error PVFS_isys_create(
     int num_dfiles_req = 0;
     PVFS_error ret = -PVFS_EINVAL;
     PINT_client_sm *sm_p = NULL;
-
+    char * hintvalue;
+    
     gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_isys_create entered\n");
 
     if ((parent_ref.handle == PVFS_HANDLE_NULL) ||
@@ -322,10 +323,22 @@ PVFS_error PVFS_isys_create(
     /* 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;
+    /* hints allow to override this behavior, e.g. for MPI */
+    hintvalue = PVFS_get_hint(sm_p->hints, CREATE_SET_DATAFILE_NODES);
+    
     if (attr.mask & PVFS_ATTR_SYS_DFILE_COUNT)
     {
         num_dfiles_req = attr.dfile_count;
     }
+    else if (hintvalue)
+    { 
+        while( (hintvalue = rindex(hintvalue, ',')))
+        {    
+            hintvalue++;
+            num_dfiles_req++;
+        }
+        num_dfiles_req++;
+    }
     else
     {
         /* Check the mount options */
@@ -654,6 +667,8 @@ static int create_datafiles_setup_msgpai
 
     js_p->error_code = 0;
 
+    hintvalue = PVFS_get_hint(sm_p->hints, CREATE_SET_DATAFILE_NODES);
+    
     memset(&sm_p->msgpair, 0, sizeof(PINT_sm_msgpair_state));
 
     /* allocate msgarray and set msgarray_count */
@@ -706,12 +721,17 @@ static int create_datafiles_setup_msgpai
 	 * If the user parses a hint to explicity set the hostnames for the 
 	 * datafiles use these values!
 	 */
-    hintvalue = PVFS_get_hint(sm_p->hints, CREATE_SET_DATAFILE_NODES);
     if ( hintvalue ){
         int tokens = 0;
+        char * hintcpy;
         char * act_hostname;    
-        char * save_ptr;    
-        act_hostname = strtok_r(hintvalue, ",", & save_ptr);         
+        char * save_ptr;
+        char * hintbuff;
+        hintbuff = (char *) malloc((strlen(hintvalue)+1)*sizeof(char));
+        hintcpy = hintbuff;
+        strcpy(hintcpy, hintvalue);    
+        
+        act_hostname = strtok_r(hintcpy, ",", & save_ptr);         
         while ( act_hostname ){
             if ( tokens >= sm_p->u.create.num_data_files){
                 gossip_err("Datafiles given by hint are not valid, "
@@ -721,7 +741,7 @@ static int create_datafiles_setup_msgpai
                 return 1;                
             }
             ret = PINT_cached_config_get_one_server_str(
-                hintvalue,
+                act_hostname,
                 server_config,
                 sm_p->object_ref.fs_id,
                 & sm_p->u.create.data_server_addrs[tokens],
@@ -737,6 +757,7 @@ static int create_datafiles_setup_msgpai
             act_hostname = strtok_r(NULL, ",", & save_ptr);
             tokens++;
         }  
+        free(hintbuff);
     }else{	
         ret = PINT_cached_config_get_next_io(
             server_config,



More information about the Pvfs2-cvs mailing list