Skip to content

Commit

Permalink
xfs: convert xfs_fs_cmn_err to new error logging API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Chinner authored and Dave Chinner committed Mar 6, 2011
1 parent af34e09 commit 5348778
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 85 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/quota/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
13 changes: 6 additions & 7 deletions fs/xfs/quota/xfs_qm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1930,8 +1929,8 @@ xfs_qm_dqreclaim_one(void)
*/
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;
}
Expand Down
20 changes: 0 additions & 20 deletions fs/xfs/support/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 0 additions & 2 deletions fs/xfs/support/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_dir2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/xfs_fsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 */
Expand Down
39 changes: 17 additions & 22 deletions fs/xfs/xfs_ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -1388,10 +1384,9 @@ xfs_imap(
*/
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);
Expand Down
17 changes: 7 additions & 10 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
16 changes: 8 additions & 8 deletions fs/xfs/xfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down Expand Up @@ -1100,16 +1101,15 @@ 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);
error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
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;
}

Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit 5348778

Please sign in to comment.