X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=libcfs%2Flibcfs%2Fdebug.c;h=262eb02dee45794adb901487c5a55f148b2c2eb7;hb=960857b6b23d9e715cd9737db6e25229d523e2a8;hp=be2db8e3e60a4f4eb9682f42e5dd46396b5336d5;hpb=98ddf37c044e0db6a0009d1ed296dd42cae1661d;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/debug.c b/libcfs/libcfs/debug.c index be2db8e..262eb02 100644 --- a/libcfs/libcfs/debug.c +++ b/libcfs/libcfs/debug.c @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -36,12 +36,9 @@ * libcfs/libcfs/debug.c * * Author: Phil Schwan + * */ -#ifndef EXPORT_SYMTAB -# define EXPORT_SYMTAB -#endif - # define DEBUG_SUBSYSTEM S_LNET #include @@ -54,7 +51,7 @@ CFS_MODULE_PARM(libcfs_subsystem_debug, "i", int, 0644, "Lustre kernel debug subsystem mask"); EXPORT_SYMBOL(libcfs_subsystem_debug); -unsigned int libcfs_debug = (D_EMERG | D_ERROR | D_WARNING | D_CONSOLE | +unsigned int libcfs_debug = (D_CANTMASK | D_NETERROR | D_HA | D_CONFIG | D_IOCTL); CFS_MODULE_PARM(libcfs_debug, "i", int, 0644, "Lustre kernel debug mask"); @@ -75,13 +72,13 @@ CFS_MODULE_PARM(libcfs_console_ratelimit, "i", uint, 0644, "Lustre kernel debug console ratelimit (0 to disable)"); EXPORT_SYMBOL(libcfs_console_ratelimit); -cfs_duration_t libcfs_console_max_delay; -CFS_MODULE_PARM(libcfs_console_max_delay, "l", ulong, 0644, +unsigned int libcfs_console_max_delay; +CFS_MODULE_PARM(libcfs_console_max_delay, "l", uint, 0644, "Lustre kernel debug console max delay (jiffies)"); EXPORT_SYMBOL(libcfs_console_max_delay); -cfs_duration_t libcfs_console_min_delay; -CFS_MODULE_PARM(libcfs_console_min_delay, "l", ulong, 0644, +unsigned int libcfs_console_min_delay; +CFS_MODULE_PARM(libcfs_console_min_delay, "l", uint, 0644, "Lustre kernel debug console min delay (jiffies)"); EXPORT_SYMBOL(libcfs_console_min_delay); @@ -93,7 +90,7 @@ EXPORT_SYMBOL(libcfs_console_backoff); unsigned int libcfs_debug_binary = 1; EXPORT_SYMBOL(libcfs_debug_binary); -unsigned int libcfs_stack; +unsigned int libcfs_stack = 3 * THREAD_SIZE / 4; EXPORT_SYMBOL(libcfs_stack); unsigned int portal_enter_debugger; @@ -248,7 +245,9 @@ libcfs_debug_dbg2str(int debug) return "quota"; case D_SEC: return "sec"; - } + case D_LFSCK: + return "lfsck"; + } } int @@ -316,14 +315,17 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys) if ((t = sscanf(str, "%i%n", &m, &matched)) >= 1 && matched == n) { - CWARN("You are trying to use a numerical value for the mask -" - " this will be deprecated in a future release.\n"); + /* don't print warning for lctl set_param debug=0 or -1 */ + if (m != 0 && m != -1) + CWARN("You are trying to use a numerical value for the " + "mask - this will be deprecated in a future " + "release.\n"); *mask = m; return 0; } - return libcfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK, - 0xffffffff); + return cfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK, + 0xffffffff); } /** @@ -376,10 +378,11 @@ void libcfs_debug_dumplog(void) else cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE); - /* be sure to teardown if cfs_kernel_thread() failed */ + /* be sure to teardown if cfs_create_thread() failed */ cfs_waitq_del(&debug_ctlwq, &wait); cfs_set_current_state(CFS_TASK_RUNNING); } +EXPORT_SYMBOL(libcfs_debug_dumplog); int libcfs_debug_init(unsigned long bufsize) { @@ -452,5 +455,20 @@ void libcfs_debug_set_level(unsigned int debug_level) libcfs_debug = debug_level; } -EXPORT_SYMBOL(libcfs_debug_dumplog); EXPORT_SYMBOL(libcfs_debug_set_level); + +long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc) +{ + libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n", + rc, rc, rc); + return rc; +} +EXPORT_SYMBOL(libcfs_log_return); + +void libcfs_log_goto(struct libcfs_debug_msg_data *msgdata, const char *label, + long_ptr_t rc) +{ + libcfs_debug_msg(msgdata, "Process leaving via %s (rc=" LPLU " : " LPLD + " : " LPLX ")\n", label, (ulong_ptr_t)rc, rc, rc); +} +EXPORT_SYMBOL(libcfs_log_goto);