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));
}
/**
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);
}
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;
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);
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,
EXIT;
}
+EXPORT_SYMBOL(nodemap_config_set_active);
/**
* Cleanup nodemap module on exit