[Pvfs2-cvs] commit by slang in pvfs2/src/common/misc: fsck-utils.c
msgpairarray.sm pint-cached-config.c pint-cached-config.h
server-config-mgr.c
CVS commit program
cvs at parl.clemson.edu
Wed Feb 13 19:04:40 EST 2008
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb1:/tmp/cvs-serv10911/src/common/misc
Modified Files:
fsck-utils.c msgpairarray.sm pint-cached-config.c
pint-cached-config.h server-config-mgr.c
Log Message:
Cleanup to cached config. All the functions took a server_config struct, but none of them actually used it (using the cached config instead). There's a bunch of other cleanup that needs to be done between the server_config_mgr, the config_fetch/get state machines, and the rest of the config code, this is just a small start.
Index: fsck-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/fsck-utils.c,v
diff -p -u -r1.7 -r1.8
--- fsck-utils.c 10 Dec 2007 16:13:53 -0000 1.7
+++ fsck-utils.c 14 Feb 2008 00:04:39 -0000 1.8
@@ -135,7 +135,6 @@ int PVFS_fsck_check_server_configs(
char *fs_config_diff = NULL;
char *reference_config_server = NULL;
const char *server_name = NULL;
- struct server_configuration_s *server_config_struct = NULL;
FILE *pin = NULL;
char line[130] = { 0 };
char *cmd = NULL;
@@ -181,15 +180,10 @@ int PVFS_fsck_check_server_configs(
server_name = NULL;
/* get the pretty server name */
- server_config_struct = PINT_get_server_config_struct(*cur_fs);
server_name = PINT_cached_config_map_addr(
- server_config_struct,
- *cur_fs,
- addresses[i], &server_type);
+ *cur_fs, addresses[i], &server_type);
assert(server_name);
- PINT_put_server_config_struct(server_config_struct);
-
fs_config = calloc(FS_CONFIG_BUFFER_SIZE, sizeof(char));
if (fs_config == NULL)
{
@@ -1475,21 +1469,15 @@ static int PINT_handle_wrangler_display_
int server_type = 0;
PVFS_sysresp_getattr attributes;
PVFS_object_ref pref;
- struct server_configuration_s *config;
const char *server_name = NULL;
int header = 0;
for (i = 0; i < PINT_handle_wrangler_handlelist.num_servers; i++)
{
/* get the pretty server name */
- config = PINT_get_server_config_struct(*cur_fs);
- server_name = PINT_cached_config_map_addr(config,
- *cur_fs,
- PINT_handle_wrangler_handlelist.
- addr_array[i], &server_type);
-
- /* release mutex on server config */
- PINT_put_server_config_struct(config);
+ server_name = PINT_cached_config_map_addr(
+ *cur_fs, PINT_handle_wrangler_handlelist.
+ addr_array[i], &server_type);
for (j = 0; j < PINT_handle_wrangler_handlelist.size_array[i]; j++)
{
Index: msgpairarray.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/msgpairarray.sm,v
diff -p -u -r1.44 -r1.45
--- msgpairarray.sm 30 Aug 2007 00:13:43 -0000 1.44
+++ msgpairarray.sm 14 Feb 2008 00:04:39 -0000 1.45
@@ -482,7 +482,6 @@ static PINT_sm_action msgpairarray_compl
int need_retry = 0;
struct PINT_decoded_msg decoded_resp;
const char* server_string = NULL;
- struct server_configuration_s *server_config = NULL;
int server_type;
/* response structure (decoded) */
@@ -639,14 +638,9 @@ static PINT_sm_action msgpairarray_compl
} else {
char s[1024];
- server_config = PINT_server_config_mgr_get_config(msg_p->fs_id);
- if(server_config)
- {
- server_string = PINT_cached_config_map_addr(
- server_config, msg_p->fs_id, msg_p->svr_addr, &server_type);
- PINT_server_config_mgr_put_config(server_config);
- }
- else
+ server_string = PINT_cached_config_map_addr(
+ msg_p->fs_id, msg_p->svr_addr, &server_type);
+ if(!server_string)
{
server_string = "[UNKNOWN]";
}
@@ -709,7 +703,6 @@ int PINT_serv_decode_resp(PVFS_fs_id fs_
struct PVFS_server_resp **resp_out_pp)
{
int ret = -1, server_type = 0;
- struct server_configuration_s *server_config;
const char *server_string;
ret = PINT_decode(encoded_resp_p, PINT_DECODE_RESP,
@@ -728,10 +721,8 @@ int PINT_serv_decode_resp(PVFS_fs_id fs_
if (fs_id != PVFS_FS_ID_NULL)
{
- server_config = PINT_server_config_mgr_get_config(fs_id);
server_string = PINT_cached_config_map_addr(
- server_config, fs_id, *svr_addr_p, &server_type);
- PINT_server_config_mgr_put_config(server_config);
+ fs_id, *svr_addr_p, &server_type);
gossip_err(" Server: %s.\n", server_string);
}
else
Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.22 -r1.23
--- pint-cached-config.c 5 Dec 2007 21:09:47 -0000 1.22
+++ pint-cached-config.c 14 Feb 2008 00:04:39 -0000 1.23
@@ -71,8 +71,7 @@ do { cur = hrange_list;
break; \
} \
cur_host_extent_table->bmi_address = \
- PINT_config_get_host_addr_ptr( \
- config,cur_mapping->alias_mapping->host_alias); \
+ cur_mapping->alias_mapping->bmi_address; \
assert(cur_host_extent_table->bmi_address); \
cur_host_extent_table->extent_list = \
PINT_create_extent_list(cur_mapping->handle_range); \
@@ -102,8 +101,7 @@ static int hash_fsid_compare(
void *key, struct qlist_head *link);
static void free_host_extent_table(void *ptr);
-static int cache_server_array(
- struct server_configuration_s *config, PVFS_fs_id fsid);
+static int cache_server_array(PVFS_fs_id fsid);
static int meta_randomized = 0;
static int io_randomized = 0;
@@ -221,7 +219,7 @@ int PINT_cached_config_reinitialize(
break;
}
- ret = PINT_handle_load_mapping(config, cur_fs);
+ ret = PINT_cached_config_handle_load_mapping(cur_fs);
if (ret)
{
break;
@@ -232,7 +230,7 @@ int PINT_cached_config_reinitialize(
return 0;
}
-/* PINT_handle_load_mapping()
+/* PINT_cached_config_handle_load_mapping()
*
* loads a new mapping of servers to handle into this interface. This
* function may be called multiple times in order to add new file
@@ -240,8 +238,7 @@ int PINT_cached_config_reinitialize(
*
* returns 0 on success, -errno on failure
*/
-int PINT_handle_load_mapping(
- struct server_configuration_s *config,
+int PINT_cached_config_handle_load_mapping(
struct filesystem_configuration_s *fs)
{
int ret = -PVFS_EINVAL;
@@ -250,7 +247,7 @@ int PINT_handle_load_mapping(
struct config_fs_cache_s *cur_config_fs_cache = NULL;
struct bmi_host_extent_table_s *cur_host_extent_table = NULL;
- if (config && fs)
+ if (fs)
{
cur_config_fs_cache = (struct config_fs_cache_s *)
malloc(sizeof(struct config_fs_cache_s));
@@ -315,7 +312,6 @@ int PINT_handle_load_mapping(
* returns 0 on success, -errno on failure
*/
int PINT_cached_config_get_next_meta(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
PVFS_BMI_addr_t *meta_addr,
PVFS_handle_extent_array *ext_array)
@@ -326,7 +322,7 @@ int PINT_cached_config_get_next_meta(
struct qlist_head *hash_link = NULL;
struct config_fs_cache_s *cur_config_cache = NULL;
- if (config && ext_array)
+ if (ext_array)
{
hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
if (hash_link)
@@ -367,8 +363,7 @@ int PINT_cached_config_get_next_meta(
cur_config_cache->meta_server_cursor = PINT_llist_next(
cur_config_cache->meta_server_cursor);
}
- meta_server_bmi_str = PINT_config_get_host_addr_ptr(
- config,cur_mapping->alias_mapping->host_alias);
+ meta_server_bmi_str = cur_mapping->alias_mapping->bmi_address;
ext_array->extent_count =
cur_mapping->handle_extent_array.extent_count;
@@ -389,7 +384,6 @@ int PINT_cached_config_get_next_meta(
}
static int PINT_cached_config_get_extents(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
PVFS_BMI_addr_t *addr,
PVFS_handle_extent_array *handle_extents)
@@ -424,8 +418,7 @@ static int PINT_cached_config_get_extent
server_list = PINT_llist_next(server_list);
ret = BMI_addr_lookup(
- &tmp_addr, PINT_config_get_host_addr_ptr(
- config, cur_mapping->alias_mapping->host_alias));
+ &tmp_addr, cur_mapping->alias_mapping->bmi_address);
if(ret < 0)
{
return ret;
@@ -445,7 +438,6 @@ static int PINT_cached_config_get_extent
}
int PINT_cached_config_map_servers(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int *inout_num_datafiles,
PVFS_sys_layout *layout,
@@ -460,9 +452,7 @@ int PINT_cached_config_map_servers(
int start_index = -1;
int index;
- assert(config);
assert(inout_num_datafiles);
- assert(handle_extent_array);
hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
if(!hash_link)
@@ -494,15 +484,18 @@ int PINT_cached_config_map_servers(
*inout_num_datafiles = layout->server_list.count;
for(i = 0; i < layout->server_list.count; ++i)
{
- ret = PINT_cached_config_get_extents(
- config, fsid,
- &layout->server_list.servers[i],
- &handle_extent_array[i]);
- if(ret < 0)
+ if(handle_extent_array)
{
- gossip_err("The address specified in the datafile "
- "layout is invalid\n");
- return ret;
+ ret = PINT_cached_config_get_extents(
+ fsid,
+ &layout->server_list.servers[i],
+ &handle_extent_array[i]);
+ if(ret < 0)
+ {
+ gossip_err("The address specified in the datafile "
+ "layout is invalid\n");
+ return ret;
+ }
}
addr_array[i] = layout->server_list.servers[i];
@@ -533,17 +526,20 @@ int PINT_cached_config_map_servers(
index = (i + start_index) % *inout_num_datafiles;
ret = BMI_addr_lookup(
- &addr_array[index], PINT_config_get_host_addr_ptr(
- config, cur_mapping->alias_mapping->host_alias));
+ &addr_array[index],
+ cur_mapping->alias_mapping->bmi_address);
if (ret)
{
return ret;
}
- handle_extent_array[index].extent_count =
- cur_mapping->handle_extent_array.extent_count;
- handle_extent_array[index].extent_array =
- cur_mapping->handle_extent_array.extent_array;
+ if(handle_extent_array)
+ {
+ handle_extent_array[index].extent_count =
+ cur_mapping->handle_extent_array.extent_count;
+ handle_extent_array[index].extent_array =
+ cur_mapping->handle_extent_array.extent_array;
+ }
}
break;
@@ -572,18 +568,19 @@ int PINT_cached_config_map_servers(
/* found an unused index */
ret = BMI_addr_lookup(
&addr_array[index],
- PINT_config_get_host_addr_ptr(
- config,
- cur_mapping->alias_mapping->host_alias));
+ cur_mapping->alias_mapping->bmi_address);
if (ret)
{
return ret;
}
- handle_extent_array[index].extent_count =
- cur_mapping->handle_extent_array.extent_count;
- handle_extent_array[index].extent_array =
- cur_mapping->handle_extent_array.extent_array;
+ if(handle_extent_array)
+ {
+ handle_extent_array[index].extent_count =
+ cur_mapping->handle_extent_array.extent_count;
+ handle_extent_array[index].extent_array =
+ cur_mapping->handle_extent_array.extent_array;
+ }
}
}
}
@@ -595,7 +592,6 @@ int PINT_cached_config_map_servers(
return 0;
}
-
/* PINT_cached_config_get_next_io()
*
* returns the address of a set of servers that should be used to
@@ -607,7 +603,6 @@ int PINT_cached_config_map_servers(
* returns 0 on success, -errno on failure
*/
int PINT_cached_config_get_next_io(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int num_servers,
PVFS_BMI_addr_t *io_addr_array,
@@ -621,7 +616,7 @@ int PINT_cached_config_get_next_io(
int jitter = 0, num_io_servers = 0;
PINT_llist* old_data_server_cursor = NULL;
- if (config && num_servers && io_handle_extent_array)
+ if (num_servers && io_handle_extent_array)
{
hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
if (hash_link)
@@ -678,8 +673,7 @@ int PINT_cached_config_get_next_io(
cur_config_cache->data_server_cursor = PINT_llist_next(
cur_config_cache->data_server_cursor);
- data_server_bmi_str = PINT_config_get_host_addr_ptr(
- config,cur_mapping->alias_mapping->host_alias);
+ data_server_bmi_str = cur_mapping->alias_mapping->bmi_address;
if (io_addr_array != NULL)
{
@@ -719,7 +713,6 @@ int PINT_cached_config_get_next_io(
* returns pointer to string on success, NULL on failure
*/
const char *PINT_cached_config_map_addr(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
PVFS_BMI_addr_t addr,
int *server_type)
@@ -728,11 +721,6 @@ const char *PINT_cached_config_map_addr(
struct qlist_head *hash_link = NULL;
struct config_fs_cache_s *cur_config_cache = NULL;
- if (!config)
- {
- return NULL;
- }
-
hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
if (!hash_link)
{
@@ -743,7 +731,7 @@ const char *PINT_cached_config_map_addr(
assert(cur_config_cache);
assert(cur_config_cache->fs);
- ret = cache_server_array(config, fsid);
+ ret = cache_server_array(fsid);
if (ret < 0)
{
return NULL;
@@ -771,7 +759,6 @@ const char *PINT_cached_config_map_addr(
* returns 0 on success, -errno on failure
*/
int PINT_cached_config_count_servers(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int server_type,
int *count)
@@ -780,7 +767,7 @@ int PINT_cached_config_count_servers(
struct qlist_head *hash_link = NULL;
struct config_fs_cache_s *cur_config_cache = NULL;
- if (!config || !server_type)
+ if (!server_type)
{
return ret;
}
@@ -796,7 +783,7 @@ int PINT_cached_config_count_servers(
assert(cur_config_cache);
assert(cur_config_cache->fs);
- ret = cache_server_array(config, fsid);
+ ret = cache_server_array(fsid);
if (ret == 0)
{
if (server_type == PINT_SERVER_TYPE_META)
@@ -828,7 +815,6 @@ int PINT_cached_config_count_servers(
* returns 0 on success, -errno on failure
*/
int PINT_cached_config_get_server_array(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int server_type,
PVFS_BMI_addr_t *addr_array,
@@ -838,7 +824,7 @@ int PINT_cached_config_get_server_array(
struct qlist_head *hash_link = NULL;
struct config_fs_cache_s *cur_config_cache = NULL;
- if (!config || !inout_count_p || !*inout_count_p ||
+ if (!inout_count_p || !*inout_count_p ||
!addr_array || !server_type)
{
return ret;
@@ -855,7 +841,7 @@ int PINT_cached_config_get_server_array(
assert(cur_config_cache);
assert(cur_config_cache->fs);
- ret = cache_server_array(config, fsid);
+ ret = cache_server_array(fsid);
if (ret < 0)
{
return ret;
@@ -1243,7 +1229,6 @@ int PINT_cached_config_get_handle_timeou
* returns 0 on success, -errno on failure
*/
static int cache_server_array(
- struct server_configuration_s *config,
PVFS_fs_id fsid)
{
int ret = -PVFS_EINVAL, i = 0, j = 0;
@@ -1257,11 +1242,6 @@ static int cache_server_array(
int current = 0;
int array_index = 0, array_index2 = 0;
- if (!config)
- {
- return ret;
- }
-
hash_link = qhash_search(PINT_fsid_config_cache_table,&(fsid));
if (!hash_link)
{
@@ -1342,8 +1322,7 @@ static int cache_server_array(
while ((cur_mapping = PINT_llist_head(tmp_server)))
{
tmp_server = PINT_llist_next(tmp_server);
- server_bmi_str = PINT_config_get_host_addr_ptr(
- config,cur_mapping->alias_mapping->host_alias);
+ server_bmi_str = cur_mapping->alias_mapping->bmi_address;
ret = BMI_addr_lookup(&tmp_bmi_addr,server_bmi_str);
if (ret < 0)
Index: pint-cached-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pint-cached-config.h,v
diff -p -u -r1.11 -r1.12
--- pint-cached-config.h 5 Dec 2007 21:09:48 -0000 1.11
+++ pint-cached-config.h 14 Feb 2008 00:04:39 -0000 1.12
@@ -28,43 +28,36 @@ int PINT_cached_config_initialize(void);
int PINT_cached_config_finalize(void);
-int PINT_handle_load_mapping(
- struct server_configuration_s *config,
+int PINT_cached_config_handle_load_mapping(
struct filesystem_configuration_s *fs);
int PINT_cached_config_map_alias(
- struct server_configuration_s *config,
const char *alias,
PVFS_BMI_addr_t *addr);
int PINT_cached_config_get_next_meta(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
PVFS_BMI_addr_t *meta_addr,
PVFS_handle_extent_array *meta_extent_array);
int PINT_cached_config_get_next_io(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int num_servers,
PVFS_BMI_addr_t *io_addr_array,
PVFS_handle_extent_array *io_handle_extent_array);
const char *PINT_cached_config_map_addr(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
PVFS_BMI_addr_t addr,
int *server_type);
int PINT_cached_config_get_server_array(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int server_type,
PVFS_BMI_addr_t *addr_array,
int *inout_count_p);
int PINT_cached_config_count_servers(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int server_type,
int *count);
@@ -75,7 +68,6 @@ int PINT_cached_config_map_to_server(
PVFS_fs_id fs_id);
int PINT_cached_config_map_servers(
- struct server_configuration_s *config,
PVFS_fs_id fsid,
int *inout_num_datafiles,
PVFS_sys_layout *layout,
Index: server-config-mgr.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/server-config-mgr.c,v
diff -p -u -r1.18 -r1.19
--- server-config-mgr.c 10 Jan 2008 15:52:00 -0000 1.18
+++ server-config-mgr.c 14 Feb 2008 00:04:39 -0000 1.19
@@ -191,11 +191,11 @@ int PINT_server_config_mgr_reload_cached
"Reloading handle mappings for fs_id %d\n",
cur_fs->coll_id);
- ret = PINT_handle_load_mapping(
- config->server_config, cur_fs);
+ ret = PINT_cached_config_handle_load_mapping(cur_fs);
if (ret)
{
- PVFS_perror("PINT_handle_load_mapping failed", ret);
+ PVFS_perror(
+ "PINT_cached_config_handle_load_mapping failed", ret);
gen_mutex_unlock(&s_server_config_mgr_mutex);
return ret;
}
More information about the Pvfs2-cvs
mailing list