Commit 6a19d9393a5402e69fc52f5da8a828b8499a8265

Authored by Dave Chinner
Committed by Dave Chinner
1 parent a0fa2b679e

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>

Showing 9 changed files with 36 additions and 74 deletions Side-by-side Diff

fs/xfs/support/debug.c
... ... @@ -64,34 +64,6 @@
64 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 */
68   -void
69   -xfs_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   -
95 67 void
96 68 assfail(char *expr, char *file, int line)
97 69 {
fs/xfs/support/debug.h
... ... @@ -33,8 +33,6 @@
33 33 __attribute__ ((format (printf, 2, 3)));
34 34 void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
35 35 const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
36   -void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
37   - const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
38 36  
39 37 extern void assfail(char *expr, char *f, int l);
40 38  
... ... @@ -3526,7 +3526,7 @@
3526 3526  
3527 3527 if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) &&
3528 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 3530 "Access to block zero in inode %llu "
3531 3531 "start_block: %llx start_off: %llx "
3532 3532 "blkcnt: %llx extent-state: %x lastx: %x\n",
... ... @@ -162,9 +162,8 @@
162 162 inst_t *ra)
163 163 {
164 164 if (level <= xfs_error_level) {
165   - xfs_cmn_err(XFS_PTAG_ERROR_REPORT,
166   - CE_ALERT, mp,
167   - "XFS internal error %s at line %d of file %s. Caller 0x%p\n",
  165 + xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
  166 + "Internal error %s at line %d of file %s. Caller 0x%p\n",
168 167 tag, linenum, filename, ra);
169 168  
170 169 xfs_stack_trace();
... ... @@ -145,10 +145,8 @@
145 145 #endif /* DEBUG */
146 146  
147 147 /*
148   - * XFS panic tags -- allow a call to xfs_cmn_err() be turned into
149   - * a panic by setting xfs_panic_mask in a
150   - * sysctl. update xfs_max[XFS_PARAM] if
151   - * more are added.
  148 + * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
  149 + * a panic by setting xfs_panic_mask in a sysctl.
152 150 */
153 151 #define XFS_NO_PTAG 0
154 152 #define XFS_PTAG_IFLUSH 0x00000001
... ... @@ -2940,16 +2940,16 @@
2940 2940  
2941 2941 if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC,
2942 2942 mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) {
2943   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2944   - "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p",
2945   - ip->i_ino, be16_to_cpu(dip->di_magic), dip);
  2943 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2944 + "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p",
  2945 + __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
2946 2946 goto corrupt_out;
2947 2947 }
2948 2948 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
2949 2949 mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) {
2950   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2951   - "xfs_iflush: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
2952   - ip->i_ino, ip, ip->i_d.di_magic);
  2950 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2951 + "%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
  2952 + __func__, ip->i_ino, ip, ip->i_d.di_magic);
2953 2953 goto corrupt_out;
2954 2954 }
2955 2955 if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
... ... @@ -2957,9 +2957,9 @@
2957 2957 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
2958 2958 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
2959 2959 mp, XFS_ERRTAG_IFLUSH_3, XFS_RANDOM_IFLUSH_3)) {
2960   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2961   - "xfs_iflush: Bad regular inode %Lu, ptr 0x%p",
2962   - ip->i_ino, ip);
  2960 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2961 + "%s: Bad regular inode %Lu, ptr 0x%p",
  2962 + __func__, ip->i_ino, ip);
2963 2963 goto corrupt_out;
2964 2964 }
2965 2965 } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
2966 2966  
2967 2967  
2968 2968  
... ... @@ -2968,28 +2968,28 @@
2968 2968 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
2969 2969 (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL),
2970 2970 mp, XFS_ERRTAG_IFLUSH_4, XFS_RANDOM_IFLUSH_4)) {
2971   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2972   - "xfs_iflush: Bad directory inode %Lu, ptr 0x%p",
2973   - ip->i_ino, ip);
  2971 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2972 + "%s: Bad directory inode %Lu, ptr 0x%p",
  2973 + __func__, ip->i_ino, ip);
2974 2974 goto corrupt_out;
2975 2975 }
2976 2976 }
2977 2977 if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents >
2978 2978 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5,
2979 2979 XFS_RANDOM_IFLUSH_5)) {
2980   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2981   - "xfs_iflush: detected corrupt incore inode %Lu, total extents = %d, nblocks = %Ld, ptr 0x%p",
2982   - ip->i_ino,
  2980 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2981 + "%s: detected corrupt incore inode %Lu, "
  2982 + "total extents = %d, nblocks = %Ld, ptr 0x%p",
  2983 + __func__, ip->i_ino,
2983 2984 ip->i_d.di_nextents + ip->i_d.di_anextents,
2984   - ip->i_d.di_nblocks,
2985   - ip);
  2985 + ip->i_d.di_nblocks, ip);
2986 2986 goto corrupt_out;
2987 2987 }
2988 2988 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize,
2989 2989 mp, XFS_ERRTAG_IFLUSH_6, XFS_RANDOM_IFLUSH_6)) {
2990   - xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
2991   - "xfs_iflush: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
2992   - ip->i_ino, ip->i_d.di_forkoff, ip);
  2990 + xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
  2991 + "%s: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
  2992 + __func__, ip->i_ino, ip->i_d.di_forkoff, ip);
2993 2993 goto corrupt_out;
2994 2994 }
2995 2995 /*
... ... @@ -105,7 +105,7 @@
105 105 xfs_inode_t *ip,
106 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 109 "Access to block zero in inode %llu "
110 110 "start_block: %llx start_off: %llx "
111 111 "blkcnt: %llx extent-state: %x\n",
... ... @@ -69,25 +69,20 @@
69 69 return;
70 70  
71 71 if (flags & SHUTDOWN_CORRUPT_INCORE) {
72   - xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
73   - "Corruption of in-memory data detected. Shutting down filesystem: %s",
74   - mp->m_fsname);
75   - if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
  72 + xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
  73 + "Corruption of in-memory data detected. Shutting down filesystem");
  74 + if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
76 75 xfs_stack_trace();
77   - }
78 76 } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
79 77 if (logerror) {
80   - xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
81   - "Log I/O Error Detected. Shutting down filesystem: %s",
82   - mp->m_fsname);
  78 + xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
  79 + "Log I/O Error Detected. Shutting down filesystem");
83 80 } else if (flags & SHUTDOWN_DEVICE_REQ) {
84   - xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
85   - "All device paths lost. Shutting down filesystem: %s",
86   - mp->m_fsname);
  81 + xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
  82 + "All device paths lost. Shutting down filesystem");
87 83 } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
88   - xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
89   - "I/O Error Detected. Shutting down filesystem: %s",
90   - mp->m_fsname);
  84 + xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
  85 + "I/O Error Detected. Shutting down filesystem");
91 86 }
92 87 }
93 88 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
fs/xfs/xfs_trans_ail.c
... ... @@ -563,7 +563,7 @@
563 563  
564 564 spin_unlock(&ailp->xa_lock);
565 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 567 "%s: attempting to delete a log item that is not in the AIL",
568 568 __func__);
569 569 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);