*/
/*
* Copyright (C) 2013, Trustees of Indiana University
+ *
+ * Copyright (c) 2014, Intel Corporation.
+ *
* Author: Joshua Walgenbach <jjw@iu.edu>
*/
struct lu_nodemap *nodemap = m->private;
struct lu_nid_range *range;
struct interval_node_extent ext;
+ char start_nidstr[LNET_NIDSTR_SIZE];
+ char end_nidstr[LNET_NIDSTR_SIZE];
bool cont = false;
seq_printf(m, "[\n");
seq_printf(m, ",\n");
cont = 1;
ext = range->rn_node.in_extent;
- seq_printf(m, " { id: %u, start_nid: %s, "
- "end_nid: %s }",
- range->rn_id, libcfs_nid2str(ext.start),
- libcfs_nid2str(ext.end));
+ libcfs_nid2str_r(ext.start, start_nidstr, sizeof(start_nidstr));
+ libcfs_nid2str_r(ext.end, end_nidstr, sizeof(end_nidstr));
+ seq_printf(m, " { id: %u, start_nid: %s, end_nid: %s }",
+ range->rn_id, start_nidstr, end_nidstr);
}
read_unlock(&nm_range_tree_lock);
seq_printf(m, "\n");
}
/**
- * Hash callback, reads and prints the exports attached to this nodemap.
+ * Reads and prints the exports attached to the given nodemap.
*
- * \param hs nodemap member hash
- * \param bd unused
- * \param hnode current member in hash
- * \param data seq_file to print to
- * \retval 0 success
- */
-static int nodemap_exports_show_cb(cfs_hash_t *hs, cfs_hash_bd_t *bd,
- struct hlist_node *hnode, void *data)
-{
- struct seq_file *m = data;
- struct obd_export *exp;
- char *key;
-
- exp = hlist_entry(hnode, struct obd_export,
- exp_target_data.ted_nodemap_member);
- key = cfs_hash_key(hs, hnode);
- seq_printf(m, " { nid: %s, uuid: %s },",
- obd_export_nid2str(exp), exp->exp_client_uuid.uuid);
-
- return 0;
-}
-
-/**
- * Reads and prints the exports attached to the given nodemap via hash
- * foreach callback.
- *
- * \param m seq file in proc fs
+ * \param m seq file in proc fs, stores nodemap
* \param data unused
* \retval 0 success
*/
static int nodemap_exports_show(struct seq_file *m, void *data)
{
- struct lu_nodemap *nodemap = m->private;
+ struct lu_nodemap *nodemap = m->private;
+ struct obd_export *exp;
+ char nidstr[LNET_NIDSTR_SIZE] = "<unknown>";
seq_printf(m, "[\n");
- cfs_hash_for_each(nodemap->nm_member_hash, nodemap_exports_show_cb, m);
+ mutex_lock(&nodemap->nm_member_list_lock);
+ list_for_each_entry(exp, &nodemap->nm_member_list,
+ exp_target_data.ted_nodemap_member) {
+ if (exp->exp_connection != NULL)
+ libcfs_nid2str_r(exp->exp_connection->c_peer.nid,
+ nidstr, sizeof(nidstr));
+
+ seq_printf(m, " { nid: %s, uuid: %s },",
+ nidstr, exp->exp_client_uuid.uuid);
+ }
+ mutex_unlock(&nodemap->nm_member_list_lock);
seq_printf(m, "\n");
seq_printf(m, "]\n");
proc_lustre_root,
lprocfs_nm_module_vars,
NULL);
-
if (IS_ERR(proc_lustre_nodemap_root)) {
rc = PTR_ERR(proc_lustre_nodemap_root);
CERROR("cannot create 'nodemap' directory: rc = %d\n",
rc);
proc_lustre_nodemap_root = NULL;
}
-
return rc;
}
struct lu_nodemap *nodemap)
{
struct proc_dir_entry *nodemap_proc_entry;
- struct lprocfs_vars *vars;
int rc = 0;
if (is_default)
- vars = lprocfs_default_nodemap_vars;
+ nodemap_proc_entry =
+ lprocfs_register(name, proc_lustre_nodemap_root,
+ lprocfs_default_nodemap_vars,
+ nodemap);
else
- vars = lprocfs_nodemap_vars;
+ nodemap_proc_entry =
+ lprocfs_register(name, proc_lustre_nodemap_root,
+ lprocfs_nodemap_vars,
+ nodemap);
- nodemap_proc_entry = lprocfs_register(name, proc_lustre_nodemap_root,
- vars, nodemap);
if (IS_ERR(nodemap_proc_entry)) {
rc = PTR_ERR(nodemap_proc_entry);
CERROR("cannot create 'nodemap/%s': rc = %d\n", name, rc);