put the xfs xfile abstraction on a diet v2

Christoph Hellwig
2024-01-26T13:29:10Z

Hi all,

this series refactors and simplifies the code in the xfs xfile
abstraction, which is a thing layer on a kernel-use shmem file.

Do do this is needs a slighly lower level export from shmem.c,
which I combined with improving an assert and documentation there.

One thing I don't really like yet is that xfile is still based on
folios and not pages. The main stumbling block for that is the
mess around the hwpoison flag - that one still is per-file and not
per-folio, and shmem checks it weirdly often and not really in
at the abstractions levels where I'd expect it and feels very
different from the normal page cache code in filemap.c. Maybe
I'm just failing to understand why that is done, but especially
without comments explaining it it feels like it could use some
real attention first.

The series is against the xfs for-next branch.

Changes since v1:
- fix reading i_blocks
- provide wrappers for reading i_size and i_blocks
- update the xfile load/store documentation
- improve a commit message
- use shmem_kernel_file_setup
- add a missing folio unlock in the hwpoison path in xfile_get_page
- fix checking for shmem mappings
- improve I/O error handling (Darrick)
- convert to folios (partially from Darrick)

Diffstat:
Documentation/filesystems/xfs/xfs-online-fsck-design.rst | 12
fs/xfs/scrub/rtsummary.c | 6
fs/xfs/scrub/trace.h | 81 ++-
fs/xfs/scrub/xfarray.c | 234 ++++-----
fs/xfs/scrub/xfarray.h | 11
fs/xfs/scrub/xfile.c | 370 +++++----------
fs/xfs/scrub/xfile.h | 62 --
include/linux/shmem_fs.h | 6
include/linux/swap.h | 10
mm/filemap.c | 9
mm/internal.h | 4
mm/shmem.c | 38 +
12 files changed, 368 insertions(+), 475 deletions(-)