[ofa-general] [PATCH 2/5] Maintain a name of the node in the monitored node structure for log messages.

Ira Weiny weiny2 at llnl.gov
Wed Nov 7 18:58:20 PST 2007


>From f75aa716b3918989876d61863a8f03aff221405f Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Tue, 6 Nov 2007 18:34:28 -0800
Subject: [PATCH] Maintain a name of the node in the monitored node structure for log messages.


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 opensm/include/opensm/osm_perfmgr.h |    1 +
 opensm/opensm/osm_perfmgr.c         |   14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/opensm/include/opensm/osm_perfmgr.h b/opensm/include/opensm/osm_perfmgr.h
index 89d4fd8..0dd3ce4 100644
--- a/opensm/include/opensm/osm_perfmgr.h
+++ b/opensm/include/opensm/osm_perfmgr.h
@@ -101,6 +101,7 @@ typedef struct _monitored_node {
 	cl_map_item_t map_item;
 	struct _monitored_node *next;
 	uint64_t guid;
+	char *name;
 	uint32_t redir_tbl_size;
 	redir_t redir_port[1];	/* redirection on a per port basis */
 } __monitored_node_t;
diff --git a/opensm/opensm/osm_perfmgr.c b/opensm/opensm/osm_perfmgr.c
index 89fe7a5..d78d747 100644
--- a/opensm/opensm/osm_perfmgr.c
+++ b/opensm/opensm/osm_perfmgr.c
@@ -147,6 +147,9 @@ static inline void __remove_marked_nodes(osm_perfmgr_t * pm)
 
 		cl_qmap_remove_item(&(pm->monitored_map),
 				    (cl_map_item_t *) (pm->remove_list));
+
+		if (pm->remove_list->name)
+			free(pm->remove_list->name);
 		free(pm->remove_list);
 		pm->remove_list = next;
 	}
@@ -440,12 +443,13 @@ static void __collect_guids(cl_map_item_t * const p_map_item, void *context)
 		mon_node = malloc(sizeof(*mon_node) + sizeof(redir_t) * size);
 		if (!mon_node) {
 			osm_log(pm->log, OSM_LOG_ERROR,
-				"PerfMgr: __collect_guids ERR 4C06: malloc failed so not handling node GUID 0x%"
-				PRIx64 "\n", node_guid);
+				"PerfMgr: __collect_guids ERR 4C06: malloc failed: not handling node %s"
+				"(GUID 0x%" PRIx64 ")\n", node->print_desc, node_guid);
 			goto Exit;
 		}
 		memset(mon_node, 0, sizeof(*mon_node) + sizeof(redir_t) * size);
 		mon_node->guid = node_guid;
+		mon_node->name = strdup(node->print_desc);
 		mon_node->redir_tbl_size = size + 1;
 		cl_qmap_insert(&(pm->monitored_map), node_guid,
 			       (cl_map_item_t *) mon_node);
@@ -477,10 +481,10 @@ __osm_perfmgr_query_counters(cl_map_item_t * const p_map_item, void *context)
 	node = osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
 	if (!node) {
 		osm_log(pm->log, OSM_LOG_ERROR,
-			"__osm_perfmgr_query_counters: ERR 4C07: Node guid 0x%"
+			"__osm_perfmgr_query_counters: ERR 4C07: Node \"%s\" (guid 0x%"
 			PRIx64
-			" no longer exists so removing from PerfMgr monitoring\n",
-			mon_node->guid);
+			") no longer exists so removing from PerfMgr monitoring\n",
+			mon_node->name, mon_node->guid);
 		__mark_for_removal(pm, mon_node);
 		goto Exit;
 	}
-- 
1.5.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Maintain-a-name-of-the-node-in-the-monitored-node-st.patch
Type: application/octet-stream
Size: 2751 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20071107/4740f182/attachment.obj>


More information about the general mailing list