X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fptlrpc%2Fnodemap_handler.c;h=5f82521d72886647db8c0ab2f4fa757b53fbe3e4;hp=28f34c91d71115e9bb3d294d8fbe9a89715663ef;hb=refs%2Fchanges%2F30%2F11830%2F48;hpb=aa84fbc8165f526dae4bd824a48c186c3ac2f639 diff --git a/lustre/ptlrpc/nodemap_handler.c b/lustre/ptlrpc/nodemap_handler.c index 28f34c9..5f82521 100644 --- a/lustre/ptlrpc/nodemap_handler.c +++ b/lustre/ptlrpc/nodemap_handler.c @@ -92,6 +92,8 @@ static void nodemap_destroy(struct lu_nodemap *nodemap) void nodemap_getref(struct lu_nodemap *nodemap) { atomic_inc(&nodemap->nm_refcount); + CDEBUG(D_INFO, "GETting nodemap %s(p=%p) : new refcount %d\n", + nodemap->nm_name, nodemap, atomic_read(&nodemap->nm_refcount)); } /** @@ -105,6 +107,10 @@ void nodemap_putref(struct lu_nodemap *nodemap) LASSERT(atomic_read(&nodemap->nm_refcount) > 0); + CDEBUG(D_INFO, "PUTting nodemap %s(p=%p) : new refcount %d\n", + nodemap->nm_name, nodemap, + atomic_read(&nodemap->nm_refcount) - 1); + if (atomic_dec_and_test(&nodemap->nm_refcount)) nodemap_destroy(nodemap); } @@ -1202,10 +1208,31 @@ static int nodemap_cleanup_iter_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd, return 0; } +struct nodemap_config *nodemap_config_alloc(void) +{ + struct nodemap_config *config; + int rc = 0; + + OBD_ALLOC_PTR(config); + if (config == NULL) + return ERR_PTR(-ENOMEM); + + rc = nodemap_init_hash(config); + if (rc != 0) { + OBD_FREE_PTR(config); + return ERR_PTR(rc); + } + + init_rwsem(&config->nmc_range_tree_lock); + + return config; +} +EXPORT_SYMBOL(nodemap_config_alloc); + /** * Walk the nodemap_hash and remove all nodemaps. */ -void nodemap_config_cleanup(struct nodemap_config *config) +void nodemap_config_dealloc(struct nodemap_config *config) { struct lu_nodemap *nodemap = NULL; struct lu_nodemap *nodemap_temp; @@ -1223,6 +1250,9 @@ void nodemap_config_cleanup(struct nodemap_config *config) list_for_each_entry_safe(nodemap, nodemap_temp, &nodemap_list_head, nm_list) { down_write(&config->nmc_range_tree_lock); + + /* move members to new config */ + nm_member_reclassify_nodemap(nodemap); list_for_each_entry_safe(range, range_temp, &nodemap->nm_ranges, rn_list) range_delete(&config->nmc_range_tree, range); @@ -1230,33 +1260,9 @@ void nodemap_config_cleanup(struct nodemap_config *config) nodemap_putref(nodemap); } -} - -struct nodemap_config *nodemap_config_alloc(void) -{ - struct nodemap_config *config; - int rc = 0; - - OBD_ALLOC_PTR(config); - if (config == NULL) - return ERR_PTR(-ENOMEM); - - rc = nodemap_init_hash(config); - if (rc != 0) { - OBD_FREE_PTR(config); - return ERR_PTR(rc); - } - - init_rwsem(&config->nmc_range_tree_lock); - - return config; -} - -void nodemap_config_dealloc(struct nodemap_config *config) -{ - nodemap_config_cleanup(config); OBD_FREE_PTR(config); } +EXPORT_SYMBOL(nodemap_config_dealloc); static int nm_hash_list_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, @@ -1319,6 +1325,7 @@ void nodemap_config_set_active(struct nodemap_config *config) EXIT; } +EXPORT_SYMBOL(nodemap_config_set_active); /** * Cleanup nodemap module on exit