xfs: rework error logging infrastructure
PATCH 4/12 xfs: Convert xlog_warn to new logging interface
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
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".
--- fs/xfs/quota/xfs_dquot.c | 10 ++- fs/xfs/quota/xfs_qm.c | 2 +- fs/xfs/xfs_log.c | 124 ++++++++++++------------- fs/xfs/xfs_log_priv.h | 4 - fs/xfs/xfs_log_recover.c | 223 ++++++++++++++++++++++----------------------- fs/xfs/xfs_quota.h | 3 +- 6 files changed, 177 insertions(+), 189 deletions(-)
fs/xfs/quota/xfs_dquot.c +6 -4
@@ -544,9 +544,10 @@ xfs_qm_dqtobp(/* * 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 ), -"dqtobp" )) { +"dqtobp" ); +if (error) {if (!(flags &XFS_QMOPT_DQREPAIR )) {xfs_trans_brelse (tp, bp);return XFS_ERROR (EIO );
@@ -1207,8 +1208,9 @@ xfs_qm_dqflush(/* * 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 , -XFS_QMOPT_DOWARN ,"dqflush (incore copy)" )) { + error =xfs_qm_dqcheck (mp, &dqp->q_core,be32_to_cpu (ddqp->d_id),0 , +XFS_QMOPT_DOWARN ,"dqflush (incore copy)" ); +if (error) {xfs_buf_relse (bp);xfs_dqfunlock (dqp);xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE );
fs/xfs/quota/xfs_qm.c +1 -1
@@ -1299,7 +1299,7 @@ xfs_qm_reset_dqcounts(* output any warnings because it's perfectly possible to * 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" ); ddq->d_bcount =0 ; ddq->d_icount =0 ;
fs/xfs/xfs_log.c +59 -65
258 lines not on this page · raw message
fs/xfs/xfs_log_priv.h +0 -4
@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i)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 */
fs/xfs/xfs_log_recover.c +109 -114
563 lines not on this page · raw message
fs/xfs/xfs_quota.h +2 -1
@@ -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, \ 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 *);#endif /* __KERNEL__ */
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/12 xfs: convert the quota debug prints to new API
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- fs/xfs/quota/xfs_qm_syscalls.c | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 deletions(-)
fs/xfs/quota/xfs_qm_syscalls.c +12 -15
@@ -41,12 +41,6 @@#include "xfs_qm.h" #include "xfs_trace.h" -#ifdef DEBUG -# define qdprintk(s, args...) cmn_err(CE_DEBUG, s, ## args) -#else -# define qdprintk(s, args...) do { } while (0) -#endif - STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,uint );
@@ -294,7 +288,8 @@ xfs_qm_scall_trunc_qfiles(int error =0 , error2 =0 ;if (!xfs_sb_version_hasquota (&mp->m_sb) || flags ==0 ) { -qdprintk ("qtrunc flags=%x m_qflags=%x\n" , flags, mp->m_qflags); +xfs_debug (mp,"%s: flags=%x m_qflags=%x\n" , + __func__, flags, mp->m_qflags);return XFS_ERROR (EINVAL ); }
@@ -331,7 +326,8 @@ xfs_qm_scall_quotaon( sbflags =0 ;if (flags ==0 ) { -qdprintk ("quotaon: zero flags, m_qflags=%x\n" , mp->m_qflags); +xfs_debug (mp,"%s: zero flags, m_qflags=%x\n" , + __func__, mp->m_qflags);return XFS_ERROR (EINVAL ); }
@@ -352,8 +348,9 @@ xfs_qm_scall_quotaon( (flags & XFS_GQUOTA_ACCT) == 0 && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && (flags & XFS_OQUOTA_ENFD))) { -qdprintk ("Can't enforce without acct, flags=%x sbflags=%x\n" , - flags, mp->m_sb.sb_qflags); +xfs_debug (mp, +"%s: Can't enforce without acct, flags=%x sbflags=%x\n" , + __func__, flags, mp->m_sb.sb_qflags);return XFS_ERROR (EINVAL ); }/*
@@ -541,7 +538,7 @@ xfs_qm_scall_setqlim( q->qi_bsoftlimit = soft; } }else { -qdprintk ("blkhard %Ld < blksoft %Ld\n" , hard, soft); +xfs_debug (mp,"blkhard %Ld < blksoft %Ld\n" , hard, soft); } hard = (newlim->d_fieldmask &FS_DQ_RTBHARD ) ? (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
@@ -557,7 +554,7 @@ xfs_qm_scall_setqlim( q->qi_rtbsoftlimit = soft; } }else { -qdprintk ("rtbhard %Ld < rtbsoft %Ld\n" , hard, soft); +xfs_debug (mp,"rtbhard %Ld < rtbsoft %Ld\n" , hard, soft); } hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
@@ -574,7 +571,7 @@ xfs_qm_scall_setqlim( q->qi_isoftlimit = soft; } }else { -qdprintk ("ihard %Ld < isoft %Ld\n" , hard, soft); +xfs_debug (mp,"ihard %Ld < isoft %Ld\n" , hard, soft); }/*
@@ -1137,8 +1134,8 @@ xfs_qm_internalqcheck_adjust(if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { *res =BULKSTAT_RV_NOTHING ; -qdprintk ("internalqcheck: ino=%llu, uqino=%llu, gqino=%llu\n" , - (unsigned long long ) ino, +xfs_debug (mp,"%s: ino=%llu, uqino=%llu, gqino=%llu\n" , + __func__, (unsigned long long ) ino, (unsigned long long ) mp->m_sb.sb_uquotino, (unsigned long long ) mp->m_sb.sb_gquotino);return XFS_ERROR (EINVAL );
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/12 xfs: introduce new logging API.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Most of the logging infrastructurein XFS is unneccessary and designed around the infrastructure supplied by Irix rather than Linux. To start rationalising all the logging interfaces, start by introducing simple printk wrappers similar to the dev_printk() infrastructure. later patches will convert code to use this new interface.
--- fs/xfs/Makefile | 1 + fs/xfs/linux-2.6/xfs_linux.h | 1 + fs/xfs/linux-2.6/xfs_printk.c | 119 +++++++++++++++++++++++++++++++++++++++++ fs/xfs/linux-2.6/xfs_printk.h | 34 ++++++++++++ 4 files changed, 155 insertions(+), 0 deletions(-) create mode 100644 fs/xfs/linux-2.6/xfs_printk.c create mode 100644 fs/xfs/linux-2.6/xfs_printk.h
fs/xfs/Makefile +1 -0
@@ -104,6 +104,7 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \ xfs_globals.o \ xfs_ioctl.o \ xfs_iops.o \ + xfs_printk.o \ xfs_super.o \ xfs_sync.o \ xfs_xattr.o)
fs/xfs/linux-2.6/xfs_linux.h +1 -0
@@ -86,6 +86,7 @@#include <xfs_aops.h> #include <xfs_super.h> #include <xfs_buf.h> +#include <xfs_printk.h> /* * Feature macros (disable/enable)
fs/xfs/linux-2.6/xfs_printk.c new file +119 -0
119 lines not on this page · raw message
fs/xfs/linux-2.6/xfs_printk.h new file +34 -0
@@ -0,0 +1,34 @@ +#ifndef __XFS_PRINTK_H +#define __XFS_PRINTK_H 1 + +struct xfs_mount ; + +extern int xfs_printk (const char *level,const struct xfs_mount *mp, +const char *fmt, ...) + __attribute__ ((format (printf,3 ,4 ))); +extern int xfs_emerg (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_alert (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_alert_tag (const struct xfs_mount *mp,int tag, +const char *fmt, ...) + __attribute__ ((format (printf,3 ,4 ))); +extern int xfs_crit (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_err (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_warn (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_notice (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +extern int xfs_info (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); + +#ifdef DEBUG +extern int xfs_debug (const struct xfs_mount *mp,const char *fmt, ...) + __attribute__ ((format (printf,2 ,3 ))); +#else +#define xfs_debug (mp, fmt, ...) (0) +#endif + +#endif /* __XFS_PRINTK_H */
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/12 xfs: convert xfs_fs_cmn_err to new error logging API
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
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.
--- fs/xfs/quota/xfs_dquot.c | 4 ++-- fs/xfs/quota/xfs_dquot_item.c | 5 ++--- fs/xfs/quota/xfs_qm.c | 13 ++++++------- fs/xfs/support/debug.c | 20 -------------------- fs/xfs/support/debug.h | 2 -- fs/xfs/xfs_bmap.c | 2 +- fs/xfs/xfs_dfrag.c | 4 ++-- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_fsops.c | 6 +++--- fs/xfs/xfs_ialloc.c | 39 +++++++++++++++++---------------------- fs/xfs/xfs_inode.c | 17 +++++++---------- fs/xfs/xfs_mount.c | 16 ++++++++-------- fs/xfs/xfs_vnodeops.c | 8 ++++---- 13 files changed, 53 insertions(+), 85 deletions(-)
fs/xfs/quota/xfs_dquot.c +2 -2
@@ -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 );
fs/xfs/quota/xfs_dquot_item.c +2 -3
@@ -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); }
fs/xfs/quota/xfs_qm.c +6 -7
@@ -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 ; }
@@ -1264,7 +1263,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 ;
@@ -1941,8 +1940,8 @@ startagain:*/ 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); }xfs_dqunlock (dqp);/* dqflush unlocks dqflock */ continue ;
fs/xfs/support/debug.c +0 -20
@@ -45,26 +45,6 @@ cmn_err( }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) {printk ("Assertion failed: %s, file: %s, line: %d\n" , expr, file, line);
fs/xfs/support/debug.h +0 -2
@@ -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);
fs/xfs/xfs_bmap.c +1 -1
@@ -6114,7 +6114,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); }
fs/xfs/xfs_dfrag.c +2 -2
@@ -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; }
fs/xfs/xfs_dir2.c +1 -1
@@ -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 );
fs/xfs/xfs_fsops.c +3 -3
@@ -382,8 +382,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 ; }
@@ -396,7 +396,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 */
fs/xfs/xfs_ialloc.c +17 -22
@@ -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 );
fs/xfs/xfs_inode.c +7 -10
@@ -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; }
fs/xfs/xfs_mount.c +8 -8
@@ -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; }
fs/xfs/xfs_vnodeops.c +4 -4
@@ -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); }/*
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/12 xfs: kill support/debug.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remaining functionality in debug.[ch] is effectively just assert handling, conditional debug definitions and hex dumping. The hex dumping and assert function can be moved into the new printk module, while the rest can be moved into top-level header files. This allows fs/xfs/support/debug.[ch] to be completely removed from the codebase.
--- fs/xfs/Makefile | 1 - fs/xfs/linux-2.6/xfs_linux.h | 21 +++++++++++++++++++ fs/xfs/linux-2.6/xfs_printk.c | 14 ++++++++++++ fs/xfs/linux-2.6/xfs_printk.h | 4 +++ fs/xfs/support/debug.c | 32 ----------------------------- fs/xfs/support/debug.h | 45 ----------------------------------------- fs/xfs/xfs_error.h | 4 --- 7 files changed, 39 insertions(+), 82 deletions(-) delete mode 100644 fs/xfs/support/debug.c delete mode 100644 fs/xfs/support/debug.h
fs/xfs/Makefile +0 -1
@@ -111,5 +111,4 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \ # Objects in support/ xfs-y += $(addprefix support/, \ - debug.o \ uuid.o)
fs/xfs/linux-2.6/xfs_linux.h +21 -0
@@ -281,4 +281,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)#define __arch_pack#endif +#define ASSERT_ALWAYS (expr) \ + (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) + +#ifndef DEBUG +#define ASSERT (expr) ((void)0) + +#ifndef STATIC +# define STATIC static noinline +#endif + +#else /* DEBUG */ + +#define ASSERT (expr) \ + (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) + +#ifndef STATIC +# define STATIC noinline +#endif + +#endif /* DEBUG */ +#endif /* __XFS_LINUX__ */
fs/xfs/linux-2.6/xfs_printk.c +14 -0
@@ -117,3 +117,17 @@ xfs_alert_tag(return r; } + +void +assfail (char *expr,char *file,int line) +{ +xfs_emerg (NULL ,"Assertion failed: %s, file: %s, line: %d" , + expr, file, line); +BUG (); +} + +void +xfs_hex_dump (void *p,int length) +{ +print_hex_dump (KERN_ALERT ,"" ,DUMP_PREFIX_ADDRESS ,16 ,1 , p, length,1 ); +}
fs/xfs/linux-2.6/xfs_printk.h +4 -0
@@ -31,4 +31,8 @@ extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)#define xfs_debug (mp, fmt, ...) (0)#endif +extern void assfail (char *expr,char *f,int l); + +extern void xfs_hex_dump (void *p,int length); +#endif /* __XFS_PRINTK_H */
fs/xfs/support/debug.c deleted +0 -32
@@ -1,32 +0,0 @@ -/* -* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. -* All Rights Reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include <xfs.h> -#include "debug.h" - -void -assfail (char *expr,char *file,int line) -{ -printk ("Assertion failed: %s, file: %s, line: %d\n" , expr, file, line); -BUG (); -} - -void -xfs_hex_dump (void *p,int length) -{ -print_hex_dump (KERN_ALERT ,"" ,DUMP_PREFIX_ADDRESS ,16 ,1 , p, length,1 ); -}
fs/xfs/support/debug.h deleted +0 -45
45 lines not on this page · raw message
fs/xfs/xfs_error.h +0 -4
@@ -158,8 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040#define XFS_PTAG_FSBLOCK_ZERO 0x00000080 -struct xfs_mount ; - -extern void xfs_hex_dump (void *p,int length); -#endif /* __XFS_ERROR_H__ */
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/12 xfs: Convert remaining cmn_err() callers to new API
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Once converted, kill the remainder of the cmn_err() interface.
--- fs/xfs/quota/xfs_dquot.c | 34 ++++++++++++---------- fs/xfs/quota/xfs_qm.c | 27 ++++++++---------- fs/xfs/quota/xfs_qm_bhv.c | 3 +- fs/xfs/quota/xfs_qm_syscalls.c | 58 ++++++++++++++++++++------------------ fs/xfs/quota/xfs_trans_dquot.c | 5 ++- fs/xfs/support/debug.c | 26 ----------------- fs/xfs/support/debug.h | 12 -------- fs/xfs/xfs_bmap.c | 6 ++-- fs/xfs/xfs_buf_item.c | 15 +++++---- fs/xfs/xfs_da_btree.c | 9 ++--- fs/xfs/xfs_dir2_node.c | 25 ++++++---------- fs/xfs/xfs_error.c | 16 ++++------ fs/xfs/xfs_ialloc.c | 43 +++++++++++----------------- fs/xfs/xfs_inode.c | 30 ++++++++----------- fs/xfs/xfs_mount.c | 60 ++++++++++++++++------------------------ fs/xfs/xfs_rtalloc.c | 8 ++-- fs/xfs/xfs_rtalloc.h | 2 +- fs/xfs/xfs_rw.c | 17 +++++------ fs/xfs/xfs_trans_buf.c | 6 ++-- fs/xfs/xfs_vnodeops.c | 5 +-- 20 files changed, 169 insertions(+), 238 deletions(-)
fs/xfs/quota/xfs_dquot.c +18 -16
@@ -828,7 +828,7 @@ xfs_qm_dqget(if (xfs_do_dqerror) {if ((xfs_dqerror_target == mp->m_ddev_targp) && (xfs_dqreq_num++ % xfs_dqerror_mod) ==0 ) { -cmn_err (CE_DEBUG ,"Returning error in dqget" ); +xfs_debug (mp,"Returning error in dqget" );return (EIO ); } }
@@ -1427,36 +1427,38 @@ xfs_qm_dqpurge(void xfs_qm_dqprint (xfs_dquot_t *dqp) { -cmn_err (CE_DEBUG ,"-----------KERNEL DQUOT----------------" ); -cmn_err (CE_DEBUG ,"---- dquotID = %d" , +struct xfs_mount *mp = dqp->q_mount; + +xfs_debug (mp,"-----------KERNEL DQUOT----------------" ); +xfs_debug (mp,"---- dquotID = %d" , (int )be32_to_cpu (dqp->q_core.d_id)); -cmn_err (CE_DEBUG ,"---- type = %s" ,DQFLAGTO_TYPESTR (dqp)); -cmn_err (CE_DEBUG ,"---- fs = 0x%p" , dqp->q_mount); -cmn_err (CE_DEBUG ,"---- blkno = 0x%x" , (int ) dqp->q_blkno); -cmn_err (CE_DEBUG ,"---- boffset = 0x%x" , (int ) dqp->q_bufoffset); -cmn_err (CE_DEBUG ,"---- blkhlimit = %Lu (0x%x)" , +xfs_debug (mp,"---- type = %s" ,DQFLAGTO_TYPESTR (dqp)); +xfs_debug (mp,"---- fs = 0x%p" , dqp->q_mount); +xfs_debug (mp,"---- blkno = 0x%x" , (int ) dqp->q_blkno); +xfs_debug (mp,"---- boffset = 0x%x" , (int ) dqp->q_bufoffset); +xfs_debug (mp,"---- blkhlimit = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_blk_hardlimit), (int )be64_to_cpu (dqp->q_core.d_blk_hardlimit)); -cmn_err (CE_DEBUG ,"---- blkslimit = %Lu (0x%x)" , +xfs_debug (mp,"---- blkslimit = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_blk_softlimit), (int )be64_to_cpu (dqp->q_core.d_blk_softlimit)); -cmn_err (CE_DEBUG ,"---- inohlimit = %Lu (0x%x)" , +xfs_debug (mp,"---- inohlimit = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_ino_hardlimit), (int )be64_to_cpu (dqp->q_core.d_ino_hardlimit)); -cmn_err (CE_DEBUG ,"---- inoslimit = %Lu (0x%x)" , +xfs_debug (mp,"---- inoslimit = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_ino_softlimit), (int )be64_to_cpu (dqp->q_core.d_ino_softlimit)); -cmn_err (CE_DEBUG ,"---- bcount = %Lu (0x%x)" , +xfs_debug (mp,"---- bcount = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_bcount), (int )be64_to_cpu (dqp->q_core.d_bcount)); -cmn_err (CE_DEBUG ,"---- icount = %Lu (0x%x)" , +xfs_debug (mp,"---- icount = %Lu (0x%x)" ,be64_to_cpu (dqp->q_core.d_icount), (int )be64_to_cpu (dqp->q_core.d_icount)); -cmn_err (CE_DEBUG ,"---- btimer = %d" , +xfs_debug (mp,"---- btimer = %d" , (int )be32_to_cpu (dqp->q_core.d_btimer)); -cmn_err (CE_DEBUG ,"---- itimer = %d" , +xfs_debug (mp,"---- itimer = %d" , (int )be32_to_cpu (dqp->q_core.d_itimer)); -cmn_err (CE_DEBUG ,"---------------------------" ); +xfs_debug (mp,"---------------------------" ); }#endif
fs/xfs/quota/xfs_qm.c +12 -15
@@ -80,7 +80,7 @@ xfs_qm_dquot_list_print(int i =0 ;list_for_each_entry (dqp, &mp->m_quotainfo->qi_dqlist_lock, qi_mplist) { - cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " + xfs_debug(mp, " %d. \"%d (%s)\" " "bcnt = %lld, icnt = %lld, refs = %d", i++, be32_to_cpu(dqp->q_core.d_id), DQFLAGTO_TYPESTR(dqp),
@@ -205,7 +205,7 @@ xfs_qm_destroy(list_for_each_entry_safe (dqp, n, &xqm->qm_dqfrlist, q_freelist) {xfs_dqlock (dqp);#ifdef QUOTADEBUG -cmn_err (CE_DEBUG ,"FREELIST destroy 0x%p" , dqp); +xfs_debug (dqp->q_mount,"FREELIST destroy 0x%p" , dqp);#endif list_del_init (&dqp->q_freelist); xfs_Gqm->qm_dqfrlist_cnt--;
@@ -341,9 +341,7 @@ xfs_qm_mount_quotas(* quotas immediately. */ if (mp->m_sb.sb_rextents) { -cmn_err (CE_NOTE , -"Cannot turn on quotas for realtime filesystem %s" , - mp->m_fsname); +xfs_notice (mp,"Cannot turn on quotas for realtime filesystem" ); mp->m_qflags =0 ; goto write_changes; }
@@ -1675,7 +1673,7 @@ xfs_qm_quotacheck(*/ ASSERT (list_empty (&mp->m_quotainfo->qi_dqlist)); -cmn_err (CE_NOTE ,"XFS quotacheck %s: Please wait." , mp->m_fsname); +xfs_notice (mp,"Quotacheck needed: Please wait." );/* * First we go thru all the dquots on disk, USR and GRP/PRJ, and reset
@@ -1753,9 +1751,9 @@ xfs_qm_quotacheck( error_return:if (error) { -cmn_err (CE_WARN ,"XFS quotacheck %s: Unsuccessful (Error %d): " -"Disabling quotas." , - mp->m_fsname, error); +xfs_warn (mp, +"Quotacheck: Unsuccessful (Error %d): Disabling quotas." , + error);/* * We must turn off quotas. */
@@ -1763,12 +1761,11 @@ xfs_qm_quotacheck(ASSERT (xfs_Gqm !=NULL );xfs_qm_destroy_quotainfo (mp);if (xfs_mount_reset_sbqflags (mp)) { -cmn_err (CE_WARN ,"XFS quotacheck %s: " -"Failed to reset quota flags." , mp->m_fsname); +xfs_warn (mp, +"Quotacheck: Failed to reset quota flags." ); } - }else { -cmn_err (CE_NOTE ,"XFS quotacheck %s: Done." , mp->m_fsname); - } + }else +xfs_notice (mp,"Quotacheck: Done." );return (error); }
@@ -2118,7 +2115,7 @@ xfs_qm_write_sb_changes(int error;#ifdef QUOTADEBUG -cmn_err (CE_NOTE ,"Writing superblock quota changes :%s" , mp->m_fsname); +xfs_notice (mp,"Writing superblock quota changes" );#endif tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SBCHANGE ); if ((error = xfs_trans_reserve(tp, 0,
fs/xfs/quota/xfs_qm_bhv.c +1 -2
@@ -119,8 +119,7 @@ xfs_qm_newmount( (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && xfs_dev_is_read_only(mp, "changing quota state")) { - cmn_err(CE_WARN, - "XFS: please mount with%s%s%s%s.", + xfs_warn(mp, "please mount with%s%s%s%s.", (!quotaondisk ? "out quota" : ""), (uquotaondisk ? " usrquota" : ""), (pquotaondisk ? " prjquota" : ""),
fs/xfs/quota/xfs_qm_syscalls.c +31 -27
116 lines not on this page · raw message
fs/xfs/quota/xfs_trans_dquot.c +3 -2
@@ -643,8 +643,9 @@ xfs_trans_dqresv( (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) && (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) {#ifdef QUOTADEBUG -cmn_err (CE_DEBUG ,"BLK Res: nblks=%ld + resbcount=%Ld" -" > hardlimit=%Ld?" , nblks, *resbcountp, hardlimit); +xfs_debug (mp, +"BLK Res: nblks=%ld + resbcount=%Ld > hardlimit=%Ld?" , + nblks, *resbcountp, hardlimit);#endif if (nblks >0 ) {/*
fs/xfs/support/debug.c +0 -26
@@ -18,32 +18,6 @@#include <xfs.h> #include "debug.h" -/* xfs_mount.h drags a lot of crap in, sorry.. */ -#include "xfs_sb.h" -#include "xfs_inum.h" -#include "xfs_ag.h" -#include "xfs_mount.h" -#include "xfs_error.h" - -void -cmn_err ( -const char *lvl, -const char *fmt, - ...) -{ -struct va_format vaf; -va_list args; - -va_start (args, fmt); - vaf.fmt = fmt; - vaf.va = &args; - -printk ("%s%pV" , lvl, &vaf); -va_end (args); - -BUG_ON (strncmp (lvl,KERN_EMERG ,strlen (KERN_EMERG )) ==0 ); -} -void assfail (char *expr,char *file,int line) {
fs/xfs/support/debug.h +0 -12
@@ -20,18 +20,6 @@#include <stdarg.h> -struct xfs_mount ; - -#define CE_DEBUG KERN_DEBUG -#define CE_CONT KERN_INFO -#define CE_NOTE KERN_NOTICE -#define CE_WARN KERN_WARNING -#define CE_ALERT KERN_ALERT -#define CE_PANIC KERN_EMERG - -void cmn_err (const char *lvl,const char *fmt, ...) - __attribute__ ((format (printf,2 ,3 ))); -extern void assfail (char *expr,char *f,int l);#define ASSERT_ALWAYS (expr) \
fs/xfs/xfs_bmap.c +3 -3
@@ -5742,7 +5742,7 @@ xfs_check_block(else thispa =XFS_BMBT_PTR_ADDR (mp, block, j, dmxr);if (*thispa == *pp) { -cmn_err (CE_WARN ,"%s: thispa(%d) == pp(%d) %Ld" , +xfs_warn (mp,"%s: thispa(%d) == pp(%d) %Ld" , __func__, j, i, (unsigned long long )be64_to_cpu (*thispa)); panic("%s: ptrs are equal in node\n",
@@ -5907,11 +5907,11 @@ xfs_bmap_check_leaf_extents(return ; error0: -cmn_err (CE_WARN ,"%s: at error0" , __func__); +xfs_warn (mp,"%s: at error0" , __func__);if (bp_release)xfs_trans_brelse (NULL , bp); error_norelse: -cmn_err (CE_WARN ,"%s: BAD after btree leaves for %d extents" , +xfs_warn (mp,"%s: BAD after btree leaves for %d extents" , __func__, i);panic ("%s: CORRUPTED BTREE OR SOMETHING" , __func__);return ;
fs/xfs/xfs_buf_item.c +8 -7
@@ -130,10 +130,12 @@ xfs_buf_item_log_check( orig = bip->bli_orig; buffer =XFS_BUF_PTR (bp);for (x =0 ; x <XFS_BUF_COUNT (bp); x++) { -if (orig[x] != buffer[x] && !btst (bip->bli_logged, x)) -cmn_err (CE_PANIC , -"xfs_buf_item_log_check bip %x buffer %x orig %x index %d" , - bip, bp, orig, x); +if (orig[x] != buffer[x] && !btst (bip->bli_logged, x)) { +xfs_emerg (bp->b_mount, +"%s: bip %x buffer %x orig %x index %d" , + __func__, bip, bp, orig, x); +ASSERT (0 ); + } } }#else
@@ -981,10 +983,9 @@ xfs_buf_iodone_callbacks(if (XFS_BUF_TARGET (bp) != lasttarg ||time_after (jiffies, (lasttime +5 *HZ ))) { lasttime = jiffies; -cmn_err (CE_ALERT ,"Device %s, XFS metadata write error" -" block 0x%llx in %s" , +xfs_alert (mp,"Device %s: metadata write error block 0x%llx" ,XFS_BUFTARG_NAME (XFS_BUF_TARGET (bp)), - (__uint64_t )XFS_BUF_ADDR (bp), mp->m_fsname); + (__uint64_t )XFS_BUF_ADDR (bp)); } lasttarg =XFS_BUF_TARGET (bp);
fs/xfs/xfs_da_btree.c +4 -5
@@ -1995,13 +1995,12 @@ xfs_da_do_buf( error = mappedbno ==-2 ?0 :XFS_ERROR (EFSCORRUPTED );if (unlikely (error ==EFSCORRUPTED )) {if (xfs_error_level >=XFS_ERRLEVEL_LOW ) { -cmn_err (CE_ALERT ,"xfs_da_do_buf: bno %lld\n" , - (long long )bno); -cmn_err (CE_ALERT ,"dir: inode %lld\n" , +xfs_alert (mp,"%s: bno %lld dir: inode %lld" , + __func__, (long long )bno, (long long )dp->i_ino);for (i =0 ; i < nmap; i++) { - cmn_err(CE_ALERT, - "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d\n", + xfs_alert(mp, +"[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d", i, (long long)mapp[i].br_startoff, (long long)mapp[i].br_startblock,
fs/xfs/xfs_dir2_node.c +10 -15
@@ -899,10 +899,9 @@ xfs_dir2_leafn_rebalance(if (blk2->index <0 ) { state->inleaf =1 ; blk2->index =0 ; -cmn_err (CE_ALERT , -"xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting original leaf: " -"blk1->index %d\n" , - blk1->index); +xfs_alert (args->dp->i_mount, +"%s: picked the wrong leaf? reverting original leaf: blk1->index %d\n" , + __func__, blk1->index); } }
@@ -1641,26 +1640,22 @@ xfs_dir2_node_addname_int( }if (unlikely (xfs_dir2_db_to_fdb (mp, dbno) != fbno)) { -cmn_err (CE_ALERT , -"xfs_dir2_node_addname_int: dir ino " -"%llu needed freesp block %lld for\n" -" data block %lld, got %lld\n" -" ifbno %llu lastfbno %d\n" , - (unsigned long long )dp->i_ino, +xfs_alert (mp, +"%s: dir ino " "%llu needed freesp block %lld for\n" +" data block %lld, got %lld ifbno %llu lastfbno %d" , + __func__, (unsigned long long )dp->i_ino, (long long )xfs_dir2_db_to_fdb (mp, dbno), (long long )dbno, (long long )fbno, (unsigned long long )ifbno, lastfbno);if (fblk) { -cmn_err (CE_ALERT , -" fblk 0x%p blkno %llu " -"index %d magic 0x%x\n" , +xfs_alert (mp, +" fblk 0x%p blkno %llu index %d magic 0x%x" , fblk, (unsigned long long )fblk->blkno, fblk->index, fblk->magic); }else { -cmn_err (CE_ALERT , -" ... fblk is NULL\n" ); +xfs_alert (mp," ... fblk is NULL" ); }XFS_ERROR_REPORT ("xfs_dir2_node_addname_int" ,XFS_ERRLEVEL_LOW , mp);
fs/xfs/xfs_error.c +7 -9
@@ -48,7 +48,7 @@ xfs_error_trap(int e)break ;if (e != xfs_etrap[i])continue ; -cmn_err (CE_NOTE ,"xfs_error_trap: error %d" , e); +xfs_notice (NULL ,"%s: error %d" , __func__, e);BUG ();break ; }
@@ -74,7 +74,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,for (i =0 ; i <XFS_NUM_INJECT_ERROR ; i++) {if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) { -cmn_err (CE_WARN , +xfs_warn (NULL ,"Injecting error (%s) at file %s, line %d, on filesystem \"%s\"" , expression, file, line, xfs_etest_fsname[i]);return 1 ;
@@ -95,14 +95,14 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)for (i =0 ; i <XFS_NUM_INJECT_ERROR ; i++) {if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) { -cmn_err (CE_WARN ,"XFS error tag #%d on" , error_tag); +xfs_warn (mp,"error tag #%d on" , error_tag);return 0 ; } }for (i =0 ; i <XFS_NUM_INJECT_ERROR ; i++) {if (xfs_etest[i] ==0 ) { -cmn_err (CE_WARN ,"Turned on XFS error tag #%d" , +xfs_warn (mp,"Turned on XFS error tag #%d" , error_tag); xfs_etest[i] = error_tag; xfs_etest_fsid[i] = fsid;
@@ -114,7 +114,7 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp) } } -cmn_err (CE_WARN ,"error tag overflow, too many turned on" ); +xfs_warn (mp,"error tag overflow, too many turned on" );return 1 ; }
@@ -133,7 +133,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)if ((fsid ==0LL || xfs_etest_fsid[i] == fsid) && xfs_etest[i] !=0 ) { cleared =1 ; -cmn_err (CE_WARN ,"Clearing XFS error tag #%d" , +xfs_warn (mp,"Clearing XFS error tag #%d" , xfs_etest[i]); xfs_etest[i] =0 ; xfs_etest_fsid[i] =0LL ;
@@ -144,9 +144,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud) }if (loud || cleared) -cmn_err (CE_WARN , -"Cleared all XFS error tags for filesystem \"%s\"" , - mp->m_fsname); +xfs_warn (mp,"Cleared all XFS error tags for filesystem" );return 0 ; }
fs/xfs/xfs_ialloc.c +17 -26
88 lines not on this page · raw message
fs/xfs/xfs_inode.c +13 -17
@@ -142,10 +142,9 @@ xfs_imap_to_bp( (int)imap->im_len, buf_flags, &bp);if (error) {if (error !=EAGAIN ) { -cmn_err (CE_WARN , -"xfs_imap_to_bp: xfs_trans_read_buf()returned " -"an error %d on %s. Returning error." , - error, mp->m_fsname); +xfs_warn (mp, +"%s: xfs_trans_read_buf() returned error %d." , + __func__, error); }else {ASSERT (buf_flags &XBF_TRYLOCK ); }
@@ -180,12 +179,11 @@ xfs_imap_to_bp(XFS_CORRUPTION_ERROR ("xfs_imap_to_bp" ,XFS_ERRLEVEL_HIGH , mp, dip);#ifdef DEBUG -cmn_err (CE_PANIC , -"Device %s - bad inode magic/vsn " -"daddr %lld #%d (magic=%x)" , -XFS_BUFTARG_NAME (mp->m_ddev_targp), +xfs_emerg (mp, +"bad inode magic/vsn daddr %lld #%d (magic=%x)" , (unsigned long long )imap->im_blkno, i,be16_to_cpu (dip->di_magic)); +ASSERT (0 );#endif xfs_trans_brelse (tp, bp);return XFS_ERROR (EFSCORRUPTED );
@@ -1810,9 +1808,8 @@ xfs_iunlink_remove(*/ error =xfs_itobp (mp, tp, ip, &dip, &ibp,XBF_LOCK );if (error) { -cmn_err (CE_WARN , -"xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error." , - error, mp->m_fsname); +xfs_warn (mp,"%s: xfs_itobp() returned error %d." , + __func__, error);return error; } next_agino =be32_to_cpu (dip->di_next_unlinked);
@@ -1857,9 +1854,9 @@ xfs_iunlink_remove( error =xfs_inotobp (mp, tp, next_ino, &last_dip, &last_ibp, &last_offset,0 );if (error) { -cmn_err (CE_WARN , -"xfs_iunlink_remove: xfs_inotobp() returned an error %d on %s. Returning error." , - error, mp->m_fsname); +xfs_warn (mp, +"%s: xfs_inotobp() returned error %d." , + __func__, error);return error; } next_agino =be32_to_cpu (last_dip->di_next_unlinked);
@@ -1872,9 +1869,8 @@ xfs_iunlink_remove(*/ error =xfs_itobp (mp, tp, ip, &dip, &ibp,XBF_LOCK );if (error) { -cmn_err (CE_WARN , -"xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error." , - error, mp->m_fsname); +xfs_warn (mp,"%s: xfs_itobp(2) returned error %d." , + __func__, error);return error; } next_agino =be32_to_cpu (dip->di_next_unlinked);
fs/xfs/xfs_mount.c +24 -36
188 lines not on this page · raw message
fs/xfs/xfs_rtalloc.c +4 -4
@@ -2222,8 +2222,8 @@ xfs_rtmount_init(if (sbp->sb_rblocks ==0 )return 0 ;if (mp->m_rtdev_targp ==NULL ) { -cmn_err (CE_WARN , -"XFS: This filesystem has a realtime volume, use rtdev=device option" ); +xfs_warn (mp, +"Filesystem has a realtime volume, use rtdev=device option" );return XFS_ERROR (ENODEV ); } mp->m_rsumlevels = sbp->sb_rextslog +1 ;
@@ -2237,7 +2237,7 @@ xfs_rtmount_init(*/ d = (xfs_daddr_t )XFS_FSB_TO_BB (mp, mp->m_sb.sb_rblocks);if (XFS_BB_TO_FSB (mp, d) != mp->m_sb.sb_rblocks) { -cmn_err (CE_WARN ,"XFS: realtime mount -- %llu != %llu" , +xfs_warn (mp,"realtime mount -- %llu != %llu" , (unsigned long long )XFS_BB_TO_FSB (mp, d), (unsigned long long ) mp->m_sb.sb_rblocks);return XFS_ERROR (EFBIG );
@@ -2246,7 +2246,7 @@ xfs_rtmount_init( d -XFS_FSB_TO_BB (mp,1 ), XFS_FSB_TO_B(mp, 1), 0);if (!bp) { -cmn_err (CE_WARN ,"XFS: realtime device size check failed" ); +xfs_warn (mp,"realtime device size check failed" );return EIO ; }xfs_buf_relse (bp);
fs/xfs/xfs_rtalloc.h +1 -1
@@ -154,7 +154,7 @@ xfs_rtmount_init(if (mp->m_sb.sb_rblocks ==0 )return 0 ; -cmn_err (CE_WARN ,"XFS: Not built with CONFIG_XFS_RT" ); +xfs_warn (mp,"Not built with CONFIG_XFS_RT" );return ENOSYS ; }# define xfs_rtmount_inodes (m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
fs/xfs/xfs_rw.c +8 -9
@@ -49,9 +49,9 @@ xfs_do_force_shutdown( logerror = flags &SHUTDOWN_LOG_IO_ERROR ;if (!(flags &SHUTDOWN_FORCE_UMOUNT )) { -cmn_err (CE_NOTE ,"xfs_force_shutdown(%s,0x%x) called from " -"line %d of file %s. Return address = 0x%p" , - mp->m_fsname, flags, lnnum, fname, __return_address); +xfs_notice (mp, +"%s(0x%x) called from line %d of file %s. Return address = 0x%p" , + __func__, flags, lnnum, fname, __return_address); }/* * No need to duplicate efforts.
@@ -86,8 +86,8 @@ xfs_do_force_shutdown( } }if (!(flags &SHUTDOWN_FORCE_UMOUNT )) { -cmn_err (CE_ALERT ,"Please umount the filesystem, " -"and rectify the problem(s)" ); +xfs_alert (mp, +"Please umount the filesystem and rectify the problem(s)" ); } }
@@ -101,10 +101,9 @@ xfs_ioerror_alert( xfs_buf_t *bp, xfs_daddr_t blkno) { - cmn_err(CE_ALERT, -"I/O error in filesystem (\"%s\") meta-data dev %s block 0x%llx" -" (\"%s\") error %d buf count %zd" , - (!mp || !mp->m_fsname) ?"(fs name not set)" : mp->m_fsname, + xfs_alert(mp, +"I/O error occurred: meta-data dev %s block 0x%llx" +" (\"%s\") error %d buf count %zd" ,XFS_BUFTARG_NAME (XFS_BUF_TARGET (bp)), (__uint64_t )blkno, func, XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp));
fs/xfs/xfs_trans_buf.c +3 -3
@@ -305,7 +305,7 @@ xfs_trans_read_buf(if (xfs_error_target == target) {if (((xfs_req_num++) % xfs_error_mod) ==0 ) {xfs_buf_relse (bp); -cmn_err (CE_DEBUG ,"Returning error!\n" ); +xfs_debug (mp,"Returning error!" );return XFS_ERROR (EIO ); } }
@@ -403,7 +403,7 @@ xfs_trans_read_buf(xfs_force_shutdown (tp->t_mountp,SHUTDOWN_META_IO_ERROR );xfs_buf_relse (bp); -cmn_err (CE_DEBUG ,"Returning trans error!\n" ); +xfs_debug (mp,"Returning trans error!" );return XFS_ERROR (EIO ); } }
@@ -427,7 +427,7 @@ shutdown_abort:*/ #if defined(DEBUG )if (XFS_BUF_ISSTALE (bp) &&XFS_BUF_ISDELAYWRITE (bp)) -cmn_err (CE_NOTE ,"about to pop assert, bp == 0x%p" , bp); +xfs_notice (mp,"about to pop assert, bp == 0x%p" , bp);#endif ASSERT ((XFS_BUF_BFLAGS (bp) & (XBF_STALE |XBF_DELWRI )) != (XBF_STALE |XBF_DELWRI ));
fs/xfs/xfs_vnodeops.c +2 -3
@@ -1189,9 +1189,8 @@ xfs_inactive(* inode might be lost for a long time or forever. */ if (!XFS_FORCED_SHUTDOWN (mp)) { -cmn_err (CE_NOTE , -"xfs_inactive: xfs_ifree() returned an error = %d on %s" , - error, mp->m_fsname); +xfs_notice (mp,"%s: xfs_ifree returned error %d" , + __func__, error);xfs_force_shutdown (mp,SHUTDOWN_META_IO_ERROR ); }xfs_trans_cancel (tp,XFS_TRANS_RELEASE_LOG_RES |XFS_TRANS_ABORT );
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/12 xfs: rename xfs_cmn_err_fsblock_zero()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The "cmn_err" part ofteh function name is no longer relevant. Rename the function to xfs_alert_fsblock_zero() to match the new logging API.
--- fs/xfs/xfs_iomap.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
fs/xfs/xfs_iomap.c +5 -5
@@ -101,7 +101,7 @@ xfs_iomap_eof_align_last_fsb( } STATIC int -xfs_cmn_err_fsblock_zero ( +xfs_alert_fsblock_zero (xfs_inode_t *ip,xfs_bmbt_irec_t *imap) {
@@ -246,7 +246,7 @@ xfs_iomap_write_direct( }if (!(imap->br_startblock ||XFS_IS_REALTIME_INODE (ip))) { - error =xfs_cmn_err_fsblock_zero (ip, imap); + error =xfs_alert_fsblock_zero (ip, imap); goto error_out; }
@@ -459,7 +459,7 @@ retry: }if (!(imap[0 ].br_startblock ||XFS_IS_REALTIME_INODE (ip))) -return xfs_cmn_err_fsblock_zero (ip, &imap[0 ]); +return xfs_alert_fsblock_zero (ip, &imap[0 ]); *ret_imap = imap[0 ];return 0 ;
@@ -609,7 +609,7 @@ xfs_iomap_write_allocate(* covers at least part of the callers request */ if (!(imap->br_startblock ||XFS_IS_REALTIME_INODE (ip))) -return xfs_cmn_err_fsblock_zero (ip, imap); +return xfs_alert_fsblock_zero (ip, imap); if ((offset_fsb >= imap->br_startoff) && (offset_fsb < (imap->br_startoff +
@@ -719,7 +719,7 @@ xfs_iomap_write_unwritten(return XFS_ERROR (error);if (!(imap.br_startblock ||XFS_IS_REALTIME_INODE (ip))) -return xfs_cmn_err_fsblock_zero (ip, &imap); +return xfs_alert_fsblock_zero (ip, &imap);if ((numblks_fsb = imap.br_blockcount) ==0 ) {/*
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/12 xfs: kill xfs_fs_mount_cmn_err() macro
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The xfs_fs_mount_cmn_err() hide a simple check as to whether the mount path should output an error or not. Remove the macro and open code the check.
--- fs/xfs/xfs_error.h | 6 ---- fs/xfs/xfs_mount.c | 72 +++++++++++++++++++++++++++++++--------------------- 2 files changed, 43 insertions(+), 35 deletions(-)
fs/xfs/xfs_error.h +0 -6
@@ -162,10 +162,4 @@ struct xfs_mount;extern void xfs_hex_dump (void *p,int length); -#define xfs_fs_mount_cmn_err(f, fmt, args...) \ - do { \ - if (!(f & XFS_MFSI_QUIET)) \ - cmn_err(CE_WARN, "XFS: " fmt, ## args); \ - } while (0) -#endif /* __XFS_ERROR_H__ */
fs/xfs/xfs_mount.c +43 -29
161 lines not on this page · raw message
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/12 xfs: convert xfs_cmn_err to xfs_alert_tag
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
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().
--- fs/xfs/support/debug.c | 28 ---------------------------- fs/xfs/support/debug.h | 2 -- fs/xfs/xfs_bmap.c | 2 +- fs/xfs/xfs_error.c | 5 ++--- fs/xfs/xfs_error.h | 6 ++---- fs/xfs/xfs_inode.c | 40 ++++++++++++++++++++-------------------- fs/xfs/xfs_iomap.c | 2 +- fs/xfs/xfs_rw.c | 23 +++++++++-------------- fs/xfs/xfs_trans_ail.c | 2 +- 9 files changed, 36 insertions(+), 74 deletions(-)
fs/xfs/support/debug.c +0 -28
@@ -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 panic =0 ; - -if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { -printk (KERN_ALERT "XFS: Transforming an alert into a BUG." ); - 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 (panic); -} -void assfail (char *expr,char *file,int line) {
fs/xfs/support/debug.h +0 -2
@@ -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);
fs/xfs/xfs_bmap.c +1 -1
@@ -3500,7 +3500,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",
fs/xfs/xfs_error.c +2 -3
@@ -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 ();
fs/xfs/xfs_error.h +2 -4
@@ -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
fs/xfs/xfs_inode.c +20 -20
@@ -2939,16 +2939,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 ) {
@@ -2956,9 +2956,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 ) {
@@ -2967,28 +2967,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; }/*
fs/xfs/xfs_iomap.c +1 -1
@@ -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",
fs/xfs/xfs_rw.c +9 -14
@@ -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 )) {
fs/xfs/xfs_trans_ail.c +1 -1
@@ -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 );
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
cover xfs: rework error logging infrastructure
This series completely reworks the cmn_err logging infrastructure by replacing it with a simple, consistent API that can be used everwhere. IOWs, this series replaces the various cmn_err APIs:
cmn_err() xfs_cmn_err() xfs_fs_cmn_err() xfs_fs_mount_cmn_err() xfs_fs_repair_cmn_err() xlog_warn() xlog_panic() xlog_exit()
With the following log level specific functions:
xfs_emerg(mp, ....) xfs_alert(mp, ....) xfs_alert_tag(mp, int tag, ....) xfs_crit(mp, ....) xfs_err(mp, ....) xfs_warn(mp, ....) xfs_notice(mp, ....) xfs_info(mp, ....) xfs_debug(mp, ....)
and a generic printk function that uses the kernel log level definitions(e.g. KERN_WARN):
xfs_printk(level, mp, ....)
This provides all the log messages with a common format. If mp && mp->m_fsname exist, then the format is:
"XFS (device name): <log message>"
otherwise it is:
"XFS: <log message>"
Hence we end up with log messages looking like this:
Normal mount:
XFS (vda): Mounting Filesystem
XFS (vda): Ending clean mount
Bad mount options:
XFS (vdb): unknown mount option [foobar].
XFS (vdb): Filesystem has duplicate UUID - can't mount
Quota check:
XFS (vdb): Mounting Filesystem
XFS (vdb): Ending clean mount
XFS (vdb): Quotacheck needed: Please wait.
XFS (vdb): Quotacheck: Done.
Log recovery warnings:
XFS (vdb): Mounting Filesystem
XFS (vdb): Invalid block length (0x2000) for buffer
XFS (vdb): Ending clean mount
....
XFS (vdb): Mounting Filesystem
XFS (vdb): recovery required on read-only device.
XFS (vdb): write access unavailable, cannot proceed.
XFS (vdb): log mount/recovery failed: error 30
XFS (vdb): log mount failed
XFS (vdb): Disabling barriers, underlying device is readonly
XFS (vdb): Mounting filesystem in no-recovery mode. Filesystem will be inconsistent.
Forced shutdown:
XFS (vdb): Mounting Filesystem
XFS (vdb): Ending clean mount
XFS (vdb): xfs_log_force: error 5 returned.
XFS (vdb): xfs_log_force: error 5 returned.
XFS (vdb): xfs_do_force_shutdown(0x1) called from line 1046 of file fs/xfs/linux-2.6/xfs_buf.c. Return address = 0xffffffff814acd93 XFS (vdb): xfs_log_force: error 5 returned.
XFS (vdb): xfs_log_force: error 5 returned.
And so on.
The other main change that pervades this series is that as I've touched each log messsage that quotes the function name, I've converted them to "%s:....", __func__, ... format. This shortens the message format string and also makes it easier to grep the source code to find the function definition.
Comments welcome.
Diffstat:
fs/xfs/Makefile | 2 +- fs/xfs/linux-2.6/kmem.c | 9 +- fs/xfs/linux-2.6/xfs_aops.c | 6 +- fs/xfs/linux-2.6/xfs_buf.c | 17 ++-- fs/xfs/linux-2.6/xfs_linux.h | 22 ++++ fs/xfs/linux-2.6/xfs_printk.c | 133 ++++++++++++++++++++++++ fs/xfs/linux-2.6/xfs_printk.h | 38 +++++++ fs/xfs/linux-2.6/xfs_super.c | 127 ++++++++++------------- fs/xfs/linux-2.6/xfs_sync.c | 5 +- fs/xfs/linux-2.6/xfs_sysctl.c | 25 ++++- fs/xfs/quota/xfs_dquot.c | 48 +++++---- fs/xfs/quota/xfs_dquot_item.c | 5 +- fs/xfs/quota/xfs_qm.c | 42 ++++---- fs/xfs/quota/xfs_qm_bhv.c | 3 +- fs/xfs/quota/xfs_qm_syscalls.c | 85 ++++++++-------- fs/xfs/quota/xfs_trans_dquot.c | 5 +- fs/xfs/support/debug.c | 115 --------------------- fs/xfs/support/debug.h | 54 ---------- fs/xfs/xfs_bmap.c | 17 ++-- fs/xfs/xfs_buf_item.c | 15 ++-- fs/xfs/xfs_da_btree.c | 9 +- fs/xfs/xfs_dfrag.c | 4 +- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2_node.c | 25 ++--- fs/xfs/xfs_error.c | 53 ++-------- fs/xfs/xfs_error.h | 29 +----- fs/xfs/xfs_fsops.c | 6 +- fs/xfs/xfs_ialloc.c | 82 ++++++--------- fs/xfs/xfs_inode.c | 124 ++++++++++------------ fs/xfs/xfs_iomap.c | 12 +- fs/xfs/xfs_log.c | 124 +++++++++++------------ fs/xfs/xfs_log_priv.h | 4 - fs/xfs/xfs_log_recover.c | 223 +++++++++++++++++++-------------------- fs/xfs/xfs_mount.c | 148 ++++++++++++++------------- fs/xfs/xfs_quota.h | 3 +- fs/xfs/xfs_rtalloc.c | 8 +- fs/xfs/xfs_rtalloc.h | 2 +- fs/xfs/xfs_rw.c | 40 +++---- fs/xfs/xfs_trans_ail.c | 2 +- fs/xfs/xfs_trans_buf.c | 6 +- fs/xfs/xfs_vnodeops.c | 13 +-- 41 files changed, 808 insertions(+), 884 deletions(-)
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/12 xfs: prevent NMI timeouts in cmn_err
From: Dave Chinner <[email protected]>
We currently have a global error message buffer in cmn_err that is protected by a spin lock that disables interrupts. Recently there have been reports of NMI timeouts occurring when the console is being flooded by SCSI error reports due to cmn_err() getting stuck trying to print to the console while holding this lock (i.e. with interrupts disabled). The NMI watchdog is seeing this CPU as non-responding and so is triggering a panic. While the trigger for the reported case is SCSI errors, pretty much anything that spams the kernel log could cause this to occur.
Realistically the only reason that we have the intemediate message buffer is to prepend the correct kernel log level prefix to the log message. The only reason we have the lock is to protect the global message buffer and the only reason the message buffer is global is to keep it off the stack. Hence if we can avoid needing a global message buffer we avoid needing the lock, and we can do this with a small amount of cleanup and some preprocessor tricks:
1. clean up xfs_cmn_err() panic mask functionality to avoid needing debug code in xfs_cmn_err()
2. remove the couple of "!" message prefixes that still exist that the existing cmn_err() code steps over.
3. redefine CE_* levels directly to KERN_*
4. redefine cmn_err() and friends to use printk() directly via variable argument length macros.
By doing this, we can completely remove the cmn_err() code and the lock that is causing the problems, and rely solely on printk() serialisation to ensure that we don't get garbled messages.
A series of followup patches is really needed to clean up all the cmn_err() calls and related messages properly, but that results in a series that is not easily back portable to enterprise kernels. Hence this initial fix is only to address the direct problem in the lowest impact way possible.
--- fs/xfs/linux-2.6/xfs_sysctl.c | 23 ++++++++- fs/xfs/support/debug.c | 109 +++++++++++++++++++---------------------- fs/xfs/support/debug.h | 25 ++++++--- fs/xfs/xfs_error.c | 31 ------------ fs/xfs/xfs_error.h | 18 ++----- fs/xfs/xfs_log.c | 2 +- fs/xfs/xfs_log_recover.c | 2 +- 7 files changed, 96 insertions(+), 114 deletions(-)
fs/xfs/linux-2.6/xfs_sysctl.c +22 -1
@@ -18,6 +18,7 @@#include "xfs.h" #include <linux/sysctl.h> #include <linux/proc_fs.h> +#include "xfs_error.h" static struct ctl_table_header *xfs_table_header;
@@ -51,6 +52,26 @@ xfs_stats_clear_proc_handler(return ret; } + +STATIC int +xfs_panic_mask_proc_handler ( +ctl_table *ctl, +int write, +void __user *buffer, +size_t *lenp, +loff_t *ppos) +{ +int ret, *valp = ctl->data; + + ret =proc_dointvec_minmax (ctl, write, buffer, lenp, ppos); +if (!ret && write) { + xfs_panic_mask = *valp; +#ifdef DEBUG + xfs_panic_mask |= (XFS_PTAG_SHUTDOWN_CORRUPT |XFS_PTAG_LOGRES ); +#endif + } +return ret; +}#endif /* CONFIG_PROC_FS */ static ctl_table xfs_table[] = {
@@ -77,7 +98,7 @@ static ctl_table xfs_table[] = { .data = &xfs_params.panic_mask.val, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec_minmax, + .proc_handler = xfs_panic_mask_proc_handler, .extra1 = &xfs_params.panic_mask.min, .extra2 = &xfs_params.panic_mask.max },
fs/xfs/support/debug.c +50 -59
130 lines not on this page · raw message
fs/xfs/support/debug.h +16 -9
@@ -20,15 +20,22 @@#include <stdarg.h> -#define CE_DEBUG 7/* debug */ -#define CE_CONT 6/* continuation */ -#define CE_NOTE 5/* notice */ -#define CE_WARN 4/* warning */ -#define CE_ALERT 1/* alert */ -#define CE_PANIC 0/* panic */ - -extern void cmn_err (int ,char *, ...) - __attribute__ ((format (printf,2 ,3 ))); +struct xfs_mount ; + +#define CE_DEBUG KERN_DEBUG +#define CE_CONT KERN_INFO +#define CE_NOTE KERN_NOTICE +#define CE_WARN KERN_WARNING +#define CE_ALERT KERN_ALERT +#define CE_PANIC KERN_EMERG + +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);#define ASSERT_ALWAYS (expr) \
fs/xfs/xfs_error.c +0 -31
@@ -152,37 +152,6 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud) }#endif /* DEBUG */ - -void -xfs_fs_cmn_err (int level,xfs_mount_t *mp,char *fmt, ...) -{ -va_list ap; - -va_start (ap, fmt); -xfs_fs_vcmn_err (level, mp, fmt, ap); -va_end (ap); -} - -void -xfs_cmn_err (int panic_tag,int level,xfs_mount_t *mp,char *fmt, ...) -{ -va_list ap; - -#ifdef DEBUG - xfs_panic_mask |= (XFS_PTAG_SHUTDOWN_CORRUPT |XFS_PTAG_LOGRES ); -#endif - -if (xfs_panic_mask && (xfs_panic_mask & panic_tag) - && (level &CE_ALERT )) { - level &= ~CE_ALERT ; - level |=CE_PANIC ; -cmn_err (CE_ALERT ,"XFS: Transforming an alert into a BUG." ); - } -va_start (ap, fmt); -xfs_fs_vcmn_err (level, mp, fmt, ap); -va_end (ap); -} - void xfs_error_report( const char *tag,
fs/xfs/xfs_error.h +6 -12
@@ -136,8 +136,8 @@ extern int xfs_error_test(int, int *, char *, int, char *, unsigned long); xfs_error_test((tag), (mp)->m_fixedfsid, "expr", __LINE__, __FILE__, \ (rf)))) -extern int xfs_errortag_add (int error_tag,xfs_mount_t *mp); -extern int xfs_errortag_clearall (xfs_mount_t *mp,int loud); +extern int xfs_errortag_add (int error_tag,struct xfs_mount *mp); +extern int xfs_errortag_clearall (struct xfs_mount *mp,int loud);#else #define XFS_TEST_ERROR (expr, mp, tag, rf) (expr)#define xfs_errortag_add (tag, mp) (ENOSYS)
@@ -162,21 +162,15 @@ extern int xfs_errortag_clearall(xfs_mount_t *mp, int loud);struct xfs_mount ; -extern void xfs_fs_vcmn_err (int level,struct xfs_mount *mp, -char *fmt,va_list ap) - __attribute__ ((format (printf,3 ,0 ))); -extern void xfs_cmn_err (int panic_tag,int level,struct xfs_mount *mp, -char *fmt, ...) - __attribute__ ((format (printf,4 ,5 ))); -extern void xfs_fs_cmn_err (int level,struct xfs_mount *mp,char *fmt, ...) - __attribute__ ((format (printf,3 ,4 ))); -extern void xfs_hex_dump (void *p,int length); #define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \ xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args) #define xfs_fs_mount_cmn_err(f, fmt, args...) \ - ((f & XFS_MFSI_QUIET)? (void)0 : cmn_err(CE_WARN, "XFS: " fmt, ## args)) + do { \ + if (!(f & XFS_MFSI_QUIET)) \ + cmn_err(CE_WARN, "XFS: " fmt, ## args); \ + } while (0)#endif /* __XFS_ERROR_H__ */
fs/xfs/xfs_log.c +1 -1
@@ -377,7 +377,7 @@ xfs_log_mount(cmn_err (CE_NOTE ,"XFS mounting filesystem %s" , mp->m_fsname); else {cmn_err (CE_NOTE , -"!Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent." , +"Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent." , mp->m_fsname);ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); }
fs/xfs/xfs_log_recover.c +1 -1
@@ -3800,7 +3800,7 @@ xlog_recover_finish( log->l_flags &= ~XLOG_RECOVERY_NEEDED ; }else {cmn_err (CE_DEBUG , -"!Ending clean XFS mount for filesystem: %s\n" , +"Ending clean XFS mount for filesystem: %s\n" , log->l_mp->m_fsname); }return 0 ;
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/12 xfs: kill xfs_fs_repair_cmn_err() macro
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
In certain cases of inode corruption, the xfs_fs_repair_cmn_err() macro is used to output an extra message in the corruption report. That extra message is "unmount and run xfs_repair", which really applies to any corruption report. Each case that this macro is called (except one) then calls xfs_corruption_error() to optionally dump more information about the error.
Hence, move the output of "run xfs_repair" to xfs_corruption_error() so that it is output on all corruption reports as it is relevant to all corruption incidents. Also, convert the one caller of the fs_repair macro that doesn't call xfs_corruption_error() to call it, hence provide consiѕtent error reporting for all cases where xfs_fs_repair_cmn_err() used to be called.
--- fs/xfs/xfs_bmap.c | 7 +++---- fs/xfs/xfs_error.c | 1 + fs/xfs/xfs_error.h | 3 --- fs/xfs/xfs_inode.c | 37 +++++++++++++++---------------------- 4 files changed, 19 insertions(+), 29 deletions(-)
fs/xfs/xfs_bmap.c +3 -4
@@ -4174,12 +4174,11 @@ xfs_bmap_read_extents( num_recs =xfs_btree_get_numrecs (block);if (unlikely (i + num_recs > room)) {ASSERT (i + num_recs <= room); -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, +xfs_warn (ip->i_mount,"corrupt dinode %Lu, (btree extents)." , (unsigned long long ) ip->i_ino); -XFS_ERROR_REPORT ("xfs_bmap_read_extents(1)" , -XFS_ERRLEVEL_LOW , - ip->i_mount); +XFS_CORRUPTION_ERROR ("xfs_bmap_read_extents(1)" , +XFS_ERRLEVEL_LOW , ip->i_mount, block); goto error0; } XFS_WANT_CORRUPTED_GOTO(
fs/xfs/xfs_error.c +1 -0
@@ -183,4 +183,5 @@ xfs_corruption_error(if (level <= xfs_error_level)xfs_hex_dump (p,16 );xfs_error_report (tag, level, mp, filename, linenum, ra); +xfs_alert (mp,"Corruption detected. Unmount and run xfs_repair" ); }
fs/xfs/xfs_error.h +0 -3
@@ -162,9 +162,6 @@ struct xfs_mount;extern void xfs_hex_dump (void *p,int length); -#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \ - xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args) - #define xfs_fs_mount_cmn_err(f, fmt, args...) \ do { \ if (!(f & XFS_MFSI_QUIET)) \
fs/xfs/xfs_inode.c +15 -22
@@ -317,7 +317,7 @@ xfs_iformat(if (unlikely (be32_to_cpu (dip->di_nextents) +be16_to_cpu (dip->di_anextents) >be64_to_cpu (dip->di_nblocks))) { - xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, + xfs_warn(ip->i_mount, "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.", (unsigned long long)ip->i_ino, (int)(be32_to_cpu(dip->di_nextents) +
@@ -330,8 +330,7 @@ xfs_iformat( }if (unlikely (dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt dinode %Lu, forkoff = 0x%x." , +xfs_warn (ip->i_mount,"corrupt dinode %Lu, forkoff = 0x%x." , (unsigned long long )ip->i_ino, dip->di_forkoff); XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
@@ -341,7 +340,7 @@ xfs_iformat(if (unlikely ((ip->i_d.di_flags &XFS_DIFLAG_REALTIME ) && !ip->i_mount->m_rtdev_targp)) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, +xfs_warn (ip->i_mount,"corrupt dinode %Lu, has realtime flag set." , ip->i_ino); XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
@@ -373,9 +372,8 @@ xfs_iformat(* no local regular files yet */ if (unlikely ((be16_to_cpu (dip->di_mode) &S_IFMT ) ==S_IFREG )) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu " -"(local format for regular file)." , +xfs_warn (ip->i_mount, +"corrupt inode %Lu (local format for regular file)." , (unsigned long long ) ip->i_ino); XFS_CORRUPTION_ERROR("xfs_iformat(4)", XFS_ERRLEVEL_LOW,
@@ -385,9 +383,8 @@ xfs_iformat( di_size =be64_to_cpu (dip->di_size);if (unlikely (di_size >XFS_DFORK_DSIZE (dip, ip->i_mount))) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu " -"(bad size %Ld for local inode)." , +xfs_warn (ip->i_mount, +"corrupt inode %Lu (bad size %Ld for local inode)." , (unsigned long long ) ip->i_ino, (long long ) di_size); XFS_CORRUPTION_ERROR("xfs_iformat(5)",
@@ -431,9 +428,8 @@ xfs_iformat( size =be16_to_cpu (atp->hdr.totsize);if (unlikely (size <sizeof (struct xfs_attr_sf_hdr ))) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu " -"(bad attr fork size %Ld)." , +xfs_warn (ip->i_mount, +"corrupt inode %Lu (bad attr fork size %Ld)." , (unsigned long long ) ip->i_ino, (long long ) size); XFS_CORRUPTION_ERROR("xfs_iformat(8)",
@@ -488,9 +484,8 @@ xfs_iformat_local(* kmem_alloc() or memcpy() below. */ if (unlikely (size >XFS_DFORK_SIZE (dip, ip->i_mount, whichfork))) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu " -"(bad size %d for local fork, size = %d)." , +xfs_warn (ip->i_mount, +"corrupt inode %Lu (bad size %d for local fork, size = %d)." , (unsigned long long ) ip->i_ino, size,XFS_DFORK_SIZE (dip, ip->i_mount, whichfork)); XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
@@ -547,8 +542,7 @@ xfs_iformat_extents(* kmem_alloc() or memcpy() below. */ if (unlikely (size <0 || size >XFS_DFORK_SIZE (dip, ip->i_mount, whichfork))) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu ((a)extents = %d)." , +xfs_warn (ip->i_mount,"corrupt inode %Lu ((a)extents = %d)." , (unsigned long long ) ip->i_ino, nex);XFS_CORRUPTION_ERROR ("xfs_iformat_extents(1)" ,XFS_ERRLEVEL_LOW , ip->i_mount, dip);
@@ -623,11 +617,10 @@ xfs_iformat_btree( || XFS_BMDR_SPACE_CALC(nrecs) > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork) || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { -xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, -"corrupt inode %Lu (btree)." , +xfs_warn (ip->i_mount,"corrupt inode %Lu (btree)." , (unsigned long long ) ip->i_ino); -XFS_ERROR_REPORT ("xfs_iformat_btree" ,XFS_ERRLEVEL_LOW , - ip->i_mount); +XFS_CORRUPTION_ERROR ("xfs_iformat_btree" ,XFS_ERRLEVEL_LOW , + ip->i_mount, dip);return XFS_ERROR (EFSCORRUPTED ); }
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/12 xfs: Convert linux-2.6/ files to new logging interface
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Convert the files in fs/xfs/linux-2.6/ to use the new xfs_<level> logging format that replaces the old irix inherited cmn_err() interfaces. While there, also convert naked printk calls to use the relevant xfs logging function to standardise output format.
--- fs/xfs/linux-2.6/kmem.c | 9 ++- fs/xfs/linux-2.6/xfs_aops.c | 6 +- fs/xfs/linux-2.6/xfs_buf.c | 17 +++--- fs/xfs/linux-2.6/xfs_super.c | 127 ++++++++++++++++++---------------------- fs/xfs/linux-2.6/xfs_sync.c | 5 +- fs/xfs/linux-2.6/xfs_sysctl.c | 2 +- 6 files changed, 76 insertions(+), 90 deletions(-)
fs/xfs/linux-2.6/kmem.c +5 -4
@@ -23,6 +23,7 @@#include <linux/backing-dev.h> #include "time.h" #include "kmem.h" +#include "xfs_printk.h" /* * Greedy allocation. May fail and may return vmalloced memory.
@@ -56,8 +57,8 @@ kmem_alloc(size_t size, unsigned int __nocast flags)if (ptr || (flags & (KM_MAYFAIL |KM_NOSLEEP )))return ptr;if (!(++retries %100 )) -printk (KERN_ERR "XFS: possible memory allocation " -"deadlock in %s (mode:0x%x)\n" , +xfs_err (NULL , +"possible memory allocation deadlock in %s (mode:0x%x)" , __func__, lflags);congestion_wait (BLK_RW_ASYNC ,HZ /50 ); }while (1 );
@@ -112,8 +113,8 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)if (ptr || (flags & (KM_MAYFAIL |KM_NOSLEEP )))return ptr;if (!(++retries %100 )) -printk (KERN_ERR "XFS: possible memory allocation " -"deadlock in %s (mode:0x%x)\n" , +xfs_err (NULL , +"possible memory allocation deadlock in %s (mode:0x%x)" , __func__, lflags);congestion_wait (BLK_RW_ASYNC ,HZ /50 ); }while (1 );
fs/xfs/linux-2.6/xfs_aops.c +3 -3
@@ -854,7 +854,7 @@ xfs_aops_discard_page(if (XFS_FORCED_SHUTDOWN (ip->i_mount)) goto out_invalidate; -xfs_fs_cmn_err (CE_ALERT , ip->i_mount, +xfs_alert (ip->i_mount,"page discard on page %p, inode 0x%llx, offset %llu." , page, ip->i_ino, offset);
@@ -872,7 +872,7 @@ xfs_aops_discard_page(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,"page discard unable to remove delalloc mapping." ); }break ;
@@ -1411,7 +1411,7 @@ xfs_vm_write_failed(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,"xfs_vm_write_failed: unable to clean up ino %lld" , ip->i_ino); }
fs/xfs/linux-2.6/xfs_buf.c +8 -9
@@ -401,9 +401,8 @@ _xfs_buf_lookup_pages(* handle buffer allocation failures we can't do much. */ if (!(++retries %100 )) -printk (KERN_ERR -"XFS: possible memory allocation " -"deadlock in %s (mode:0x%x)\n" , +xfs_err (NULL , +"possible memory allocation deadlock in %s (mode:0x%x)" , __func__, gfp_mask);XFS_STATS_INC (xb_page_retries);
@@ -615,8 +614,8 @@ xfs_buf_get(if (!(bp->b_flags &XBF_MAPPED )) { error =_xfs_buf_map_pages (bp, flags);if (unlikely (error)) { -printk (KERN_WARNING "%s: failed to map pages\n" , - __func__); +xfs_warn (target->bt_mount, +"%s: failed to map pages\n" , __func__); goto no_buffer; } }
@@ -850,8 +849,8 @@ xfs_buf_get_uncached( error =_xfs_buf_map_pages (bp,XBF_MAPPED );if (unlikely (error)) { -printk (KERN_WARNING "%s: failed to map pages\n" , - __func__); +xfs_warn (target->bt_mount, +"%s: failed to map pages\n" , __func__); goto fail_free_mem; }
@@ -1617,8 +1616,8 @@ xfs_setsize_buftarg_flags( btp->bt_smask = sectorsize -1 ;if (set_blocksize (btp->bt_bdev, sectorsize)) { -printk (KERN_WARNING -"XFS: Cannot set_blocksize to %u on device %s\n" , +xfs_warn (btp->bt_mount, +"Cannot set_blocksize to %u on device %s\n" , sectorsize,XFS_BUFTARG_NAME (btp));return EINVAL ; }
fs/xfs/linux-2.6/xfs_super.c +57 -70
308 lines not on this page · raw message
fs/xfs/linux-2.6/xfs_sync.c +2 -3
@@ -425,8 +425,7 @@ xfs_quiesce_attr(/* Push the superblock and write an unmount record */ error =xfs_log_sbcount (mp,1 );if (error) -xfs_fs_cmn_err (CE_WARN , mp, -"xfs_attr_quiesce: failed to log sb changes. " +xfs_warn (mp,"xfs_attr_quiesce: failed to log sb changes. " "Frozen image may not be consistent." );xfs_log_unmount_write (mp);xfs_unmountfs_writesb (mp);
@@ -806,7 +805,7 @@ xfs_reclaim_inode(* pass on the error. */ if (error && error !=EAGAIN && !XFS_FORCED_SHUTDOWN (ip->i_mount)) { -xfs_fs_cmn_err (CE_WARN , ip->i_mount, +xfs_warn (ip->i_mount,"inode 0x%llx background reclaim flush failed with %d" , (long long )ip->i_ino, error); }
fs/xfs/linux-2.6/xfs_sysctl.c +1 -1
@@ -37,7 +37,7 @@ xfs_stats_clear_proc_handler( ret =proc_dointvec_minmax (ctl, write, buffer, lenp, ppos);if (!ret && write && *valp) { -printk ("XFS Clearing xfsstats\n" ); +xfs_notice (NULL ,"Clearing xfsstats" );for_each_possible_cpu (c) {preempt_disable ();/* save vn_active, it's a universal truth! */
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/12] xfs: prevent NMI timeouts in cmn_err
In reply to Dave ChinnerQuoted 32 lines · Dave Chinner
From: Dave Chinner <[email protected]>
We currently have a global error message buffer in
cmn_errthat is protected by a spin lock that disables interrupts. Recently there have been reports of NMI timeouts occurring when the console is being flooded by SCSI error reports due tocmn_err()getting stuck trying to print to the console while holding this lock (i.e. with interrupts disabled). The NMI watchdog is seeing this CPU as non-responding and so is triggering a panic. While the trigger for the reported case is SCSI errors, pretty much anything that spams the kernel log could cause this to occur.Realistically the only reason that we have the intemediate message buffer is to prepend the correct kernel log level prefix to the log message. The only reason we have the lock is to protect the global message buffer and the only reason the message buffer is global is to keep it off the stack. Hence if we can avoid needing a global message buffer we avoid needing the lock, and we can do this with a small amount of cleanup and some preprocessor tricks:
1. clean up
xfs_cmn_err()panic mask functionality to avoid needing debug code inxfs_cmn_err()
2. remove the couple of "!" message prefixes that still exist that the existingcmn_err()code steps over.
3. redefine CE_* levels directly to KERN_*
4. redefinecmn_err()and friends to useprintk()directly via variable argument length macros.By doing this, we can completely remove the
cmn_err()code and the lock that is causing the problems, and rely solely onprintk()serialisation to ensure that we don't get garbled messages.
Quoted 5 lines
A series of followup patches is really needed to clean up all the
cmn_err()calls and related messages properly, but that results in a series that is not easily back portable to enterprise kernels. Hence this initial fix is only to address the direct problem in the lowest impact way possible.
I had two trivial remarks but, well, what you have is just fine...
Quoted 6 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/linux-2.6/xfs_sysctl.c | 23 ++++++++- fs/xfs/support/debug.c | 109 +++++++++++++++++++---------------------- fs/xfs/support/debug.h | 25 ++++++---
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/12] xfs: Convert xlog_warn to new logging interface
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
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".
One mistake noted below, otherwise:
Quoted 7 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/quota/xfs_dquot.c | 10 ++- fs/xfs/quota/xfs_qm.c | 2 +- fs/xfs/xfs_log.c | 124 ++++++++++++------------- fs/xfs/xfs_log_priv.h | 4 - fs/xfs/xfs_log_recover.c | 223 ++++++++++++++++++++++-----------------------
. . .
fs/xfs/xfs_log.c
Quoted 4 lines
fs/xfs/xfs_log.c +0
-0
. . .
Quoted 15 lines
fs/xfs/xfs_log.c +0
-11@@ -1563,38 +1561,36 @@ xlog_print_tic_res( "SWAPEXT" }; - xfs_fs_cmn_err(CE_WARN, mp, - "xfs_log_write: reservation summary:\n" - " trans type = %s (%u)\n" - " unit res = %d bytes\n" - " current res = %d bytes\n" - " total reg = %u bytes (o/flow = %u bytes)\n" - " ophdrs = %u (ophdr space = %u bytes)\n" - " ophdr + reg = %u bytes\n" - " num regions = %u\n", - ((ticket->t_trans_type <= 0 || - ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
fs/xfs/xfs_log.c xlog_print_tic_res( · line 1564
Quoted 10 lines
fs/xfs/xfs_log.c +1
-9- "bad-trans-type" : trans_type_str[ticket->t_trans_type-1]), - ticket->t_trans_type, - ticket->t_unit_res, - ticket->t_curr_res, - ticket->t_res_arr_sum, ticket->t_res_o_flow, - ticket->t_res_num_ophdrs, ophdr_spc, - ticket->t_res_arr_sum + - ticket->t_res_o_flow + ophdr_spc, - ticket->t_res_num); + xfs_alert(mp,
xfs_warn(mp,
Quoted 27 lines
fs/xfs/xfs_log.c +21
-4+"xfs_log_write: reservation summary:\n" +" trans type = %s (%u)\n" +" unit res = %d bytes\n" +" current res = %d bytes\n" +" total reg = %u bytes (o/flow = %u bytes)\n" +" ophdrs = %u (ophdr space = %u bytes)\n" +" ophdr + reg = %u bytes\n" +" num regions = %u\n" , + ((ticket->t_trans_type <=0 || + ticket->t_trans_type >XFS_TRANS_TYPE_MAX ) ? +"bad-trans-type" : trans_type_str[ticket->t_trans_type-1 ]), + ticket->t_trans_type, + ticket->t_unit_res, + ticket->t_curr_res, + ticket->t_res_arr_sum, ticket->t_res_o_flow, + ticket->t_res_num_ophdrs, ophdr_spc, + ticket->t_res_arr_sum + + ticket->t_res_o_flow + ophdr_spc, + ticket->t_res_num);for (i =0 ; i < ticket->t_res_num; i++) { -uint r_type = ticket->t_res_arr[i].r_type; - cmn_err(CE_WARN, - "region[%u]: %s - %u bytes\n", - i, +uint r_type = ticket->t_res_arr[i].r_type; + xfs_warn(mp, "region[%u]: %s - %u bytes\n", i,
fs/xfs/xfs_log.c xlog_print_tic_res( · line 1596
Quoted 10 lines
fs/xfs/xfs_log.c +1
-1((r_type <=0 || r_type >XLOG_REG_TYPE_MAX ) ?"bad-rtype" : res_type_str[r_type-1 ]), 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_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); }
. . .
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 3 lines · Dave Chinner
This series completely reworks the
cmn_errlogging infrastructure by replacing it with a simple, consistent API that can be used everwhere. IOWs, this series replaces the variouscmn_errAPIs:
. . .
I reviewed the whole series, and offered a correction on just one thing. I might quibble with the indentation of some of the format strings here or there, but I didn't bother, there sometimes is no nice way to do those.
I personally like the result a lot, it's a lot cleaner and easier on the eyes.
In any case, you say it's an RFC but I'm OK with it.
I'm just starting to test with it but you can consider the whole series reviewed by me.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 12/12] xfs: kill support/debug.[ch]
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The remaining functionality in debug.[ch] is effectively just assert handling, conditional debug definitions and hex dumping. The hex dumping and assert function can be moved into the new printk module, while the rest can be moved into top-level header files. This allows fs/xfs/support/debug.[ch] to be completely removed from the codebase.
Quoted 4 lines
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/Makefile | 1 - fs/xfs/linux-2.6/xfs_linux.h | 21 +++++++++++++++++++
You need to delete the #include <support/debug.h>
that remains in linux-2.6/xfs_linux.h too.
-Alex
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Alex Elder
Quoted 3 lines · Dave Chinner
This series completely reworks the
cmn_errlogging infrastructure by replacing it with a simple, consistent API that can be used everwhere. IOWs, this series replaces the variouscmn_errAPIs:
Quoted 7 lines
. . .
I reviewed the whole series, and offered a correction on just one thing. I might quibble with the indentation of some of the format strings here or there, but I didn't bother, there sometimes is no nice way to do those.
Yeah, I tried to make them a bit more consistent - one line if possible, even if the indenting was not "pretty". In some places it made a major improvement, in other places I wasn't quite so happy with the result.
Quoted 4 lines
I personally like the result a lot, it's a lot cleaner and easier on the eyes.
In any case, you say it's an RFC but I'm OK with it.
It was an RFC because I wasn't sure whether people would like the interface I proposed and converted to. I know I mentioned it previously, but no-one commented in reply with a yay or nay, so I just went an did it and this is the result.
Quoted 2 lines
I'm just starting to test with it but you can consider the whole series reviewed by me.
Great, thanks. I'll push it out into a topic branch tomorrow...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/12] xfs: prevent NMI timeouts in cmn_err
In reply to Dave ChinnerLooks good. I think this patch also still is a candidate for 2.6.38, while the rest looks more like 2.6.39 material.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/12] xfs: prevent NMI timeouts in cmn_err
Quoted 2 lines · Christoph Hellwig
Looks good. I think this patch also still is a candidate for 2.6.38, while the rest looks more like 2.6.39 material.
Agreed.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
XFS master branch update
I just pushed an update to the master branch on oss. It includes:
- Dave's fixes to address corruption due to overlapping concurrent async direct I/O (and associated code cleanup).
- Dave's patch to avoid repeated log covering transactions while idle.
- Christoph's patch to add FITRIM support to XFS.
- Christoph's change (with credit to others) to rework the buffer I/O completion code, fixing problems that occur should a sync I/O fail.
- Three more, described below.
I plan to send this stuff to Linus in another pull request for 2.6.38--probably next week sometime--after it's spent some time in the -next tree.
Dave, you're going to want to pay particular note to the last three of these. They affect patch series you have but which have not been accepted yet:
- xfs: prevent NMI timeouts in cmn_err
This was the first in your recent log API series
- xfs: Add log level to assertion printk This one gets eliminated by the log API series, but the last one in your series won't apply cleanly because one is in place. (Trivial fix.)
- xfs: fix an assignment within an ASSERT() This one was proposed by Anton Blanchard but you said it had already been covered by a patch you had. But that patch was held back with the percpu counters stuff, and I wanted to include the fix now. Again, easy to fix but I just wanted to call your attention to it.
-Alex
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/12] xfs: kill xfs_fs_mount_cmn_err() macro
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The
xfs_fs_mount_cmn_err()hide a simple check as to whether the mount path should output an error or not. Remove the macro and open code the check.
I would be nice to just move the quite flag into the normal mount flags and have a xfs_mount_warn that checks it based off the mp.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 12/12] xfs: kill support/debug.[ch]
In reply to Dave Chinnerfs/xfs/Makefile xfs-y += $(addprefix $(XFS_LINUX)/, \ · line 114
Quoted 4 lines
# Objects in support/
xfs-y += $(addprefix support/, \fs/xfs/Makefile +0
-1- debug.o \ uuid.o)
This can become just:
xfs-y += support/uuid.o
unless, of course we managed to kill off uuid.c as well.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
The series looks good to me. One thing that feels a bit odd is the xfs_printk.[ch] name - the functions exported to the rest of the code don't contain prink anyway. Maybe xfs_msg.[ch] or xfs_message.[ch]?
Otherwise looks good,
for the whole series.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/12] xfs: kill xfs_fs_mount_cmn_err() macro
In reply to Christoph HellwigQuoted 9 lines · Christoph Hellwig
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The
xfs_fs_mount_cmn_err()hide a simple check as to whether the mount path should output an error or not. Remove the macro and open code the check.I would be nice to just move the quite flag into the normal mount flags and have a
xfs_mount_warnthat checks it based off the mp.
Given it is a flag that is only relevant for the mount context, is there really any need to use a flag that persists for the entire life of the filesystem for it? I don't think the code is that hard to follow right now. ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Christoph Hellwig
The series looks good to me. One thing that feels a bit odd is the xfs_printk.[ch] name - the functions exported to the rest of the code don't contain prink anyway. Maybe xfs_msg.[ch] or xfs_message.[ch]?
I was struggling for something relevant to call the file - xfs_message.[ch] definitely seems more appropriate. I'll change the name..
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/12] xfs: kill xfs_fs_mount_cmn_err() macro
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
Quoted 2 lines
I would be nice to just move the quite flag into the normal mount flags and have a
xfs_mount_warnthat checks it based off the mp.Given it is a flag that is only relevant for the mount context, is there really any need to use a flag that persists for the entire life of the filesystem for it? I don't think the code is that hard to follow right now. ;)
We can clear the flag after the mount. But in the end it's probably not worth bothering, so feel free to leave it as-is.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs