Commit 4d1a2ed3 authored by Nathan Scott's avatar Nathan Scott
Browse files

[XFS] Fix up debug code so that bulkstat wont generate thousands of


fsstress warnings.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:26111a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent a916e2bd
...@@ -1174,6 +1174,9 @@ xfs_dilocate( ...@@ -1174,6 +1174,9 @@ xfs_dilocate(
if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks || if (agno >= mp->m_sb.sb_agcount || agbno >= mp->m_sb.sb_agblocks ||
ino != XFS_AGINO_TO_INO(mp, agno, agino)) { ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
#ifdef DEBUG #ifdef DEBUG
/* no diagnostics for bulkstat, ino comes from userspace */
if (flags & XFS_IMAP_BULKSTAT)
return XFS_ERROR(EINVAL);
if (agno >= mp->m_sb.sb_agcount) { if (agno >= mp->m_sb.sb_agcount) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_fs_cmn_err(CE_ALERT, mp,
"xfs_dilocate: agno (%d) >= " "xfs_dilocate: agno (%d) >= "
......
...@@ -256,13 +256,11 @@ xfs_itobp( ...@@ -256,13 +256,11 @@ xfs_itobp(
xfs_daddr_t bno, xfs_daddr_t bno,
uint imap_flags) uint imap_flags)
{ {
xfs_imap_t imap;
xfs_buf_t *bp; xfs_buf_t *bp;
int error; int error;
xfs_imap_t imap;
#ifdef __KERNEL__
int i; int i;
int ni; int ni;
#endif
if (ip->i_blkno == (xfs_daddr_t)0) { if (ip->i_blkno == (xfs_daddr_t)0) {
/* /*
...@@ -319,7 +317,6 @@ xfs_itobp( ...@@ -319,7 +317,6 @@ xfs_itobp(
*/ */
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno, error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap.im_blkno,
(int)imap.im_len, XFS_BUF_LOCK, &bp); (int)imap.im_len, XFS_BUF_LOCK, &bp);
if (error) { if (error) {
#ifdef DEBUG #ifdef DEBUG
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_itobp: " xfs_fs_cmn_err(CE_ALERT, mp, "xfs_itobp: "
...@@ -330,17 +327,21 @@ xfs_itobp( ...@@ -330,17 +327,21 @@ xfs_itobp(
#endif /* DEBUG */ #endif /* DEBUG */
return error; return error;
} }
#ifdef __KERNEL__
/* /*
* Validate the magic number and version of every inode in the buffer * Validate the magic number and version of every inode in the buffer
* (if DEBUG kernel) or the first inode in the buffer, otherwise. * (if DEBUG kernel) or the first inode in the buffer, otherwise.
* No validation is done here in userspace (xfs_repair).
*/ */
#ifdef DEBUG #if !defined(__KERNEL__)
ni = 0;
#elif defined(DEBUG)
ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 :
(BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog); (BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog);
#else #else /* usual case */
ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1; ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1;
#endif #endif
for (i = 0; i < ni; i++) { for (i = 0; i < ni; i++) {
int di_ok; int di_ok;
xfs_dinode_t *dip; xfs_dinode_t *dip;
...@@ -352,8 +353,10 @@ xfs_itobp( ...@@ -352,8 +353,10 @@ xfs_itobp(
if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP, if (unlikely(XFS_TEST_ERROR(!di_ok, mp, XFS_ERRTAG_ITOBP_INOTOBP,
XFS_RANDOM_ITOBP_INOTOBP))) { XFS_RANDOM_ITOBP_INOTOBP))) {
#ifdef DEBUG #ifdef DEBUG
cmn_err(CE_ALERT, "Device %s - bad inode magic/vsn " if (!(imap_flags & XFS_IMAP_BULKSTAT))
"daddr %lld #%d (magic=%x)", cmn_err(CE_ALERT,
"Device %s - bad inode magic/vsn "
"daddr %lld #%d (magic=%x)",
XFS_BUFTARG_NAME(mp->m_ddev_targp), XFS_BUFTARG_NAME(mp->m_ddev_targp),
(unsigned long long)imap.im_blkno, i, (unsigned long long)imap.im_blkno, i,
INT_GET(dip->di_core.di_magic, ARCH_CONVERT)); INT_GET(dip->di_core.di_magic, ARCH_CONVERT));
...@@ -364,7 +367,6 @@ xfs_itobp( ...@@ -364,7 +367,6 @@ xfs_itobp(
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
} }
#endif /* __KERNEL__ */
xfs_inobp_check(mp, bp); xfs_inobp_check(mp, bp);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment