xfs: convert xfs_fs_cmn_err to new error logging API

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>
This commit is contained in:
Dave Chinner 2011-03-07 10:05:35 +11:00 committed by Dave Chinner
parent af34e09da4
commit 5348778699
13 changed files with 53 additions and 85 deletions

View file

@ -1393,8 +1393,8 @@ xfs_qm_dqpurge(
*/ */
error = xfs_qm_dqflush(dqp, SYNC_WAIT); error = xfs_qm_dqflush(dqp, SYNC_WAIT);
if (error) if (error)
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "%s: dquot %p flush failed",
"xfs_qm_dqpurge: dquot %p flush failed", dqp); __func__, dqp);
xfs_dqflock(dqp); xfs_dqflock(dqp);
} }
ASSERT(atomic_read(&dqp->q_pincount) == 0); ASSERT(atomic_read(&dqp->q_pincount) == 0);

View file

@ -136,9 +136,8 @@ xfs_qm_dquot_logitem_push(
*/ */
error = xfs_qm_dqflush(dqp, 0); error = xfs_qm_dqflush(dqp, 0);
if (error) if (error)
xfs_fs_cmn_err(CE_WARN, dqp->q_mount, xfs_warn(dqp->q_mount, "%s: push error %d on dqp %p",
"xfs_qm_dquot_logitem_push: push error %d on dqp %p", __func__, error, dqp);
error, dqp);
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
} }

View file

@ -402,14 +402,13 @@ xfs_qm_mount_quotas(
* off, but the on disk superblock doesn't know that ! * off, but the on disk superblock doesn't know that !
*/ */
ASSERT(!(XFS_IS_QUOTA_RUNNING(mp))); ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp, "%s: Superblock update failed!",
"XFS mount_quotas: Superblock update failed!"); __func__);
} }
} }
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "Failed to initialize disk quotas.");
"Failed to initialize disk quotas.");
return; return;
} }
@ -1257,7 +1256,7 @@ xfs_qm_qino_alloc(
xfs_mod_sb(tp, sbfields); xfs_mod_sb(tp, sbfields);
if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) { 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 error;
} }
return 0; return 0;
@ -1930,8 +1929,8 @@ again:
*/ */
error = xfs_qm_dqflush(dqp, 0); error = xfs_qm_dqflush(dqp, 0);
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "%s: dquot %p flush failed",
"xfs_qm_dqreclaim: dquot %p flush failed", dqp); __func__, dqp);
} }
goto dqunlock; goto dqunlock;
} }

View file

@ -44,26 +44,6 @@ cmn_err(
BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0); 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 void
assfail(char *expr, char *file, int line) assfail(char *expr, char *file, int line)
{ {

View file

@ -31,8 +31,6 @@ struct xfs_mount;
void cmn_err(const char *lvl, const char *fmt, ...) void cmn_err(const char *lvl, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3))); __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); extern void assfail(char *expr, char *f, int l);

View file

@ -6150,7 +6150,7 @@ xfs_bmap_punch_delalloc_range(
if (error) { if (error) {
/* something screwed, just bail */ /* something screwed, just bail */
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { 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.", "Failed delalloc mapping lookup ino %lld fsb %lld.",
ip->i_ino, start_fsb); ip->i_ino, start_fsb);
} }

View file

@ -270,9 +270,9 @@ xfs_swap_extents(
/* check inode formats now that data is flushed */ /* check inode formats now that data is flushed */
error = xfs_swap_extents_check_format(ip, tip); error = xfs_swap_extents_check_format(ip, tip);
if (error) { if (error) {
xfs_fs_cmn_err(CE_NOTE, mp, xfs_notice(mp,
"%s: inode 0x%llx format is incompatible for exchanging.", "%s: inode 0x%llx format is incompatible for exchanging.",
__FILE__, ip->i_ino); __func__, ip->i_ino);
goto out_unlock; goto out_unlock;
} }

View file

@ -159,7 +159,7 @@ xfs_dir_ino_validate(
XFS_AGINO_TO_INO(mp, agno, agino) == ino; XFS_AGINO_TO_INO(mp, agno, agino) == ino;
if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE, if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,
XFS_RANDOM_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); (unsigned long long) ino);
XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp); XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);

View file

@ -385,8 +385,8 @@ xfs_growfs_data_private(
XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)), XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &bp); XFS_FSS_TO_BB(mp, 1), 0, &bp);
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"error %d reading secondary superblock for ag %d", "error %d reading secondary superblock for ag %d",
error, agno); error, agno);
break; break;
} }
@ -399,7 +399,7 @@ xfs_growfs_data_private(
if (!(error = xfs_bwrite(mp, bp))) { if (!(error = xfs_bwrite(mp, bp))) {
continue; continue;
} else { } else {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"write error %d updating secondary superblock for ag %d", "write error %d updating secondary superblock for ag %d",
error, agno); error, agno);
break; /* no point in continuing */ break; /* no point in continuing */

View file

@ -1218,10 +1218,9 @@ xfs_imap_lookup(
error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
if (error) { if (error) {
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: " xfs_alert(mp,
"xfs_ialloc_read_agi() returned " "%s: xfs_ialloc_read_agi() returned error %d, agno %d",
"error %d, agno %d", __func__, error, agno);
error, agno);
return error; return error;
} }
@ -1299,24 +1298,21 @@ xfs_imap(
if (flags & XFS_IGET_UNTRUSTED) if (flags & XFS_IGET_UNTRUSTED)
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
if (agno >= mp->m_sb.sb_agcount) { if (agno >= mp->m_sb.sb_agcount) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: agno (%d) >= " "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)",
"mp->m_sb.sb_agcount (%d)", __func__, agno, mp->m_sb.sb_agcount);
agno, mp->m_sb.sb_agcount);
} }
if (agbno >= mp->m_sb.sb_agblocks) { if (agbno >= mp->m_sb.sb_agblocks) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: agbno (0x%llx) >= " "%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
"mp->m_sb.sb_agblocks (0x%lx)", __func__, (unsigned long long)agbno,
(unsigned long long) agbno, (unsigned long)mp->m_sb.sb_agblocks);
(unsigned long) mp->m_sb.sb_agblocks);
} }
if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) { if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: ino (0x%llx) != " "%s: ino (0x%llx) != XFS_AGINO_TO_INO() (0x%llx)",
"XFS_AGINO_TO_INO(mp, agno, agino) " __func__, ino,
"(0x%llx)", XFS_AGINO_TO_INO(mp, agno, agino));
ino, XFS_AGINO_TO_INO(mp, agno, agino));
} }
xfs_stack_trace(); xfs_stack_trace();
#endif /* DEBUG */ #endif /* DEBUG */
@ -1388,10 +1384,9 @@ out_map:
*/ */
if ((imap->im_blkno + imap->im_len) > if ((imap->im_blkno + imap->im_len) >
XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) { XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: " xfs_alert(mp,
"(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > " "%s: (im_blkno (0x%llx) + im_len (0x%llx)) > sb_dblocks (0x%llx)",
" XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)", __func__, (unsigned long long) imap->im_blkno,
(unsigned long long) imap->im_blkno,
(unsigned long long) imap->im_len, (unsigned long long) imap->im_len,
XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)); XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);

View file

@ -110,8 +110,8 @@ xfs_inobp_check(
dip = (xfs_dinode_t *)xfs_buf_offset(bp, dip = (xfs_dinode_t *)xfs_buf_offset(bp,
i * mp->m_sb.sb_inodesize); i * mp->m_sb.sb_inodesize);
if (!dip->di_next_unlinked) { if (!dip->di_next_unlinked) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"Detected a bogus zero next_unlinked field in incore inode buffer 0x%p. About to pop an ASSERT.", "Detected bogus zero next_unlinked field in incore inode buffer 0x%p.",
bp); bp);
ASSERT(dip->di_next_unlinked); ASSERT(dip->di_next_unlinked);
} }
@ -806,11 +806,9 @@ xfs_iread(
*/ */
if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) { if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) {
#ifdef DEBUG #ifdef DEBUG
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " xfs_alert(mp,
"dip->di_magic (0x%x) != " "%s: dip->di_magic (0x%x) != XFS_DINODE_MAGIC (0x%x)",
"XFS_DINODE_MAGIC (0x%x)", __func__, be16_to_cpu(dip->di_magic), XFS_DINODE_MAGIC);
be16_to_cpu(dip->di_magic),
XFS_DINODE_MAGIC);
#endif /* DEBUG */ #endif /* DEBUG */
error = XFS_ERROR(EINVAL); error = XFS_ERROR(EINVAL);
goto out_brelse; goto out_brelse;
@ -828,9 +826,8 @@ xfs_iread(
error = xfs_iformat(ip, dip); error = xfs_iformat(ip, dip);
if (error) { if (error) {
#ifdef DEBUG #ifdef DEBUG
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: " xfs_alert(mp, "%s: xfs_iformat() returned error %d",
"xfs_iformat() returned error %d", __func__, error);
error);
#endif /* DEBUG */ #endif /* DEBUG */
goto out_brelse; goto out_brelse;
} }

View file

@ -881,8 +881,9 @@ xfs_update_alignment(xfs_mount_t *mp)
if (mp->m_flags & XFS_MOUNT_RETERR) { if (mp->m_flags & XFS_MOUNT_RETERR) {
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)", "stripe alignment turned off: sunit(%d)/swidth(%d) "
"incompatible with agsize(%d)",
mp->m_dalign, mp->m_swidth, mp->m_dalign, mp->m_swidth,
sbp->sb_agblocks); 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); mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
} else { } else {
if (mp->m_flags & XFS_MOUNT_RETERR) { if (mp->m_flags & XFS_MOUNT_RETERR) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"stripe alignment turned off: sunit(%d) less than bsize(%d)", "stripe alignment turned off: sunit(%d) less than bsize(%d)",
mp->m_dalign, mp->m_dalign,
mp->m_blockmask +1); mp->m_blockmask +1);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
@ -1100,7 +1101,7 @@ xfs_mount_reset_sbqflags(
return 0; return 0;
#ifdef QUOTADEBUG #ifdef QUOTADEBUG
xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); xfs_notice(mp, "Writing superblock quota changes");
#endif #endif
tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
@ -1108,8 +1109,7 @@ xfs_mount_reset_sbqflags(
XFS_DEFAULT_LOG_COUNT); XFS_DEFAULT_LOG_COUNT);
if (error) { if (error) {
xfs_trans_cancel(tp, 0); xfs_trans_cancel(tp, 0);
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp, "%s: Superblock update failed!", __func__);
"xfs_mount_reset_sbqflags: Superblock update failed!");
return error; return error;
} }

View file

@ -1208,12 +1208,12 @@ xfs_inactive(
*/ */
error = xfs_bmap_finish(&tp, &free_list, &committed); error = xfs_bmap_finish(&tp, &free_list, &committed);
if (error) if (error)
xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " xfs_notice(mp, "%s: xfs_bmap_finish returned error %d",
"xfs_bmap_finish() returned error %d", error); __func__, error);
error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
if (error) if (error)
xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
"xfs_trans_commit() returned error %d", error); __func__, error);
} }
/* /*