mbox series

[GIT,PULL,6/22] xfs: standardize btree record checking code

Message ID 168127094258.417736.16899254677069613479.stg-ugh@frogsfrogsfrogs (mailing list archive)
State Deferred, archived
Headers show
Series [GIT,PULL,1/22] xfs: design documentation for online fsck | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/btree-complain-bad-records-6.4_2023-04-11

Message

Darrick J. Wong April 12, 2023, 3:46 a.m. UTC
Hi Dave,

Please pull this branch with changes for xfs.

As usual, I did a test-merge with the main upstream branch as of a few
minutes ago, and didn't see any conflicts.  Please let me know if you
encounter any problems.

--D

The following changes since commit 88accf17226733088923635b580779a3c86b6f23:

xfs: scrub should use ECHRNG to signal that the drain is needed (2023-04-11 19:00:00 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git tags/btree-complain-bad-records-6.4_2023-04-11

for you to fetch changes up to 6a3bd8fcf9afb47c703cb268f30f60aa2e7af86a:

xfs: complain about bad file mapping records in the ondisk bmbt (2023-04-11 19:00:05 -0700)

----------------------------------------------------------------
xfs: standardize btree record checking code [v24.5]

While I was cleaning things up for 6.1, I noticed that the btree
_query_range and _query_all functions don't perform the same checking
that the _get_rec functions perform.  In fact, they don't perform /any/
sanity checking, which means that callers aren't warned about impossible
records.

Therefore, hoist the record validation and complaint logging code into
separate functions, and call them from any place where we convert an
ondisk record into an incore record.  For online scrub, we can replace
checking code with a call to the record checking functions in libxfs,
thereby reducing the size of the codebase.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>

----------------------------------------------------------------
Darrick J. Wong (8):
xfs: standardize ondisk to incore conversion for free space btrees
xfs: standardize ondisk to incore conversion for inode btrees
xfs: standardize ondisk to incore conversion for refcount btrees
xfs: return a failure address from xfs_rmap_irec_offset_unpack
xfs: standardize ondisk to incore conversion for rmap btrees
xfs: standardize ondisk to incore conversion for bmap btrees
xfs: complain about bad records in query_range helpers
xfs: complain about bad file mapping records in the ondisk bmbt

fs/xfs/libxfs/xfs_alloc.c        | 82 ++++++++++++++++++++++++----------
fs/xfs/libxfs/xfs_alloc.h        |  6 +++
fs/xfs/libxfs/xfs_bmap.c         | 31 ++++++++++++-
fs/xfs/libxfs/xfs_bmap.h         |  2 +
fs/xfs/libxfs/xfs_ialloc.c       | 77 +++++++++++++++++++++-----------
fs/xfs/libxfs/xfs_ialloc.h       |  2 +
fs/xfs/libxfs/xfs_ialloc_btree.c |  2 +-
fs/xfs/libxfs/xfs_ialloc_btree.h |  2 +-
fs/xfs/libxfs/xfs_inode_fork.c   |  3 +-
fs/xfs/libxfs/xfs_refcount.c     | 73 +++++++++++++++++++-----------
fs/xfs/libxfs/xfs_refcount.h     |  2 +
fs/xfs/libxfs/xfs_rmap.c         | 95 +++++++++++++++++++++++++---------------
fs/xfs/libxfs/xfs_rmap.h         | 12 +++--
fs/xfs/scrub/alloc.c             | 24 +++++-----
fs/xfs/scrub/bmap.c              |  6 +++
fs/xfs/scrub/ialloc.c            | 24 ++--------
fs/xfs/scrub/refcount.c          | 14 ++----
fs/xfs/scrub/rmap.c              | 44 ++-----------------
18 files changed, 303 insertions(+), 198 deletions(-)