From: Carlos Maiolino Date: Tue, 6 Aug 2024 13:47:58 +0000 (+0200) Subject: Merge tag 'scrub-fstrim-minlen-freesp-histogram-6.10_2024-07-29' of https://git.kerne... X-Git-Tag: v6.10.0~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc4a2d4ee566783f8e8b0e7ae670398d35496e0d;p=thirdparty%2Fxfsprogs-dev.git Merge tag 'scrub-fstrim-minlen-freesp-histogram-6.10_2024-07-29' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev into for-next xfs_scrub: use free space histograms to reduce fstrim runtime [v30.9 13/28] This patchset dramatically reduces the runtime of the FITRIM calls made during phase 8 of xfs_scrub. It turns out that phase 8 can really get bogged down if the free space contains a large number of very small extents. In these cases, the runtime can increase by an order of magnitude to free less than 1%% of the free space. This is not worth the time, since we're spending a lot of time to do very little work. The FITRIM ioctl allows us to specify a minimum extent length, so we can use statistical methods to compute a minlen parameter. It turns out xfs_db/spaceman already have the code needed to create histograms of free space extent lengths. We add the ability to compute a CDF of the extent lengths, which make it easy to pick a minimum length corresponding to 99%% of the free space. In most cases, this results in dramatic reductions in phase 8 runtime. Hence, move the histogram code to libfrog, and wire up xfs_scrub, since phase 7 already walks the fsmap. We also add a new -o suboption to xfs_scrub so that people who /do/ want to examine every free extent can do so. This has been running on the djcloud for months with no problems. Enjoy! Signed-off-by: Darrick J. Wong --- cc4a2d4ee566783f8e8b0e7ae670398d35496e0d