Whamcloud - gitweb
LU-444 lnet: Add LNetError for S_LND and S_LNET
authorJames Simmons <uja.ornl@gmail.com>
Mon, 5 Mar 2012 14:28:48 +0000 (09:28 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 29 Mar 2012 03:53:17 +0000 (23:53 -0400)
This changes the console error string for LND and LNET subsystem
messages to LNet or LNetError depending on the severity. This
should make it much easier to figure out where the issues are.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ibd5f5c4cd717d2c9b6bd865e7e13258e84cda821
Reviewed-on: http://review.whamcloud.com/990
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
libcfs/libcfs/linux/linux-tracefile.c

index 51d7d7f..7b499f8 100644 (file)
@@ -202,6 +202,32 @@ cfs_set_ptldebug_header(struct ptldebug_header *header,
        return;
 }
 
+static char *
+dbghdr_to_err_string(struct ptldebug_header *hdr)
+{
+        switch (hdr->ph_subsys) {
+
+                case S_LND:
+                case S_LNET:
+                        return "LNetError";
+                default:
+                        return "LustreError";
+        }
+}
+
+static char *
+dbghdr_to_info_string(struct ptldebug_header *hdr)
+{
+        switch (hdr->ph_subsys) {
+
+                case S_LND:
+                case S_LNET:
+                        return "LNet";
+                default:
+                        return "Lustre";
+        }
+}
+
 void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
                           const char *buf, int len, const char *file,
                           const char *fn)
@@ -209,16 +235,16 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
        char *prefix = "Lustre", *ptype = NULL;
 
        if ((mask & D_EMERG) != 0) {
-               prefix = "LustreError";
+               prefix = dbghdr_to_err_string(hdr);
                ptype = KERN_EMERG;
        } else if ((mask & D_ERROR) != 0) {
-               prefix = "LustreError";
+               prefix = dbghdr_to_err_string(hdr);
                ptype = KERN_ERR;
        } else if ((mask & D_WARNING) != 0) {
-               prefix = "Lustre";
+               prefix = dbghdr_to_info_string(hdr);
                ptype = KERN_WARNING;
        } else if ((mask & (D_CONSOLE | libcfs_printk)) != 0) {
-               prefix = "Lustre";
+               prefix = dbghdr_to_info_string(hdr);
                ptype = KERN_INFO;
        }