Commit a0fa2b67 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: Convert xlog_warn to new logging interface

Convert the xfs log operations to use the new error logging
interfaces. This removes the xlog_{warn,panic} wrappers and makes
almost all errors emit the device they belong to instead of just
refering to "XFS".
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 4f10700a
...@@ -544,9 +544,10 @@ xfs_qm_dqtobp( ...@@ -544,9 +544,10 @@ xfs_qm_dqtobp(
/* /*
* A simple sanity check in case we got a corrupted dquot... * A simple sanity check in case we got a corrupted dquot...
*/ */
if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES, error = xfs_qm_dqcheck(mp, ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,
flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN),
"dqtobp")) { "dqtobp");
if (error) {
if (!(flags & XFS_QMOPT_DQREPAIR)) { if (!(flags & XFS_QMOPT_DQREPAIR)) {
xfs_trans_brelse(tp, bp); xfs_trans_brelse(tp, bp);
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
...@@ -1207,8 +1208,9 @@ xfs_qm_dqflush( ...@@ -1207,8 +1208,9 @@ xfs_qm_dqflush(
/* /*
* A simple sanity check in case we got a corrupted dquot.. * A simple sanity check in case we got a corrupted dquot..
*/ */
if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id), 0, error = xfs_qm_dqcheck(mp, &dqp->q_core, be32_to_cpu(ddqp->d_id), 0,
XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { XFS_QMOPT_DOWARN, "dqflush (incore copy)");
if (error) {
xfs_buf_relse(bp); xfs_buf_relse(bp);
xfs_dqfunlock(dqp); xfs_dqfunlock(dqp);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
......
...@@ -1292,7 +1292,7 @@ xfs_qm_reset_dqcounts( ...@@ -1292,7 +1292,7 @@ xfs_qm_reset_dqcounts(
* output any warnings because it's perfectly possible to * output any warnings because it's perfectly possible to
* find uninitialised dquot blks. See comment in xfs_qm_dqcheck. * find uninitialised dquot blks. See comment in xfs_qm_dqcheck.
*/ */
(void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, (void) xfs_qm_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
"xfs_quotacheck"); "xfs_quotacheck");
ddq->d_bcount = 0; ddq->d_bcount = 0;
ddq->d_icount = 0; ddq->d_icount = 0;
......
...@@ -374,11 +374,10 @@ xfs_log_mount( ...@@ -374,11 +374,10 @@ xfs_log_mount(
int error; int error;
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname); xfs_notice(mp, "Mounting Filesystem");
else { else {
cmn_err(CE_NOTE, xfs_notice(mp,
"Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.", "Mounting filesystem in no-recovery mode. Filesystem will be inconsistent.");
mp->m_fsname);
ASSERT(mp->m_flags & XFS_MOUNT_RDONLY); ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
} }
...@@ -393,7 +392,7 @@ xfs_log_mount( ...@@ -393,7 +392,7 @@ xfs_log_mount(
*/ */
error = xfs_trans_ail_init(mp); error = xfs_trans_ail_init(mp);
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); xfs_warn(mp, "AIL initialisation failed: error %d", error);
goto out_free_log; goto out_free_log;
} }
mp->m_log->l_ailp = mp->m_ail; mp->m_log->l_ailp = mp->m_ail;
...@@ -413,7 +412,8 @@ xfs_log_mount( ...@@ -413,7 +412,8 @@ xfs_log_mount(
if (readonly) if (readonly)
mp->m_flags |= XFS_MOUNT_RDONLY; mp->m_flags |= XFS_MOUNT_RDONLY;
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); xfs_warn(mp, "log mount/recovery failed: error %d",
error);
goto out_destroy_ail; goto out_destroy_ail;
} }
} }
...@@ -542,10 +542,8 @@ xfs_log_unmount_write(xfs_mount_t *mp) ...@@ -542,10 +542,8 @@ xfs_log_unmount_write(xfs_mount_t *mp)
*/ */
} }
if (error) { if (error)
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp, "%s: unmount record failed", __func__);
"xfs_log_unmount: unmount record failed");
}
spin_lock(&log->l_icloglock); spin_lock(&log->l_icloglock);
...@@ -852,7 +850,7 @@ xlog_space_left( ...@@ -852,7 +850,7 @@ xlog_space_left(
* In this case we just want to return the size of the * In this case we just want to return the size of the
* log as the amount of space left. * log as the amount of space left.
*/ */
xfs_fs_cmn_err(CE_ALERT, log->l_mp, xfs_alert(log->l_mp,
"xlog_space_left: head behind tail\n" "xlog_space_left: head behind tail\n"
" tail_cycle = %d, tail_bytes = %d\n" " tail_cycle = %d, tail_bytes = %d\n"
" GH cycle = %d, GH bytes = %d", " GH cycle = %d, GH bytes = %d",
...@@ -1001,7 +999,7 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1001,7 +999,7 @@ xlog_alloc_log(xfs_mount_t *mp,
log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL);
if (!log) { if (!log) {
xlog_warn("XFS: Log allocation failed: No memory!"); xfs_warn(mp, "Log allocation failed: No memory!");
goto out; goto out;
} }
...@@ -1029,24 +1027,24 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1029,24 +1027,24 @@ xlog_alloc_log(xfs_mount_t *mp,
if (xfs_sb_version_hassector(&mp->m_sb)) { if (xfs_sb_version_hassector(&mp->m_sb)) {
log2_size = mp->m_sb.sb_logsectlog; log2_size = mp->m_sb.sb_logsectlog;
if (log2_size < BBSHIFT) { if (log2_size < BBSHIFT) {
xlog_warn("XFS: Log sector size too small " xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)",
"(0x%x < 0x%x)", log2_size, BBSHIFT); log2_size, BBSHIFT);
goto out_free_log; goto out_free_log;
} }
log2_size -= BBSHIFT; log2_size -= BBSHIFT;
if (log2_size > mp->m_sectbb_log) { if (log2_size > mp->m_sectbb_log) {
xlog_warn("XFS: Log sector size too large " xfs_warn(mp, "Log sector size too large (0x%x > 0x%x)",
"(0x%x > 0x%x)", log2_size, mp->m_sectbb_log); log2_size, mp->m_sectbb_log);
goto out_free_log; goto out_free_log;
} }
/* for larger sector sizes, must have v2 or external log */ /* for larger sector sizes, must have v2 or external log */
if (log2_size && log->l_logBBstart > 0 && if (log2_size && log->l_logBBstart > 0 &&
!xfs_sb_version_haslogv2(&mp->m_sb)) { !xfs_sb_version_haslogv2(&mp->m_sb)) {
xfs_warn(mp,
xlog_warn("XFS: log sector size (0x%x) invalid " "log sector size (0x%x) invalid for configuration.",
"for configuration.", log2_size); log2_size);
goto out_free_log; goto out_free_log;
} }
} }
...@@ -1563,7 +1561,7 @@ xlog_print_tic_res( ...@@ -1563,7 +1561,7 @@ xlog_print_tic_res(
"SWAPEXT" "SWAPEXT"
}; };
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"xfs_log_write: reservation summary:\n" "xfs_log_write: reservation summary:\n"
" trans type = %s (%u)\n" " trans type = %s (%u)\n"
" unit res = %d bytes\n" " unit res = %d bytes\n"
...@@ -1586,15 +1584,13 @@ xlog_print_tic_res( ...@@ -1586,15 +1584,13 @@ xlog_print_tic_res(
for (i = 0; i < ticket->t_res_num; i++) { for (i = 0; i < ticket->t_res_num; i++) {
uint r_type = ticket->t_res_arr[i].r_type; uint r_type = ticket->t_res_arr[i].r_type;
cmn_err(CE_WARN, xfs_warn(mp, "region[%u]: %s - %u bytes\n", i,
"region[%u]: %s - %u bytes\n",
i,
((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ? ((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ?
"bad-rtype" : res_type_str[r_type-1]), "bad-rtype" : res_type_str[r_type-1]),
ticket->t_res_arr[i].r_len); ticket->t_res_arr[i].r_len);
} }
xfs_cmn_err(XFS_PTAG_LOGRES, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_LOGRES,
"xfs_log_write: reservation ran out. Need to up reservation"); "xfs_log_write: reservation ran out. Need to up reservation");
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
} }
...@@ -1682,7 +1678,7 @@ xlog_write_setup_ophdr( ...@@ -1682,7 +1678,7 @@ xlog_write_setup_ophdr(
case XFS_LOG: case XFS_LOG:
break; break;
default: default:
xfs_fs_cmn_err(CE_WARN, log->l_mp, xfs_warn(log->l_mp,
"Bad XFS transaction clientid 0x%x in ticket 0x%p", "Bad XFS transaction clientid 0x%x in ticket 0x%p",
ophdr->oh_clientid, ticket); ophdr->oh_clientid, ticket);
return NULL; return NULL;
...@@ -2264,7 +2260,7 @@ xlog_state_do_callback( ...@@ -2264,7 +2260,7 @@ xlog_state_do_callback(
if (repeats > 5000) { if (repeats > 5000) {
flushcnt += repeats; flushcnt += repeats;
repeats = 0; repeats = 0;
xfs_fs_cmn_err(CE_WARN, log->l_mp, xfs_warn(log->l_mp,
"%s: possible infinite loop (%d iterations)", "%s: possible infinite loop (%d iterations)",
__func__, flushcnt); __func__, flushcnt);
} }
...@@ -3052,10 +3048,8 @@ xfs_log_force( ...@@ -3052,10 +3048,8 @@ xfs_log_force(
int error; int error;
error = _xfs_log_force(mp, flags, NULL); error = _xfs_log_force(mp, flags, NULL);
if (error) { if (error)
xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: " xfs_warn(mp, "%s: error %d returned.", __func__, error);
"error %d returned.", error);
}
} }
/* /*
...@@ -3204,10 +3198,8 @@ xfs_log_force_lsn( ...@@ -3204,10 +3198,8 @@ xfs_log_force_lsn(
int error; int error;
error = _xfs_log_force_lsn(mp, lsn, flags, NULL); error = _xfs_log_force_lsn(mp, lsn, flags, NULL);
if (error) { if (error)
xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: " xfs_warn(mp, "%s: error %d returned.", __func__, error);
"error %d returned.", error);
}
} }
/* /*
...@@ -3412,7 +3404,7 @@ xlog_verify_dest_ptr( ...@@ -3412,7 +3404,7 @@ xlog_verify_dest_ptr(
} }
if (!good_ptr) if (!good_ptr)
xlog_panic("xlog_verify_dest_ptr: invalid ptr"); xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
} }
STATIC void STATIC void
...@@ -3448,16 +3440,16 @@ xlog_verify_tail_lsn(xlog_t *log, ...@@ -3448,16 +3440,16 @@ xlog_verify_tail_lsn(xlog_t *log,
blocks = blocks =
log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn)); log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));
if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize)) if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))
xlog_panic("xlog_verify_tail_lsn: ran out of log space"); xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
} else { } else {
ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle); ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);
if (BLOCK_LSN(tail_lsn) == log->l_prev_block) if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
xlog_panic("xlog_verify_tail_lsn: tail wrapped"); xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block; blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
if (blocks < BTOBB(iclog->ic_offset) + 1) if (blocks < BTOBB(iclog->ic_offset) + 1)
xlog_panic("xlog_verify_tail_lsn: ran out of log space"); xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
} }
} /* xlog_verify_tail_lsn */ } /* xlog_verify_tail_lsn */
...@@ -3497,22 +3489,23 @@ xlog_verify_iclog(xlog_t *log, ...@@ -3497,22 +3489,23 @@ xlog_verify_iclog(xlog_t *log,
icptr = log->l_iclog; icptr = log->l_iclog;
for (i=0; i < log->l_iclog_bufs; i++) { for (i=0; i < log->l_iclog_bufs; i++) {
if (icptr == NULL) if (icptr == NULL)
xlog_panic("xlog_verify_iclog: invalid ptr"); xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
icptr = icptr->ic_next; icptr = icptr->ic_next;
} }
if (icptr != log->l_iclog) if (icptr != log->l_iclog)
xlog_panic("xlog_verify_iclog: corrupt iclog ring"); xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
spin_unlock(&log->l_icloglock); spin_unlock(&log->l_icloglock);
/* check log magic numbers */ /* check log magic numbers */
if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM) if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM)
xlog_panic("xlog_verify_iclog: invalid magic num"); xfs_emerg(log->l_mp, "%s: invalid magic num", __func__);
ptr = (xfs_caddr_t) &iclog->ic_header; ptr = (xfs_caddr_t) &iclog->ic_header;
for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count;
ptr += BBSIZE) { ptr += BBSIZE) {
if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM) if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
xlog_panic("xlog_verify_iclog: unexpected magic num"); xfs_emerg(log->l_mp, "%s: unexpected magic num",
__func__);
} }
/* check fields */ /* check fields */
...@@ -3542,9 +3535,10 @@ xlog_verify_iclog(xlog_t *log, ...@@ -3542,9 +3535,10 @@ xlog_verify_iclog(xlog_t *log,
} }
} }
if (clientid != XFS_TRANSACTION && clientid != XFS_LOG) if (clientid != XFS_TRANSACTION && clientid != XFS_LOG)
cmn_err(CE_WARN, "xlog_verify_iclog: " xfs_warn(log->l_mp,
"invalid clientid %d op 0x%p offset 0x%lx", "%s: invalid clientid %d op 0x%p offset 0x%lx",
clientid, ophead, (unsigned long)field_offset); __func__, clientid, ophead,
(unsigned long)field_offset);
/* check length */ /* check length */
field_offset = (__psint_t) field_offset = (__psint_t)
......
...@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i) ...@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i)
return be32_to_cpu(i) >> 24; return be32_to_cpu(i) >> 24;
} }
#define xlog_panic(args...) cmn_err(CE_PANIC, ## args)
#define xlog_exit(args...) cmn_err(CE_PANIC, ## args)
#define xlog_warn(args...) cmn_err(CE_WARN, ## args)
/* /*
* In core log state * In core log state
*/ */
......
This diff is collapsed.
...@@ -382,7 +382,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags) ...@@ -382,7 +382,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags)
xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \ xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \
f | XFS_QMOPT_RES_REGBLKS) f | XFS_QMOPT_RES_REGBLKS)
extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
xfs_dqid_t, uint, uint, char *);
extern int xfs_mount_reset_sbqflags(struct xfs_mount *); extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment