xfs: only iget the file once when doing vectored scrub-by-handle
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 16:48:26 +0000 (09:48 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 23 Apr 2024 23:55:18 +0000 (16:55 -0700)
commit4ad350ac58627bfe81f71f43f6738e36b4eb75c6
tree8dea23bb5627e3878c8fe929742b4af5a79c5fc6
parentb27ce0da60a523fc32e3795f96b2de5490642235
xfs: only iget the file once when doing vectored scrub-by-handle

If a program wants us to perform a scrub on a file handle and the fd
passed to ioctl() is not the file referenced in the handle, iget the
file once and pass it into the scrub code.  This amortizes the untrusted
iget lookup over /all/ the scrubbers mentioned in the scrubv call.

When running fstests in "rebuild all metadata after each test" mode, I
observed a 10% reduction in runtime on account of avoiding repeated
inobt lookups.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/scrub.c