xfs: convert xfs_cmn_err to xfs_alert_tag
authorDave Chinner <dchinner@redhat.com>
Sun, 6 Mar 2011 23:02:35 +0000 (10:02 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 6 Mar 2011 23:02:35 +0000 (10:02 +1100)
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>
fs/xfs/support/debug.c
fs/xfs/support/debug.h
fs/xfs/xfs_bmap.c
fs/xfs/xfs_error.c
fs/xfs/xfs_error.h
fs/xfs/xfs_inode.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_rw.c
fs/xfs/xfs_trans_ail.c

index 0df88897ef8442da776f726960c6b2a9deece178..feaca739d5cccbec45e1a4f61299f8374916120f 100644 (file)
@@ -64,34 +64,6 @@ xfs_fs_cmn_err(
        BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
 }
 
-/* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */
-void
-xfs_cmn_err(
-       int                     panic_tag,
-       const char              *lvl,
-       struct xfs_mount        *mp,
-       const char              *fmt,
-       ...)
-{
-       struct va_format        vaf;
-       va_list                 args;
-       int                     do_panic = 0;
-
-       if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
-               printk(KERN_ALERT "XFS: Transforming an alert into a BUG.");
-               do_panic = 1;
-       }
-
-       va_start(args, fmt);
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf);
-       va_end(args);
-
-       BUG_ON(do_panic);
-}
-
 void
 assfail(char *expr, char *file, int line)
 {
index 05699f67d47521f9eb3c78a8007b6fcc0ad16473..eaeaa17ef4b81c8106ff07e9c241e1b0704c7e42 100644 (file)
@@ -33,8 +33,6 @@ void cmn_err(const char *lvl, const char *fmt, ...)
                __attribute__ ((format (printf, 2, 3)));
 void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
                const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
-void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
-               const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
 
 extern void assfail(char *expr, char *f, int l);
 
index e7b441db0530d729ed5eea649fe9dbbc7622ac69..451b4484795d0ce848364109a897521812b23651 100644 (file)
@@ -3526,7 +3526,7 @@ xfs_bmap_search_extents(
 
        if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) &&
                     !(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) {
-               xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount,
+               xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
                                "Access to block zero in inode %llu "
                                "start_block: %llx start_off: %llx "
                                "blkcnt: %llx extent-state: %x lastx: %x\n",
index 4c7db74a05f70ba5359c81ad6480c1d34c86ca01..34f0e2d264eaab9f9a09a442b947593cec27a7c8 100644 (file)
@@ -162,9 +162,8 @@ xfs_error_report(
        inst_t                  *ra)
 {
        if (level <= xfs_error_level) {
-               xfs_cmn_err(XFS_PTAG_ERROR_REPORT,
-                           CE_ALERT, mp,
-               "XFS internal error %s at line %d of file %s.  Caller 0x%p\n",
+               xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
+               "Internal error %s at line %d of file %s.  Caller 0x%p\n",
                            tag, linenum, filename, ra);
 
                xfs_stack_trace();
index 10dce5475f022061ac95e863b98a07b6c715c21d..e1ba2d2565b325a899e890f758eb828b12843f1b 100644 (file)
@@ -145,10 +145,8 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #endif /* DEBUG */
 
 /*
- * XFS panic tags -- allow a call to xfs_cmn_err() be turned into
- *                     a panic by setting xfs_panic_mask in a
- *                     sysctl.  update xfs_max[XFS_PARAM] if
- *                     more are added.
+ * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
+ *                     a panic by setting xfs_panic_mask in a sysctl.
  */
 #define                XFS_NO_PTAG                     0
 #define                XFS_PTAG_IFLUSH                 0x00000001
index c39278b6c871e31eece57185e2e2d1b7e7d640e2..bf9ca579365cc54186b0977b819ff04ea742a1ce 100644 (file)
@@ -2940,16 +2940,16 @@ xfs_iflush_int(
 
        if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC,
                               mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                   "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p",
-                       ip->i_ino, be16_to_cpu(dip->di_magic), dip);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p",
+                       __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
                goto corrupt_out;
        }
        if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
                                mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
-                       ip->i_ino, ip, ip->i_d.di_magic);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
+                       __func__, ip->i_ino, ip, ip->i_d.di_magic);
                goto corrupt_out;
        }
        if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
@@ -2957,9 +2957,9 @@ xfs_iflush_int(
                    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
                    mp, XFS_ERRTAG_IFLUSH_3, XFS_RANDOM_IFLUSH_3)) {
-                       xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                               "xfs_iflush: Bad regular inode %Lu, ptr 0x%p",
-                               ip->i_ino, ip);
+                       xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                               "%s: Bad regular inode %Lu, ptr 0x%p",
+                               __func__, ip->i_ino, ip);
                        goto corrupt_out;
                }
        } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
@@ -2968,28 +2968,28 @@ xfs_iflush_int(
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL),
                    mp, XFS_ERRTAG_IFLUSH_4, XFS_RANDOM_IFLUSH_4)) {
-                       xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                               "xfs_iflush: Bad directory inode %Lu, ptr 0x%p",
-                               ip->i_ino, ip);
+                       xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                               "%s: Bad directory inode %Lu, ptr 0x%p",
+                               __func__, ip->i_ino, ip);
                        goto corrupt_out;
                }
        }
        if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents >
                                ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5,
                                XFS_RANDOM_IFLUSH_5)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: detected corrupt incore inode %Lu, total extents = %d, nblocks = %Ld, ptr 0x%p",
-                       ip->i_ino,
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: detected corrupt incore inode %Lu, "
+                       "total extents = %d, nblocks = %Ld, ptr 0x%p",
+                       __func__, ip->i_ino,
                        ip->i_d.di_nextents + ip->i_d.di_anextents,
-                       ip->i_d.di_nblocks,
-                       ip);
+                       ip->i_d.di_nblocks, ip);
                goto corrupt_out;
        }
        if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize,
                                mp, XFS_ERRTAG_IFLUSH_6, XFS_RANDOM_IFLUSH_6)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
-                       ip->i_ino, ip->i_d.di_forkoff, ip);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
+                       __func__, ip->i_ino, ip->i_d.di_forkoff, ip);
                goto corrupt_out;
        }
        /*
index 8a0f044750c3207eff174c4137bcd77580465894..812646fe1b3e1aba6249f35fc96d962c1412eeea 100644 (file)
@@ -105,7 +105,7 @@ xfs_cmn_err_fsblock_zero(
        xfs_inode_t     *ip,
        xfs_bmbt_irec_t *imap)
 {
-       xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount,
+       xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
                        "Access to block zero in inode %llu "
                        "start_block: %llx start_off: %llx "
                        "blkcnt: %llx extent-state: %x\n",
index ccd3adf640ee30671bc0b63b224283bab82f542a..ae6f49613412b0568f83c312d53030d91d611c20 100644 (file)
@@ -69,25 +69,20 @@ xfs_do_force_shutdown(
                return;
 
        if (flags & SHUTDOWN_CORRUPT_INCORE) {
-               xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
-    "Corruption of in-memory data detected.  Shutting down filesystem: %s",
-                       mp->m_fsname);
-               if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
+               xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
+    "Corruption of in-memory data detected.  Shutting down filesystem");
+               if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
                        xfs_stack_trace();
-               }
        } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
                if (logerror) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
-               "Log I/O Error Detected.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
+               "Log I/O Error Detected.  Shutting down filesystem");
                } else if (flags & SHUTDOWN_DEVICE_REQ) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
-               "All device paths lost.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
+               "All device paths lost.  Shutting down filesystem");
                } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
-               "I/O Error Detected.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
+               "I/O Error Detected. Shutting down filesystem");
                }
        }
        if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
index c5bbbc45db91ed97429a043ba8144cc53509a993..12aff9584e299a2d026a84f1871c669f0fdb9a4c 100644 (file)
@@ -563,7 +563,7 @@ xfs_trans_ail_delete_bulk(
 
                        spin_unlock(&ailp->xa_lock);
                        if (!XFS_FORCED_SHUTDOWN(mp)) {
-                               xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
+                               xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
                "%s: attempting to delete a log item that is not in the AIL",
                                                __func__);
                                xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
This page took 0.036767 seconds and 5 git commands to generate.