aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-03-06 18:02:35 -0500
committerDave Chinner <david@fromorbit.com>2011-03-06 18:02:35 -0500
commit6a19d9393a5402e69fc52f5da8a828b8499a8265 (patch)
tree069f5cacc45194ee8e28e0cd59ac817918296f98 /fs/xfs
parenta0fa2b679ecd15b4bdbb46cd2420b6affde91cf9 (diff)
xfs: convert xfs_cmn_err to xfs_alert_tag
Continue the conversion of the old cmn_err interface be converting all the conditional panic tag errors to xfs_alert_tag() and then removing xfs_cmn_err(). Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/support/debug.c28
-rw-r--r--fs/xfs/support/debug.h2
-rw-r--r--fs/xfs/xfs_bmap.c2
-rw-r--r--fs/xfs/xfs_error.c5
-rw-r--r--fs/xfs/xfs_error.h6
-rw-r--r--fs/xfs/xfs_inode.c40
-rw-r--r--fs/xfs/xfs_iomap.c2
-rw-r--r--fs/xfs/xfs_rw.c23
-rw-r--r--fs/xfs/xfs_trans_ail.c2
9 files changed, 36 insertions, 74 deletions
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index 0df88897ef84..feaca739d5cc 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -64,34 +64,6 @@ xfs_fs_cmn_err(
64 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0); 64 BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
65} 65}
66 66
67/* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */
68void
69xfs_cmn_err(
70 int panic_tag,
71 const char *lvl,
72 struct xfs_mount *mp,
73 const char *fmt,
74 ...)
75{
76 struct va_format vaf;
77 va_list args;
78 int do_panic = 0;
79
80 if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
81 printk(KERN_ALERT "XFS: Transforming an alert into a BUG.");
82 do_panic = 1;
83 }
84
85 va_start(args, fmt);
86 vaf.fmt = fmt;
87 vaf.va = &args;
88
89 printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf);
90 va_end(args);
91
92 BUG_ON(do_panic);
93}
94
95void 67void
96assfail(char *expr, char *file, int line) 68assfail(char *expr, char *file, int line)
97{ 69{
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
index 05699f67d475..eaeaa17ef4b8 100644
--- a/fs/xfs/support/debug.h
+++ b/fs/xfs/support/debug.h
@@ -33,8 +33,6 @@ void cmn_err(const char *lvl, const char *fmt, ...)
33 __attribute__ ((format (printf, 2, 3))); 33 __attribute__ ((format (printf, 2, 3)));
34void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp, 34void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
35 const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); 35 const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
36void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
37 const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
38 36
39extern void assfail(char *expr, char *f, int l); 37extern void assfail(char *expr, char *f, int l);
40 38
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index e7b441db0530..451b4484795d 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -3526,7 +3526,7 @@ xfs_bmap_search_extents(
3526 3526
3527 if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) && 3527 if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) &&
3528 !(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) { 3528 !(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) {
3529 xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount, 3529 xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
3530 "Access to block zero in inode %llu " 3530 "Access to block zero in inode %llu "
3531 "start_block: %llx start_off: %llx " 3531 "start_block: %llx start_off: %llx "
3532 "blkcnt: %llx extent-state: %x lastx: %x\n", 3532 "blkcnt: %llx extent-state: %x lastx: %x\n",
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 4c7db74a05f7..34f0e2d264ea 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -162,9 +162,8 @@ xfs_error_report(
162 inst_t *ra) 162 inst_t *ra)
163{ 163{
164 if (level <= xfs_error_level) { 164 if (level <= xfs_error_level) {
165 xfs_cmn_err(XFS_PTAG_ERROR_REPORT, 165 xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
166 CE_ALERT, mp, 166 "Internal error %s at line %d of file %s. Caller 0x%p\n",
167 "XFS internal error %s at line %d of file %s. Caller 0x%p\n",
168 tag, linenum, filename, ra); 167 tag, linenum, filename, ra);
169 168
170 xfs_stack_trace(); 169 xfs_stack_trace();
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 10dce5475f02..e1ba2d2565b3 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -145,10 +145,8 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
145#endif /* DEBUG */ 145#endif /* DEBUG */
146 146
147/* 147/*
148 * XFS panic tags -- allow a call to xfs_cmn_err() be turned into 148 * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
149 * a panic by setting xfs_panic_mask in a 149 * a panic by setting xfs_panic_mask in a sysctl.
150 * sysctl. update xfs_max[XFS_PARAM] if
151 * more are added.
152 */ 150 */
153#define XFS_NO_PTAG 0 151#define XFS_NO_PTAG 0
154#define XFS_PTAG_IFLUSH 0x00000001 152#define XFS_PTAG_IFLUSH 0x00000001
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index c39278b6c871..bf9ca579365c 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2940,16 +2940,16 @@ xfs_iflush_int(
2940 2940
2941 if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC, 2941 if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC,
2942 mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) { 2942 mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) {
2943 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2943 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2944 "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p", 2944 "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p",
2945 ip->i_ino, be16_to_cpu(dip->di_magic), dip); 2945 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
2946 goto corrupt_out; 2946 goto corrupt_out;
2947 } 2947 }
2948 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, 2948 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
2949 mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) { 2949 mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) {
2950 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2950 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2951 "xfs_iflush: Bad inode %Lu, ptr 0x%p, magic number 0x%x", 2951 "%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
2952 ip->i_ino, ip, ip->i_d.di_magic); 2952 __func__, ip->i_ino, ip, ip->i_d.di_magic);
2953 goto corrupt_out; 2953 goto corrupt_out;
2954 } 2954 }
2955 if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) { 2955 if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
@@ -2957,9 +2957,9 @@ xfs_iflush_int(
2957 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && 2957 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
2958 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), 2958 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
2959 mp, XFS_ERRTAG_IFLUSH_3, XFS_RANDOM_IFLUSH_3)) { 2959 mp, XFS_ERRTAG_IFLUSH_3, XFS_RANDOM_IFLUSH_3)) {
2960 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2960 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2961 "xfs_iflush: Bad regular inode %Lu, ptr 0x%p", 2961 "%s: Bad regular inode %Lu, ptr 0x%p",
2962 ip->i_ino, ip); 2962 __func__, ip->i_ino, ip);
2963 goto corrupt_out; 2963 goto corrupt_out;
2964 } 2964 }
2965 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 2965 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
@@ -2968,28 +2968,28 @@ xfs_iflush_int(
2968 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && 2968 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
2969 (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL), 2969 (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL),
2970 mp, XFS_ERRTAG_IFLUSH_4, XFS_RANDOM_IFLUSH_4)) { 2970 mp, XFS_ERRTAG_IFLUSH_4, XFS_RANDOM_IFLUSH_4)) {
2971 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2971 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2972 "xfs_iflush: Bad directory inode %Lu, ptr 0x%p", 2972 "%s: Bad directory inode %Lu, ptr 0x%p",
2973 ip->i_ino, ip); 2973 __func__, ip->i_ino, ip);
2974 goto corrupt_out; 2974 goto corrupt_out;
2975 } 2975 }
2976 } 2976 }
2977 if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents > 2977 if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents >
2978 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5, 2978 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5,
2979 XFS_RANDOM_IFLUSH_5)) { 2979 XFS_RANDOM_IFLUSH_5)) {
2980 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2980 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2981 "xfs_iflush: detected corrupt incore inode %Lu, total extents = %d, nblocks = %Ld, ptr 0x%p", 2981 "%s: detected corrupt incore inode %Lu, "
2982 ip->i_ino, 2982 "total extents = %d, nblocks = %Ld, ptr 0x%p",
2983 __func__, ip->i_ino,
2983 ip->i_d.di_nextents + ip->i_d.di_anextents, 2984 ip->i_d.di_nextents + ip->i_d.di_anextents,
2984 ip->i_d.di_nblocks, 2985 ip->i_d.di_nblocks, ip);
2985 ip);
2986 goto corrupt_out; 2986 goto corrupt_out;
2987 } 2987 }
2988 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize, 2988 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize,
2989 mp, XFS_ERRTAG_IFLUSH_6, XFS_RANDOM_IFLUSH_6)) { 2989 mp, XFS_ERRTAG_IFLUSH_6, XFS_RANDOM_IFLUSH_6)) {
2990 xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp, 2990 xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
2991 "xfs_iflush: bad inode %Lu, forkoff 0x%x, ptr 0x%p", 2991 "%s: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
2992 ip->i_ino, ip->i_d.di_forkoff, ip); 2992 __func__, ip->i_ino, ip->i_d.di_forkoff, ip);
2993 goto corrupt_out; 2993 goto corrupt_out;
2994 } 2994 }
2995 /* 2995 /*
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 8a0f044750c3..812646fe1b3e 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -105,7 +105,7 @@ xfs_cmn_err_fsblock_zero(
105 xfs_inode_t *ip, 105 xfs_inode_t *ip,
106 xfs_bmbt_irec_t *imap) 106 xfs_bmbt_irec_t *imap)
107{ 107{
108 xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount, 108 xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
109 "Access to block zero in inode %llu " 109 "Access to block zero in inode %llu "
110 "start_block: %llx start_off: %llx " 110 "start_block: %llx start_off: %llx "
111 "blkcnt: %llx extent-state: %x\n", 111 "blkcnt: %llx extent-state: %x\n",
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index ccd3adf640ee..ae6f49613412 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -69,25 +69,20 @@ xfs_do_force_shutdown(
69 return; 69 return;
70 70
71 if (flags & SHUTDOWN_CORRUPT_INCORE) { 71 if (flags & SHUTDOWN_CORRUPT_INCORE) {
72 xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp, 72 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
73 "Corruption of in-memory data detected. Shutting down filesystem: %s", 73 "Corruption of in-memory data detected. Shutting down filesystem");
74 mp->m_fsname); 74 if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
75 if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
76 xfs_stack_trace(); 75 xfs_stack_trace();
77 }
78 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { 76 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
79 if (logerror) { 77 if (logerror) {
80 xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp, 78 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
81 "Log I/O Error Detected. Shutting down filesystem: %s", 79 "Log I/O Error Detected. Shutting down filesystem");
82 mp->m_fsname);
83 } else if (flags & SHUTDOWN_DEVICE_REQ) { 80 } else if (flags & SHUTDOWN_DEVICE_REQ) {
84 xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp, 81 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
85 "All device paths lost. Shutting down filesystem: %s", 82 "All device paths lost. Shutting down filesystem");
86 mp->m_fsname);
87 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) { 83 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
88 xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp, 84 xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
89 "I/O Error Detected. Shutting down filesystem: %s", 85 "I/O Error Detected. Shutting down filesystem");
90 mp->m_fsname);
91 } 86 }
92 } 87 }
93 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { 88 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index c5bbbc45db91..12aff9584e29 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -563,7 +563,7 @@ xfs_trans_ail_delete_bulk(
563 563
564 spin_unlock(&ailp->xa_lock); 564 spin_unlock(&ailp->xa_lock);
565 if (!XFS_FORCED_SHUTDOWN(mp)) { 565 if (!XFS_FORCED_SHUTDOWN(mp)) {
566 xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, 566 xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
567 "%s: attempting to delete a log item that is not in the AIL", 567 "%s: attempting to delete a log item that is not in the AIL",
568 __func__); 568 __func__);
569 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 569 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);