1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2011 Red Hat, Inc. All Rights Reserved.
9 #include "xfs_shared.h"
10 #include "xfs_format.h"
11 #include "xfs_trans_resv.h"
12 #include "xfs_mount.h"
15 * XFS logging functions
20 const struct xfs_mount *mp,
21 struct va_format *vaf)
23 if (mp && mp->m_super) {
24 printk("%sXFS (%s): %pV\n", level, mp->m_super->s_id, vaf);
27 printk("%sXFS: %pV\n", level, vaf);
30 #define define_xfs_printk_level(func, kern_level) \
31 void func(const struct xfs_mount *mp, const char *fmt, ...) \
33 struct va_format vaf; \
37 va_start(args, fmt); \
42 __xfs_printk(kern_level, mp, &vaf); \
45 if (!kstrtoint(kern_level, 0, &level) && \
46 level <= LOGLEVEL_ERR && \
47 xfs_error_level >= XFS_ERRLEVEL_HIGH) \
51 define_xfs_printk_level(xfs_emerg, KERN_EMERG);
52 define_xfs_printk_level(xfs_alert, KERN_ALERT);
53 define_xfs_printk_level(xfs_crit, KERN_CRIT);
54 define_xfs_printk_level(xfs_err, KERN_ERR);
55 define_xfs_printk_level(xfs_warn, KERN_WARNING);
56 define_xfs_printk_level(xfs_notice, KERN_NOTICE);
57 define_xfs_printk_level(xfs_info, KERN_INFO);
59 define_xfs_printk_level(xfs_debug, KERN_DEBUG);
64 const struct xfs_mount *mp,
72 if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
73 xfs_alert(mp, "Transforming an alert into a BUG.");
82 __xfs_printk(KERN_ALERT, mp, &vaf);
95 xfs_warn(mp, "Assertion failed: %s, file: %s, line: %d",
102 struct xfs_mount *mp,
107 xfs_emerg(mp, "Assertion failed: %s, file: %s, line: %d",
109 if (xfs_globals.bug_on_assert)
116 xfs_hex_dump(const void *p, int length)
118 print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_OFFSET, 16, 1, p, length, 1);
122 xfs_buf_alert_ratelimited(
128 struct xfs_mount *mp = bp->b_mount;
129 struct va_format vaf;
132 /* use the more aggressive per-target rate limit for buffers */
133 if (!___ratelimit(&bp->b_target->bt_ioerror_rl, rlmsg))
139 __xfs_printk(KERN_ALERT, mp, &vaf);