Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8389f3ff authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: skip scrub xref if corruption already noted



Don't bother looking for cross-referencing problems if the metadata is
already corrupt or we've already found a cross-referencing problem.
Since we added a helper function for flags testing, convert existing
users to use it.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
parent c9fbd7bb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ xfs_scrub_allocbt_xref_other(
		pcur = &sc->sa.cnt_cur;
	else
		pcur = &sc->sa.bno_cur;
	if (!*pcur)
	if (!*pcur || xfs_scrub_skip_xref(sc->sm))
		return;

	error = xfs_alloc_lookup_le(*pcur, agbno, len, &has_otherrec);
@@ -172,7 +172,7 @@ xfs_scrub_xref_is_used_space(
	bool				is_freesp;
	int				error;

	if (!sc->sa.bno_cur)
	if (!sc->sa.bno_cur || xfs_scrub_skip_xref(sc->sm))
		return;

	error = xfs_alloc_has_record(sc->sa.bno_cur, agbno, len, &is_freesp);
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ xfs_scrub_bmap_xref_rmap(
	unsigned long long		rmap_end;
	uint64_t			owner;

	if (!info->sc->sa.rmap_cur)
	if (!info->sc->sa.rmap_cur || xfs_scrub_skip_xref(info->sc->sm))
		return;

	if (info->whichfork == XFS_COW_FORK)
+4 −0
Original line number Diff line number Diff line
@@ -737,6 +737,10 @@ xfs_scrub_should_check_xref(
	int				*error,
	struct xfs_btree_cur		**curpp)
{
	/* No point in xref if we already know we're corrupt. */
	if (xfs_scrub_skip_xref(sc->sm))
		return false;

	if (*error == 0)
		return true;

+10 −0
Original line number Diff line number Diff line
@@ -145,4 +145,14 @@ int xfs_scrub_setup_inode_contents(struct xfs_scrub_context *sc,
				   struct xfs_inode *ip, unsigned int resblks);
void xfs_scrub_buffer_recheck(struct xfs_scrub_context *sc, struct xfs_buf *bp);

/*
 * Don't bother cross-referencing if we already found corruption or cross
 * referencing discrepancies.
 */
static inline bool xfs_scrub_skip_xref(struct xfs_scrub_metadata *sm)
{
	return sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
			       XFS_SCRUB_OFLAG_XCORRUPT);
}

#endif	/* __XFS_SCRUB_COMMON_H__ */
+4 −3
Original line number Diff line number Diff line
@@ -387,7 +387,8 @@ xfs_scrub_iallocbt_xref_rmap_btreeblks(
	int				error;

	if (!sc->sa.ino_cur || !sc->sa.rmap_cur ||
	    (xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur))
	    (xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur) ||
	    xfs_scrub_skip_xref(sc->sm))
		return;

	/* Check that we saw as many inobt blocks as the rmap says. */
@@ -424,7 +425,7 @@ xfs_scrub_iallocbt_xref_rmap_inodes(
	xfs_filblks_t			blocks;
	int				error;

	if (!sc->sa.rmap_cur)
	if (!sc->sa.rmap_cur || xfs_scrub_skip_xref(sc->sm))
		return;

	/* Check that we saw as many inode blocks as the rmap knows about. */
@@ -496,7 +497,7 @@ xfs_scrub_xref_inode_check(
	bool				has_inodes;
	int				error;

	if (!(*icur))
	if (!(*icur) || xfs_scrub_skip_xref(sc->sm))
		return;

	error = xfs_ialloc_has_inodes_at_extent(*icur, agbno, len, &has_inodes);
Loading