mirror of https://gitee.com/openkylin/linux.git
xfs: convert xfs_cmn_err to xfs_alert_tag
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>
This commit is contained in:
parent
a0fa2b679e
commit
6a19d9393a
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue