xfs: reduce iget overhead in scrub [v13.4 8/9]

This patchset looks to reduce iget overhead in two ways: First, a
 previous patch conditionally set DONTCACHE on inodes during xchk_irele
 on the grounds that we knew better at irele time if an inode should be
 dropped.  Unfortunately, over time that patch morphed into a call to
 d_mark_dontcache, which resulted in inodes being dropped even if they
 were referenced by the dcache.  This actually caused *more* recycle
 overhead than if we'd simply called xfs_iget to set DONTCACHE only on
 misses.
 
 The second patch reduces the cost of untrusted iget for a vectored scrub
 call by having the scrubv code maintain a separate refcount to the inode
 so that the cache will always hit.
 
 This has been running on the djcloud for months with no problems.  Enjoy!
 
 Signed-off-by: Darrick J. Wong <djwong@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQQ2qTKExjcn+O1o2YRKO3ySh0YRpgUCZih1NwAKCRBKO3ySh0YR
 ppWZAPsGOI6tY2LP4pqA3M2BzsERBICC8uflKeeUbYF12p/c3wEAyLaHWnVhD36D
 rP/dVedTTuhpZQBAd6mdfA5puq72PgU=
 =bSz3
 -----END PGP SIGNATURE-----

Merge tag 'reduce-scrub-iget-overhead-6.10_2024-04-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.10-mergeC

xfs: reduce iget overhead in scrub

This patchset looks to reduce iget overhead in two ways: First, a
previous patch conditionally set DONTCACHE on inodes during xchk_irele
on the grounds that we knew better at irele time if an inode should be
dropped.  Unfortunately, over time that patch morphed into a call to
d_mark_dontcache, which resulted in inodes being dropped even if they
were referenced by the dcache.  This actually caused *more* recycle
overhead than if we'd simply called xfs_iget to set DONTCACHE only on
misses.

The second patch reduces the cost of untrusted iget for a vectored scrub
call by having the scrubv code maintain a separate refcount to the inode
so that the cache will always hit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>

* tag 'reduce-scrub-iget-overhead-6.10_2024-04-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: only iget the file once when doing vectored scrub-by-handle
  xfs: use dontcache for grabbing inodes during scrub
This commit is contained in:
Chandan Babu R 2024-04-24 12:27:33 +05:30
commit b878dbbe2a
4 changed files with 66 additions and 11 deletions