aboutsummaryrefslogtreecommitdiffstats
path: root/modules/spl/spl-generic.c
diff options
context:
space:
mode:
authorbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-04-15 20:53:36 +0000
committerbehlendo <behlendo@7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c>2008-04-15 20:53:36 +0000
commitd61e12af5af3ca6ba92a1b208e33c4e6cb99c9a3 (patch)
tree6a0e9044fb54022447352e099f31fb927331c57f /modules/spl/spl-generic.c
parentc5fd77fcbf20f19a4690c535be494dcf474a0649 (diff)
- Add some spinlocks to cover all the private data in the mutex. I don't
think this should fix anything but it's a good idea regardless. - Drop the lock before calling the construct/destructor for the slab otherwise we can't sleep in a constructor/destructor and for long running functions we may NMI. - Do something braindead, but safe for the console debug logs for now. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@73 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
Diffstat (limited to 'modules/spl/spl-generic.c')
-rw-r--r--modules/spl/spl-generic.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/modules/spl/spl-generic.c b/modules/spl/spl-generic.c
index 3faa4b6b3..8cd217cf1 100644
--- a/modules/spl/spl-generic.c
+++ b/modules/spl/spl-generic.c
@@ -10,7 +10,8 @@
/*
* Generic support
*/
-static char spl_debug_buffer[MAXMSGLEN];
+static char spl_debug_buffer1[1024];
+static char spl_debug_buffer2[1024];
static spinlock_t spl_debug_lock = SPIN_LOCK_UNLOCKED;
unsigned long spl_debug_mask = 0;
@@ -83,12 +84,11 @@ EXPORT_SYMBOL(ddi_strtoul);
void
__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
{
- char *sfp, *start, *ptr;
+ char *sfp;
struct timeval tv;
unsigned long flags;
va_list ap;
- start = ptr = spl_debug_buffer;
sfp = strrchr(file, '/');
do_gettimeofday(&tv);
@@ -98,18 +98,21 @@ __dprintf(const char *file, const char *func, int line, const char *fmt, ...)
* reason why we really, really, need an internal debug log.
*/
spin_lock_irqsave(&spl_debug_lock, flags);
- ptr += snprintf(ptr, MAXMSGLEN - 1,
- "spl: %lu.%06lu:%d:%u:%s:%d:%s(): ",
- tv.tv_sec, tv.tv_usec, current->pid,
- smp_processor_id(),
- sfp == NULL ? file : sfp + 1,
- line, func);
+ memset(spl_debug_buffer1, 0, 1024);
+ memset(spl_debug_buffer2, 0, 1024);
+
+ snprintf(spl_debug_buffer1, 1023,
+ "spl: %lu.%06lu:%d:%u:%s:%d:%s(): ",
+ tv.tv_sec, tv.tv_usec, current->pid,
+ smp_processor_id(),
+ sfp == NULL ? file : sfp + 1,
+ line, func);
va_start(ap, fmt);
- ptr += vsnprintf(ptr, MAXMSGLEN - (ptr - start) - 1, fmt, ap);
+ vsnprintf(spl_debug_buffer2, 1023, fmt, ap);
va_end(ap);
- printk("%s", start);
+ printk("%s%s", spl_debug_buffer1, spl_debug_buffer2);
spin_unlock_irqrestore(&spl_debug_lock, flags);
}
EXPORT_SYMBOL(__dprintf);