aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/support/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/support/debug.c')
-rw-r--r--fs/xfs/support/debug.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index 636104254cfd..ae5482965424 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -18,6 +18,13 @@
18#include <xfs.h> 18#include <xfs.h>
19#include "debug.h" 19#include "debug.h"
20 20
21/* xfs_mount.h drags a lot of crap in, sorry.. */
22#include "xfs_sb.h"
23#include "xfs_inum.h"
24#include "xfs_ag.h"
25#include "xfs_dmapi.h"
26#include "xfs_mount.h"
27
21static char message[1024]; /* keep it off the stack */ 28static char message[1024]; /* keep it off the stack */
22static DEFINE_SPINLOCK(xfs_err_lock); 29static DEFINE_SPINLOCK(xfs_err_lock);
23 30
@@ -55,22 +62,42 @@ cmn_err(register int level, char *fmt, ...)
55} 62}
56 63
57void 64void
58icmn_err(register int level, char *fmt, va_list ap) 65xfs_fs_vcmn_err(
66 int level,
67 struct xfs_mount *mp,
68 char *fmt,
69 va_list ap)
59{ 70{
60 ulong flags; 71 unsigned long flags;
61 int len; 72 int len = 0;
62 73
63 level &= XFS_ERR_MASK; 74 level &= XFS_ERR_MASK;
64 if(level > XFS_MAX_ERR_LEVEL) 75 if (level > XFS_MAX_ERR_LEVEL)
65 level = XFS_MAX_ERR_LEVEL; 76 level = XFS_MAX_ERR_LEVEL;
77
66 spin_lock_irqsave(&xfs_err_lock,flags); 78 spin_lock_irqsave(&xfs_err_lock,flags);
67 len = vsnprintf(message, sizeof(message), fmt, ap); 79
80 if (mp) {
81 len = sprintf(message, "Filesystem \"%s\": ", mp->m_fsname);
82
83 /*
84 * Skip the printk if we can't print anything useful
85 * due to an over-long device name.
86 */
87 if (len >= sizeof(message))
88 goto out;
89 }
90
91 len = vsnprintf(message + len, sizeof(message) - len, fmt, ap);
68 if (len >= sizeof(message)) 92 if (len >= sizeof(message))
69 len = sizeof(message) - 1; 93 len = sizeof(message) - 1;
70 if (message[len-1] == '\n') 94 if (message[len-1] == '\n')
71 message[len-1] = 0; 95 message[len-1] = 0;
96
72 printk("%s%s\n", err_level[level], message); 97 printk("%s%s\n", err_level[level], message);
98 out:
73 spin_unlock_irqrestore(&xfs_err_lock,flags); 99 spin_unlock_irqrestore(&xfs_err_lock,flags);
100
74 BUG_ON(level == CE_PANIC); 101 BUG_ON(level == CE_PANIC);
75} 102}
76 103