xfs: bmap scrubber should do rmap xref with bmap for sparse files
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 23 Mar 2018 17:06:53 +0000 (10:06 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sat, 24 Mar 2018 01:05:07 +0000 (18:05 -0700)
commit5e777b62b0bcb645f165fe5e056fe8862782affc
treea38ce3533a204c4d85951073e6598ca576b620b9
parent6edb181053f067cee64d4239830062cb40ddab00
xfs: bmap scrubber should do rmap xref with bmap for sparse files

When we're scanning an extent mapping inode fork, ensure that every rmap
record for this ifork has a corresponding bmbt record too.  This
(mostly) provides the ability to cross-reference rmap records with bmap
data.  The rmap scrubber cannot do the xref on its own because that
requires taking an ilock with the agf lock held, which violates our
locking order rules (inode, then agf).

Note that we only do this for forks that are in btree format due to the
increased complexity; or forks that should have data but suspiciously
have zero extents because the inode could have just had its iforks
zapped by the inode repair code and now we need to reclaim the old
extents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/scrub/bmap.c