mbox series

[GIT,PULL,12/23] xfs_scrub: move fstrim to a separate phase

Message ID 172230458966.1455085.4399793624957809063.stg-ugh@frogsfrogsfrogs (mailing list archive)
State Accepted, archived
Headers show
Series [GIT,PULL,01/23] libxfs: fixes for 6.9 | expand

Pull-request

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git tags/scrub-fstrim-phase-6.10_2024-07-29

Message

Darrick J. Wong July 30, 2024, 2:43 a.m. UTC
Hi Carlos,

Please pull this branch with changes for xfsprogs for 6.10-rc1.

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.

The following changes since commit 746ee95b71649b4ae515893ffa3bbe7b5e815d0d:

xfs_scrub: dump unicode points (2024-07-29 17:01:09 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git tags/scrub-fstrim-phase-6.10_2024-07-29

for you to fetch changes up to 5ccdd24dc9987b50333332b7381ff1a305e67ef7:

xfs_scrub: improve responsiveness while trimming the filesystem (2024-07-29 17:01:09 -0700)

----------------------------------------------------------------
xfs_scrub: move fstrim to a separate phase [v30.9 12/28]

Back when I originally designed xfs_scrub, all filesystem metadata
checks were complete by the end of phase 3, and phase 4 was where all
the metadata repairs occurred.  On the grounds that the filesystem
should be fully consistent by then, I made a call to FITRIM at the end
of phase 4 to discard empty space in the filesystem.

Unfortunately, that's no longer the case -- summary counters, link
counts, and quota counters are not checked until phase 7.  It's not safe
to instruct the storage to unmap "empty" areas if we don't know where
those empty areas are, so we need to create a phase 8 to trim the fs.
While we're at it, make it more obvious that fstrim only gets to run if
there are no unfixed corruptions and no other runtime errors have
occurred.

Finally, reduce the latency impacts on the rest of the system by
breaking up the fstrim work into a loop that targets only 16GB per call.
This enables better progress reporting for interactive runs and cgroup
based resource constraints for background runs.

This has been running on the djcloud for months with no problems.  Enjoy!

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

----------------------------------------------------------------
Darrick J. Wong (7):
xfs_scrub: move FITRIM to phase 8
xfs_scrub: ignore phase 8 if the user disabled fstrim
xfs_scrub: collapse trim_filesystem
xfs_scrub: fix the work estimation for phase 8
xfs_scrub: report FITRIM errors properly
xfs_scrub: don't call FITRIM after runtime errors
xfs_scrub: improve responsiveness while trimming the filesystem

scrub/Makefile    |   1 +
scrub/phase4.c    |  30 ++---------
scrub/phase8.c    | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
scrub/vfs.c       |  22 +++++---
scrub/vfs.h       |   2 +-
scrub/xfs_scrub.c |  11 +++-
scrub/xfs_scrub.h |   3 ++
7 files changed, 183 insertions(+), 37 deletions(-)
create mode 100644 scrub/phase8.c