Whamcloud - gitweb
Branch b1_6
authorjohann <johann>
Fri, 28 Dec 2007 07:39:21 +0000 (07:39 +0000)
committerjohann <johann>
Fri, 28 Dec 2007 07:39:21 +0000 (07:39 +0000)
b=14398
i=johann
i=bobijam

Console messages can now be disabled via lnet.printk.

lnet/libcfs/debug.c
lnet/libcfs/linux/linux-proc.c
lnet/libcfs/linux/linux-tracefile.c
lnet/libcfs/tracefile.c
lnet/utils/portals.c

index c1601d8..b50ee4d 100644 (file)
@@ -41,7 +41,7 @@ unsigned int libcfs_debug = (D_EMERG | D_ERROR | D_WARNING | D_CONSOLE |
                              D_NETERROR | D_HA | D_CONFIG | D_IOCTL);
 EXPORT_SYMBOL(libcfs_debug);
 
-unsigned int libcfs_printk;
+unsigned int libcfs_printk = D_CANTMASK;
 EXPORT_SYMBOL(libcfs_printk);
 
 unsigned int libcfs_console_ratelimit = 0;
@@ -698,10 +698,8 @@ libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls,
         /* toconsole == 0 - all messages to debug_file_fd
          * toconsole == 1 - warnings to console, all to debug_file_fd
          * toconsole >  1 - all debug to console */
-        if ( ((mask & D_CANTMASK) &&
-             (toconsole == 1)) || (toconsole > 1)) {
+        if (((mask & libcfs_printk) && toconsole == 1) || toconsole > 1)
                 console = 1;
-        }
 #endif
 
         if ((!console) && (!debug_file_fd)) {
index c317a5a..3be3bee 100644 (file)
@@ -121,11 +121,12 @@ static int __proc_dobitmasks(void *data, int write,
         int           rc;
         unsigned int *mask = data;
         int           is_subsys = (mask == &libcfs_subsystem_debug) ? 1 : 0;
+        int           is_printk = (mask == &libcfs_printk) ? 1 : 0;
 
         rc = trace_allocate_string_buffer(&tmpstr, tmpstrlen);
         if (rc < 0)
                 return rc;
-        
+
         if (!write) {
                 libcfs_debug_mask2str(tmpstr, tmpstrlen, *mask, is_subsys);
                 rc = strlen(tmpstr);
@@ -140,8 +141,11 @@ static int __proc_dobitmasks(void *data, int write,
                 rc = trace_copyin_string(tmpstr, tmpstrlen, buffer, nob);
                 if (rc < 0)
                         return rc;
-                
+
                 rc = libcfs_debug_str2mask(mask, tmpstr, is_subsys);
+                /* Always print LBUG/LASSERT to console, so keep this mask */
+                if (is_printk)
+                        *mask |= D_EMERG;
         }
 
         trace_free_string_buffer(tmpstr, tmpstrlen);
index d238c52..5956027 100644 (file)
@@ -221,7 +221,7 @@ void print_to_console(struct ptldebug_header *hdr, int mask, const char *buf,
        } else if ((mask & D_WARNING) != 0) {
                prefix = "Lustre";
                ptype = KERN_WARNING;
-       } else if ((mask & libcfs_printk) != 0 || (mask & D_CONSOLE)) {
+       } else if ((mask & (D_CONSOLE | libcfs_printk)) != 0) {
                prefix = "Lustre";
                ptype = KERN_INFO;
        }
index 3ca5ee8..a0b61ab 100644 (file)
@@ -343,7 +343,7 @@ int libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, int subsys, int mask,
         __LASSERT (tage->used <= CFS_PAGE_SIZE);
 
 console:
-        if (!((mask & D_CANTMASK) != 0 || (mask & libcfs_printk) != 0)) {
+        if ((mask & libcfs_printk) == 0) {
                 /* no console output requested */
                 if (tcd != NULL)
                         trace_put_tcd(tcd);
index 0f2c1ca..1acddcd 100644 (file)
@@ -53,7 +53,7 @@
 #include "parser.h"
 
 unsigned int libcfs_debug;
-unsigned int libcfs_printk;
+unsigned int libcfs_printk = D_CANTMASK;
 
 static int   g_net_set;
 static __u32 g_net;