mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
xfs: allow overlapping rtrmapbt records for shared data extents
Allow overlapping realtime reverse mapping records if they both describe shared data extents and the fs supports reflink on the realtime volume. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -78,6 +78,18 @@ struct xchk_rtrmap {
|
||||
struct xfs_rmap_irec prev_rec;
|
||||
};
|
||||
|
||||
static inline bool
|
||||
xchk_rtrmapbt_is_shareable(
|
||||
struct xfs_scrub *sc,
|
||||
const struct xfs_rmap_irec *irec)
|
||||
{
|
||||
if (!xfs_has_rtreflink(sc->mp))
|
||||
return false;
|
||||
if (irec->rm_flags & XFS_RMAP_UNWRITTEN)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Flag failures for records that overlap but cannot. */
|
||||
STATIC void
|
||||
xchk_rtrmapbt_check_overlapping(
|
||||
@@ -99,7 +111,10 @@ xchk_rtrmapbt_check_overlapping(
|
||||
if (pnext <= irec->rm_startblock)
|
||||
goto set_prev;
|
||||
|
||||
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
|
||||
/* Overlap is only allowed if both records are data fork mappings. */
|
||||
if (!xchk_rtrmapbt_is_shareable(bs->sc, &cr->overlap_rec) ||
|
||||
!xchk_rtrmapbt_is_shareable(bs->sc, irec))
|
||||
xchk_btree_set_corrupt(bs->sc, bs->cur, 0);
|
||||
|
||||
/* Save whichever rmap record extends furthest. */
|
||||
inext = irec->rm_startblock + irec->rm_blockcount;
|
||||
|
||||
Reference in New Issue
Block a user