[Pvfs2-cvs] commit by kunkel in pvfs2/src/common/misc: pint-cached-config.c pint-cached-config.h

CVS commit program cvs at parl.clemson.edu
Tue Aug 22 06:54:19 EDT 2006


Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv29962/src/common/misc

Modified Files:
      Tag: kunkel-branch
	pint-cached-config.c pint-cached-config.h 
Log Message:
Added tool which prints file mapping to server aliases. Added 
experimental stubs for migration tools. Added kernel tgid to request ID.
Bugfix of PINT_cached_config_get_one_server_str.


Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.17.4.3 -r1.17.4.4
--- pint-cached-config.c	19 Aug 2006 18:40:04 -0000	1.17.4.3
+++ pint-cached-config.c	22 Aug 2006 10:54:18 -0000	1.17.4.4
@@ -437,7 +437,7 @@ int PINT_cached_config_get_next_io(
  *  * returns 0 on success, -errno on failure
  */
 int PINT_cached_config_get_one_server_str(
-    char * alias,
+    const char * alias,
     struct server_configuration_s *config,
     PVFS_fs_id fsid,
     PVFS_BMI_addr_t *io_addr,
@@ -459,20 +459,25 @@ int PINT_cached_config_get_one_server_st
     cur_config_cache = qlist_entry(
             hash_link, struct config_fs_cache_s, hash_link);
     
+ 
     if(is_dataserver)
     {
-        cur_mapping = PINT_llist_head(
-                cur_config_cache->data_server_cursor);  
         num_io_servers = PINT_llist_count(
             cur_config_cache->fs->data_handle_ranges);
+        cur_config_cache->data_server_cursor =
+                cur_config_cache->fs->data_handle_ranges;
+        cur_mapping = PINT_llist_head(
+                cur_config_cache->data_server_cursor);       
     }else
     {
-        cur_mapping = PINT_llist_head(
-                cur_config_cache->meta_server_cursor);  
         num_io_servers = PINT_llist_count(
             cur_config_cache->fs->meta_handle_ranges);
+        cur_config_cache->meta_server_cursor =
+            cur_config_cache->fs->meta_handle_ranges;
+        cur_mapping = PINT_llist_head(
+            cur_config_cache->meta_server_cursor);       
     }
-        
+    assert(cur_mapping);   
     
     for(i=0; i < num_io_servers; i++)
     {
@@ -493,11 +498,15 @@ int PINT_cached_config_get_one_server_st
         if(is_dataserver)
         {
             cur_config_cache->data_server_cursor = PINT_llist_next(
+                    cur_config_cache->data_server_cursor); 
+            cur_mapping = PINT_llist_head(
                     cur_config_cache->data_server_cursor);
         }else
         {
-            cur_config_cache->data_server_cursor = PINT_llist_next(
-                    cur_config_cache->meta_server_cursor);
+            cur_config_cache->meta_server_cursor = PINT_llist_next(
+                    cur_config_cache->meta_server_cursor);            
+            cur_mapping = PINT_llist_head(
+                    cur_config_cache->meta_server_cursor);  
         }
     }
     if ( i == num_io_servers ){
@@ -506,6 +515,85 @@ int PINT_cached_config_get_one_server_st
     
     return 0; 
 }            
+
+/*
+ * return the extend and alias of the io server given by bmi_address.
+ * 
+ *  * returns 0 on success, -errno on failure
+ */
+int PINT_cached_config_get_one_server_alias(
+    const char * bmi_address,
+    struct server_configuration_s *config,
+    PVFS_fs_id fsid,
+    PVFS_handle_extent_array *io_handle_extent,
+    char ** const out_alias, 
+    int is_dataserver)
+{
+    int i;
+    
+    struct qlist_head *hash_link = NULL;
+    int num_io_servers;
+    struct config_fs_cache_s *cur_config_cache = NULL;
+    struct host_handle_mapping_s *cur_mapping = NULL;
+    
+    hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
+    if (!hash_link)
+    {
+            return -PVFS_EINVAL;            
+    }
+    cur_config_cache = qlist_entry(
+            hash_link, struct config_fs_cache_s, hash_link);
+    
+    if(is_dataserver)
+    {
+        num_io_servers = PINT_llist_count(
+            cur_config_cache->fs->data_handle_ranges);
+        cur_config_cache->data_server_cursor =
+                cur_config_cache->fs->data_handle_ranges;
+        cur_mapping = PINT_llist_head(
+                cur_config_cache->data_server_cursor);       
+    }else
+    {
+        num_io_servers = PINT_llist_count(
+            cur_config_cache->fs->meta_handle_ranges);
+        cur_config_cache->meta_server_cursor =
+            cur_config_cache->fs->meta_handle_ranges;
+        cur_mapping = PINT_llist_head(
+            cur_config_cache->meta_server_cursor);       
+    }
+    assert(cur_mapping);   
+    
+    for(i=0; i < num_io_servers; i++)
+    {
+        if( strcmp(cur_mapping->alias_mapping->bmi_address, bmi_address) == 0 )
+        {
+            io_handle_extent->extent_count = cur_mapping->handle_extent_array.extent_count;
+            io_handle_extent->extent_array = cur_mapping->handle_extent_array.extent_array;
+            *out_alias = cur_mapping->alias_mapping->host_alias ;
+
+            break;
+        }
+        if(is_dataserver)
+        {
+            cur_config_cache->data_server_cursor = PINT_llist_next(
+                    cur_config_cache->data_server_cursor); 
+            cur_mapping = PINT_llist_head(
+                    cur_config_cache->data_server_cursor);
+        }else
+        {
+            cur_config_cache->meta_server_cursor = PINT_llist_next(
+                    cur_config_cache->meta_server_cursor);            
+            cur_mapping = PINT_llist_head(
+                    cur_config_cache->meta_server_cursor);  
+        }
+    }
+    if ( i == num_io_servers ){
+           return -PVFS_EINVAL;
+    }
+    
+    return 0; 
+}           
+           
             
 
 /* PINT_cached_config_map_addr()

Index: pint-cached-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.h,v
diff -p -u -r1.7.22.1 -r1.7.22.2
--- pint-cached-config.h	19 Aug 2006 18:40:04 -0000	1.7.22.1
+++ pint-cached-config.h	22 Aug 2006 10:54:18 -0000	1.7.22.2
@@ -47,13 +47,21 @@ int PINT_cached_config_get_next_io(
     PVFS_handle_extent_array *io_handle_extent_array);
 
 int PINT_cached_config_get_one_server_str(
-    char * alias,
+    const char * alias,
     struct server_configuration_s *config,
     PVFS_fs_id fsid,
     PVFS_BMI_addr_t *io_addr,
     PVFS_handle_extent_array *io_handle_extent,
     int is_dataserver); 
-
+    
+int PINT_cached_config_get_one_server_alias(
+    const char * bmi_address,
+    struct server_configuration_s *config,
+    PVFS_fs_id fsid,
+    PVFS_handle_extent_array *io_handle_extent,
+    char ** const out_alias, 
+    int is_dataserver);
+    
 const char *PINT_cached_config_map_addr(
     struct server_configuration_s *config,
     PVFS_fs_id fsid,



More information about the Pvfs2-cvs mailing list