diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-09-01 11:25:03 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-10-22 16:41:14 -0700 |
commit | 2350ae3331ba1f66ee886919debf4834b742d3cd (patch) | |
tree | 8f6b08e71345eea12401a77ff70736a6895fa1e3 /fs/xfs/scrub/btree.c | |
parent | 2463a42b4e735b9694b5a6d64839ae02c4a772aa (diff) |
xfs: whine to dmesg when we encounter errors
Forward everything scrub whines about to dmesg.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/btree.c')
-rw-r--r-- | fs/xfs/scrub/btree.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c index 08a70f410887..9ad369aed1d3 100644 --- a/fs/xfs/scrub/btree.c +++ b/fs/xfs/scrub/btree.c @@ -11,6 +11,9 @@ #include "xfs_mount.h" #include "xfs_inode.h" #include "xfs_btree.h" +#include "xfs_log_format.h" +#include "xfs_inode.h" +#include "xfs_ag.h" #include "scrub/scrub.h" #include "scrub/common.h" #include "scrub/btree.h" @@ -18,6 +21,23 @@ /* btree scrubbing */ +/* Figure out which block the btree cursor was pointing to. */ +static inline xfs_fsblock_t +xchk_btree_cur_fsbno( + struct xfs_btree_cur *cur, + int level) +{ + if (level < cur->bc_nlevels && cur->bc_levels[level].bp) + return XFS_DADDR_TO_FSB(cur->bc_mp, + xfs_buf_daddr(cur->bc_levels[level].bp)); + else if (level == cur->bc_nlevels - 1 && + (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE)) + return XFS_INO_TO_FSB(cur->bc_mp, cur->bc_ino.ip->i_ino); + else if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS)) + return XFS_AGB_TO_FSB(cur->bc_mp, cur->bc_ag.pag->pag_agno, 0); + return NULLFSBLOCK; +} + /* * Check for btree operation errors. See the section about handling * operational errors in common.c. @@ -47,11 +67,37 @@ __xchk_btree_process_error( fallthrough; default: if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) + { + xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); + xchk_whine(sc->mp, "ino 0x%llx fork %d type %d btnum %d level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS", + cur->bc_ino.ip->i_ino, + cur->bc_ino.whichfork, + sc->sm->sm_type, + cur->bc_btnum, + level, + cur->bc_levels[level].ptr, + XFS_FSB_TO_AGNO(cur->bc_mp, fsbno), + XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), + *error, + ret_ip); trace_xchk_ifork_btree_op_error(sc, cur, level, *error, ret_ip); + } else + { + xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); + xchk_whine(sc->mp, "type %d btnum %d level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS", + sc->sm->sm_type, + cur->bc_btnum, + level, + cur->bc_levels[level].ptr, + XFS_FSB_TO_AGNO(cur->bc_mp, fsbno), + XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), + *error, + ret_ip); trace_xchk_btree_op_error(sc, cur, level, *error, ret_ip); + } break; } return false; @@ -91,11 +137,35 @@ __xchk_btree_set_corrupt( sc->sm->sm_flags |= errflag; if (cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) + { + xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); + xchk_whine(sc->mp, "ino 0x%llx fork %d type %d btnum %d level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS", + cur->bc_ino.ip->i_ino, + cur->bc_ino.whichfork, + sc->sm->sm_type, + cur->bc_btnum, + level, + cur->bc_levels[level].ptr, + XFS_FSB_TO_AGNO(cur->bc_mp, fsbno), + XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), + ret_ip); trace_xchk_ifork_btree_error(sc, cur, level, ret_ip); + } else + { + xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); + xchk_whine(sc->mp, "type %d btnum %d level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS", + sc->sm->sm_type, + cur->bc_btnum, + level, + cur->bc_levels[level].ptr, + XFS_FSB_TO_AGNO(cur->bc_mp, fsbno), + XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), + ret_ip); trace_xchk_btree_error(sc, cur, level, ret_ip); + } } void |