X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fportals%2Flibcfs%2Fdebug.c;h=be117b878226b02dc312d923e94163bfa68ace8a;hb=090c677210ee2946d99c71412e4ff762bb300f4f;hp=09db54e24198654758376d214e69f92f62513669;hpb=0343ecb7de2dae4cf8016416bf1af5d34e9a746d;p=fs%2Flustre-release.git diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index 09db54e..be117b8 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -50,6 +50,29 @@ #include #include +#include + +unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | + S_GMNAL | S_IBNAL); +EXPORT_SYMBOL(portal_subsystem_debug); + +unsigned int portal_debug = (D_WARNING | D_DLMTRACE | D_ERROR | D_EMERG | D_HA | + D_RPCTRACE | D_VFSTRACE | 0xffffffff); +EXPORT_SYMBOL(portal_debug); + +unsigned int portal_cerror = 1; +EXPORT_SYMBOL(portal_cerror); + +unsigned int portal_printk; +EXPORT_SYMBOL(portal_printk); + +unsigned int portal_stack; +EXPORT_SYMBOL(portal_stack); + +#ifdef __KERNEL__ +atomic_t portal_kmemory = ATOMIC_INIT(0); +EXPORT_SYMBOL(portal_kmemory); +#endif #define DEBUG_OVERFLOW 1024 static char *debug_buf = NULL; @@ -633,9 +656,9 @@ int portals_debug_mark_buffer(char *text) if (debug_buf == NULL) return -EINVAL; - CDEBUG(0, "********************************************************\n"); + CDEBUG(D_TRACE,"***************************************************\n"); CWARN("DEBUG MARKER: %s\n", text); - CDEBUG(0, "********************************************************\n"); + CDEBUG(D_TRACE,"***************************************************\n"); return 0; } @@ -806,6 +829,10 @@ portals_debug_msg(int subsys, int mask, char *file, const char *fn, tv.tv_sec, tv.tv_usec, stack, current->pid); max_nob -= prefix_nob; + if(*(format + strlen(format) - 1) != '\n') + printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n", + file, line, fn); + #if defined(__arch_um__) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) msg_nob = snprintf(debug_buf + debug_off + prefix_nob, max_nob, "%d:(%s:%d:%s()) ", @@ -922,6 +949,8 @@ void portals_run_lbug_upcall(char *file, const char *fn, const int line) char *portals_nid2str(int nal, ptl_nid_t nid, char *str) { switch(nal){ +/* XXX this should be a nal method of some sort */ +#ifndef CRAY_PORTALS case TCPNAL: /* userspace NAL */ case SOCKNAL: @@ -934,16 +963,14 @@ char *portals_nid2str(int nal, ptl_nid_t nid, char *str) case SCIMACNAL: sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid); break; +#endif default: - return NULL; + snprintf(str, PTL_NALFMT_SIZE-1, "(?%llx)", (long long)nid); } return str; } #ifdef __KERNEL__ -#include -#if (LUSTRE_KERNEL_VERSION >= 30) -#warning "FIXME: remove workaround when l30 is widely used" char stack_backtrace[LUSTRE_TRACE_SIZE]; spinlock_t stack_backtrace_lock = SPIN_LOCK_UNLOCKED; @@ -954,7 +981,7 @@ extern int is_kernel_text_address(unsigned long addr); char *portals_debug_dumpstack(void) { asm("int $3"); - return "dump stack"; + return "dump stack\n"; } #elif defined(__i386__) @@ -1016,7 +1043,6 @@ char *portals_debug_dumpstack(void) #endif /* __arch_um__ */ EXPORT_SYMBOL(stack_backtrace_lock); EXPORT_SYMBOL(portals_debug_dumpstack); -#endif /* LUSTRE_KERNEL_VERSION < 30 */ #endif /* __KERNEL__ */ EXPORT_SYMBOL(portals_debug_dumplog);