xfs: convert xfs_fs_cmn_err to new error logging API
authorDave Chinner <dchinner@redhat.com>
Sun, 6 Mar 2011 23:05:35 +0000 (10:05 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 6 Mar 2011 23:05:35 +0000 (10:05 +1100)
Continue to clean up the error logging code by converting all the
callers of xfs_fs_cmn_err() to the new API. Once done, remove the
unused old API function.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
13 files changed:
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/quota/xfs_qm.c
fs/xfs/support/debug.c
fs/xfs/support/debug.h
fs/xfs/xfs_bmap.c
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dir2.c
fs/xfs/xfs_fsops.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_vnodeops.c

index 773adc80d6b47c4e2e39c4327bb492fc5c704ef7..e1ff7e507670487c85415125ec5d6b597f7eaa58 100644 (file)
@@ -1393,8 +1393,8 @@ xfs_qm_dqpurge(
                 */
                error = xfs_qm_dqflush(dqp, SYNC_WAIT);
                if (error)
-                       xfs_fs_cmn_err(CE_WARN, mp,
-                               "xfs_qm_dqpurge: dquot %p flush failed", dqp);
+                       xfs_warn(mp, "%s: dquot %p flush failed",
+                               __func__, dqp);
                xfs_dqflock(dqp);
        }
        ASSERT(atomic_read(&dqp->q_pincount) == 0);
index 2a1f3dc10a02dba4f401a326fd72f07bd40212af..9e0e2fa3f2c8c532157609229734329cd8a3bbee 100644 (file)
@@ -136,9 +136,8 @@ xfs_qm_dquot_logitem_push(
         */
        error = xfs_qm_dqflush(dqp, 0);
        if (error)
-               xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
-                       "xfs_qm_dquot_logitem_push: push error %d on dqp %p",
-                       error, dqp);
+               xfs_warn(dqp->q_mount, "%s: push error %d on dqp %p",
+                       __func__, error, dqp);
        xfs_dqunlock(dqp);
 }
 
index dd5cc5738a2c96935ae651693b49a271607a49bd..e34dce1ce54213c616c2ba56b294e5db31b607bb 100644 (file)
@@ -402,14 +402,13 @@ xfs_qm_mount_quotas(
                         * off, but the on disk superblock doesn't know that !
                         */
                        ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "XFS mount_quotas: Superblock update failed!");
+                       xfs_alert(mp, "%s: Superblock update failed!",
+                               __func__);
                }
        }
 
        if (error) {
-               xfs_fs_cmn_err(CE_WARN, mp,
-                       "Failed to initialize disk quotas.");
+               xfs_warn(mp, "Failed to initialize disk quotas.");
                return;
        }
 
@@ -1257,7 +1256,7 @@ xfs_qm_qino_alloc(
        xfs_mod_sb(tp, sbfields);
 
        if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "XFS qino_alloc failed!");
+               xfs_alert(mp, "%s failed (error %d)!", __func__, error);
                return error;
        }
        return 0;
@@ -1930,8 +1929,8 @@ again:
                         */
                        error = xfs_qm_dqflush(dqp, 0);
                        if (error) {
-                               xfs_fs_cmn_err(CE_WARN, mp,
-                       "xfs_qm_dqreclaim: dquot %p flush failed", dqp);
+                               xfs_warn(mp, "%s: dquot %p flush failed",
+                                       __func__, dqp);
                        }
                        goto dqunlock;
                }
index feaca739d5cccbec45e1a4f61299f8374916120f..a1c7141af481a0dad25fa541d1013e96df154ec4 100644 (file)
@@ -44,26 +44,6 @@ cmn_err(
        BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
 }
 
-void
-xfs_fs_cmn_err(
-       const char              *lvl,
-       struct xfs_mount        *mp,
-       const char              *fmt,
-       ...)
-{
-       struct va_format        vaf;
-       va_list                 args;
-
-       va_start(args, fmt);
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf);
-       va_end(args);
-
-       BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
-}
-
 void
 assfail(char *expr, char *file, int line)
 {
index eaeaa17ef4b81c8106ff07e9c241e1b0704c7e42..4a082b9a1161bf1d4bd38d6c3d8b3e7c4ebfe4e4 100644 (file)
@@ -31,8 +31,6 @@ struct xfs_mount;
 
 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)));
 
 extern void assfail(char *expr, char *f, int l);
 
index ded532dc0699b647469a62bf27b1c11e61612ac0..92612f6b4b3e099c70a3866b141917c0e1b988c4 100644 (file)
@@ -6150,7 +6150,7 @@ xfs_bmap_punch_delalloc_range(
                if (error) {
                        /* something screwed, just bail */
                        if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-                               xfs_fs_cmn_err(CE_ALERT, ip->i_mount,
+                               xfs_alert(ip->i_mount,
                        "Failed delalloc mapping lookup ino %lld fsb %lld.",
                                                ip->i_ino, start_fsb);
                        }
index e60490bc00a61b6c8bc1bfbe04df4e56e536596c..be628677c2884723c58cce77f6f98af4ff3d1926 100644 (file)
@@ -270,9 +270,9 @@ xfs_swap_extents(
        /* check inode formats now that data is flushed */
        error = xfs_swap_extents_check_format(ip, tip);
        if (error) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
+               xfs_notice(mp,
                    "%s: inode 0x%llx format is incompatible for exchanging.",
-                               __FILE__, ip->i_ino);
+                               __func__, ip->i_ino);
                goto out_unlock;
        }
 
index a1321bc7f19210a3b4bd1d87ec7c9d5eae410b28..dba7a71cedf3e6f903368416554730d9885142ad 100644 (file)
@@ -159,7 +159,7 @@ xfs_dir_ino_validate(
                XFS_AGINO_TO_INO(mp, agno, agino) == ino;
        if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,
                        XFS_RANDOM_DIR_INO_VALIDATE))) {
-               xfs_fs_cmn_err(CE_WARN, mp, "Invalid inode number 0x%Lx",
+               xfs_warn(mp, "Invalid inode number 0x%Lx",
                                (unsigned long long) ino);
                XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
                return XFS_ERROR(EFSCORRUPTED);
index 85668efb3e3e03221b5e6dd3f517ad2e38b16f94..9153d2c77caf2856ea636bb76d317f2ef1a8676e 100644 (file)
@@ -385,8 +385,8 @@ xfs_growfs_data_private(
                                  XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
                                  XFS_FSS_TO_BB(mp, 1), 0, &bp);
                if (error) {
-                       xfs_fs_cmn_err(CE_WARN, mp,
-                       "error %d reading secondary superblock for ag %d",
+                       xfs_warn(mp,
+               "error %d reading secondary superblock for ag %d",
                                error, agno);
                        break;
                }
@@ -399,7 +399,7 @@ xfs_growfs_data_private(
                if (!(error = xfs_bwrite(mp, bp))) {
                        continue;
                } else {
-                       xfs_fs_cmn_err(CE_WARN, mp,
+                       xfs_warn(mp,
                "write error %d updating secondary superblock for ag %d",
                                error, agno);
                        break; /* no point in continuing */
index 0626a32c3447a4e8ab4a3676ba5aad9e35cd1f0a..fc3a2cb2c075f50c4e67a67279a34c45e7586fce 100644 (file)
@@ -1218,10 +1218,9 @@ xfs_imap_lookup(
 
        error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
        if (error) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
-                               "xfs_ialloc_read_agi() returned "
-                               "error %d, agno %d",
-                               error, agno);
+               xfs_alert(mp,
+                       "%s: xfs_ialloc_read_agi() returned error %d, agno %d",
+                       __func__, error, agno);
                return error;
        }
 
@@ -1299,24 +1298,21 @@ xfs_imap(
                if (flags & XFS_IGET_UNTRUSTED)
                        return XFS_ERROR(EINVAL);
                if (agno >= mp->m_sb.sb_agcount) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: agno (%d) >= "
-                                       "mp->m_sb.sb_agcount (%d)",
-                                       agno,  mp->m_sb.sb_agcount);
+                       xfs_alert(mp,
+                               "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)",
+                               __func__, agno, mp->m_sb.sb_agcount);
                }
                if (agbno >= mp->m_sb.sb_agblocks) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: agbno (0x%llx) >= "
-                                       "mp->m_sb.sb_agblocks (0x%lx)",
-                                       (unsigned long long) agbno,
-                                       (unsigned long) mp->m_sb.sb_agblocks);
+                       xfs_alert(mp,
+               "%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
+                               __func__, (unsigned long long)agbno,
+                               (unsigned long)mp->m_sb.sb_agblocks);
                }
                if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: ino (0x%llx) != "
-                                       "XFS_AGINO_TO_INO(mp, agno, agino) "
-                                       "(0x%llx)",
-                                       ino, XFS_AGINO_TO_INO(mp, agno, agino));
+                       xfs_alert(mp,
+               "%s: ino (0x%llx) != XFS_AGINO_TO_INO() (0x%llx)",
+                               __func__, ino,
+                               XFS_AGINO_TO_INO(mp, agno, agino));
                }
                xfs_stack_trace();
 #endif /* DEBUG */
@@ -1388,10 +1384,9 @@ out_map:
         */
        if ((imap->im_blkno + imap->im_len) >
            XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
-                       "(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > "
-                       " XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)",
-                       (unsigned long long) imap->im_blkno,
+               xfs_alert(mp,
+       "%s: (im_blkno (0x%llx) + im_len (0x%llx)) > sb_dblocks (0x%llx)",
+                       __func__, (unsigned long long) imap->im_blkno,
                        (unsigned long long) imap->im_len,
                        XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
                return XFS_ERROR(EINVAL);
index 55169bbfc820c91d935eb7cf594149f5efb65ca2..d820ada49b18288e6e1d0f8d66528b62e66d6f99 100644 (file)
@@ -110,8 +110,8 @@ xfs_inobp_check(
                dip = (xfs_dinode_t *)xfs_buf_offset(bp,
                                        i * mp->m_sb.sb_inodesize);
                if (!dip->di_next_unlinked)  {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p.  About to pop an ASSERT.",
+                       xfs_alert(mp,
+       "Detected bogus zero next_unlinked field in incore inode buffer 0x%p.",
                                bp);
                        ASSERT(dip->di_next_unlinked);
                }
@@ -806,11 +806,9 @@ xfs_iread(
         */
        if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) {
 #ifdef DEBUG
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
-                               "dip->di_magic (0x%x) != "
-                               "XFS_DINODE_MAGIC (0x%x)",
-                               be16_to_cpu(dip->di_magic),
-                               XFS_DINODE_MAGIC);
+               xfs_alert(mp,
+                       "%s: dip->di_magic (0x%x) != XFS_DINODE_MAGIC (0x%x)",
+                       __func__, be16_to_cpu(dip->di_magic), XFS_DINODE_MAGIC);
 #endif /* DEBUG */
                error = XFS_ERROR(EINVAL);
                goto out_brelse;
@@ -828,9 +826,8 @@ xfs_iread(
                error = xfs_iformat(ip, dip);
                if (error)  {
 #ifdef DEBUG
-                       xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
-                                       "xfs_iformat() returned error %d",
-                                       error);
+                       xfs_alert(mp, "%s: xfs_iformat() returned error %d",
+                               __func__, error);
 #endif /* DEBUG */
                        goto out_brelse;
                }
index 1b43ad3d6ddb17ad26dcf84bc341c7cb43368c90..e39b082eb04909ea1f2848e381912b557b6875c5 100644 (file)
@@ -881,8 +881,9 @@ xfs_update_alignment(xfs_mount_t *mp)
                                if (mp->m_flags & XFS_MOUNT_RETERR) {
                                        return XFS_ERROR(EINVAL);
                                }
-                               xfs_fs_cmn_err(CE_WARN, mp,
-"stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)",
+                               xfs_warn(mp,
+               "stripe alignment turned off: sunit(%d)/swidth(%d) "
+               "incompatible with agsize(%d)",
                                        mp->m_dalign, mp->m_swidth,
                                        sbp->sb_agblocks);
 
@@ -892,9 +893,9 @@ xfs_update_alignment(xfs_mount_t *mp)
                                mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
                        } else {
                                if (mp->m_flags & XFS_MOUNT_RETERR) {
-                                       xfs_fs_cmn_err(CE_WARN, mp,
-"stripe alignment turned off: sunit(%d) less than bsize(%d)",
-                                               mp->m_dalign,
+                                       xfs_warn(mp,
+               "stripe alignment turned off: sunit(%d) less than bsize(%d)",
+                                               mp->m_dalign,
                                                mp->m_blockmask +1);
                                        return XFS_ERROR(EINVAL);
                                }
@@ -1100,7 +1101,7 @@ xfs_mount_reset_sbqflags(
                return 0;
 
 #ifdef QUOTADEBUG
-       xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
+       xfs_notice(mp, "Writing superblock quota changes");
 #endif
 
        tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
@@ -1108,8 +1109,7 @@ xfs_mount_reset_sbqflags(
                                      XFS_DEFAULT_LOG_COUNT);
        if (error) {
                xfs_trans_cancel(tp, 0);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_mount_reset_sbqflags: Superblock update failed!");
+               xfs_alert(mp, "%s: Superblock update failed!", __func__);
                return error;
        }
 
index 258d4f98eb9bb0fe179eec67d36f143368e59bad..e919ae1e9c659947a52fc90a662bd55177c1d68e 100644 (file)
@@ -1208,12 +1208,12 @@ xfs_inactive(
                 */
                error = xfs_bmap_finish(&tp,  &free_list, &committed);
                if (error)
-                       xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
-                               "xfs_bmap_finish() returned error %d", error);
+                       xfs_notice(mp, "%s: xfs_bmap_finish returned error %d",
+                               __func__, error);
                error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
                if (error)
-                       xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
-                               "xfs_trans_commit() returned error %d", error);
+                       xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
+                               __func__, error);
        }
 
        /*