xfs: online repair for fs summary counters [v29.3 06/18]

A longstanding deficiency in the online fs summary counter scrubbing
 code is that it hasn't any means to quiesce the incore percpu counters
 while it's running.  There is no way to coordinate with other threads
 are reserving or freeing free space simultaneously, which leads to false
 error reports.  Right now, if the discrepancy is large, we just sort of
 shrug and bail out with an incomplete flag, but this is lame.
 
 For repair activity, we actually /do/ need to stabilize the counters to
 get an accurate reading and install it in the percpu counter.  To
 improve the former and enable the latter, allow the fscounters online
 fsck code to perform an exclusive mini-freeze on the filesystem.  The
 exclusivity prevents userspace from thawing while we're running, and the
 mini-freeze means that we don't wait for the log to quiesce, which will
 make both speedier.
 
 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+O1o2YRKO3ySh0YRpgUCZdlBYQAKCRBKO3ySh0YR
 pjYgAQCHdKKwkD0bAZyKT6By30Vxiahey5HUrlLvg1QeGIzXlAD/e4oLwdfxYrcr
 1wL7GTDix9eVJSMe7ZSgmxX4W9KVMAE=
 =CqKZ
 -----END PGP SIGNATURE-----

Merge tag 'repair-fscounters-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux into xfs-6.9-mergeC

xfs: online repair for fs summary counters

A longstanding deficiency in the online fs summary counter scrubbing
code is that it hasn't any means to quiesce the incore percpu counters
while it's running.  There is no way to coordinate with other threads
are reserving or freeing free space simultaneously, which leads to false
error reports.  Right now, if the discrepancy is large, we just sort of
shrug and bail out with an incomplete flag, but this is lame.

For repair activity, we actually /do/ need to stabilize the counters to
get an accurate reading and install it in the percpu counter.  To
improve the former and enable the latter, allow the fscounters online
fsck code to perform an exclusive mini-freeze on the filesystem.  The
exclusivity prevents userspace from thawing while we're running, and the
mini-freeze means that we don't wait for the log to quiesce, which will
make both speedier.

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

* tag 'repair-fscounters-6.9_2024-02-23' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: repair summary counters
This commit is contained in:
Chandan Babu R 2024-02-24 09:58:28 +05:30
commit 5d1bd19d83
8 changed files with 128 additions and 18 deletions