Hi all, Improve the performance of xfs_scrub when scrubbing file metadata by using the file descriptor to issue scrub ioctls instead of scrubbing by handle. This saves us from having to do an untrusted iget (since we have an open fd, we know the inode number is good) for every single scrub invocation. Surprisingly, this adds up to about a 3% reduction in runtime for phase 3. Second, if the filesystem doesn't require any repair work and scrub was invoked in wet run (aka no -n) mode, then the only work for phase 4 is to run FITRIM. In this case, phase 4 can skip the precautionary fscounter scan that we do before running metadata repairs since we'll do that during phase 7. If you're going to start using this mess, you probably ought to just pull from my git trees, which are linked below. This is an extraordinary way to destroy everything. Enjoy! Comments and questions are, as always, welcome. --D xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=scrub-performance-tweaks --- scrub/phase3.c | 122 ++++++++++++++++++++++++++++++++++++++++---------------- scrub/phase4.c | 55 ++++++++++++++++++++----- scrub/phase7.c | 2 - scrub/repair.c | 17 +++++++- scrub/repair.h | 6 +++ scrub/scrub.c | 120 ++++++++++++------------------------------------------- scrub/scrub.h | 23 ++--------- 7 files changed, 185 insertions(+), 160 deletions(-)