linux/fs/xfs/scrub
Darrick J. Wong be40841763 xfs: implement block reservation accounting for btrees we're staging
Create a new xrep_newbt structure to encapsulate a fake root for
creating a staged btree cursor as well as to track all the blocks that
we need to reserve in order to build that btree.

As for the particular choice of lowspace thresholds and btree block
slack factors -- at this point one could say that the thresholds in
online repair come from bulkload_estimate_ag_slack in xfs_repair[1].
But that's not the entire story, since the offline btree rebuilding
code in xfs_repair was merged as a retroport of the online btree code
in this patchset!

Before xfs_btree_staging.[ch] came along, xfs_repair determined the
slack factor (aka the number of slots to leave unfilled in each new
btree block) via open-coded logic in repair/phase5.c[2].  At that point
the slack factors were arbitrary quantities per btree.  The rmapbt
automatically left 10 slots free; everything else left zero.

That had a noticeable effect on performance straight after mounting
because adding records to /any/ btree would result in splits.  A few
years ago when this patch was first written, Dave and I decided that
repair should generate btree blocks that were 75% full unless space was
tight, in which case it should try to fill the blocks to nearly full.
We defined tight as ~10% free to avoid repair failures but settled on
3/32 (~9%) to avoid div64.

IOWs, we mostly pulled the thresholds out of thin air.  We've been
QAing with those geometry numbers ever since. ;)

Link: https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/tree/repair/bulkload.c?h=v6.5.0#n114
Link: https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/tree/repair/phase5.c?h=v4.19.0#n1349
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2023-12-06 18:45:18 -08:00
..
agheader_repair.c xfs: fix agf_fllast when repairing an empty AGFL 2023-08-10 07:48:11 -07:00
agheader.c xfs: teach scrub to check for sole ownership of metadata objects 2023-04-11 19:00:15 -07:00
alloc.c xfs: flag free space btree records that could be merged 2023-04-11 19:00:26 -07:00
attr.c xfs: don't load local xattr values during scrub 2023-04-11 19:00:35 -07:00
attr.h xfs: check used space of shortform xattr structures 2023-04-11 19:00:33 -07:00
bitmap.c xfs: use per-AG bitmaps to reap unused AG metadata blocks during repair 2023-08-10 07:48:04 -07:00
bitmap.h xfs: use per-AG bitmaps to reap unused AG metadata blocks during repair 2023-08-10 07:48:04 -07:00
bmap.c xfs: rename xfs_verify_rtext to xfs_verify_rtbext 2023-10-17 16:24:22 -07:00
btree.c xfs: teach scrub to check for sole ownership of metadata objects 2023-04-11 19:00:15 -07:00
btree.h overflow: Add struct_size_t() helper 2023-05-26 13:52:19 -07:00
common.c xfs: make xchk_iget safer in the presence of corrupt inode btrees 2023-12-06 18:45:17 -08:00
common.h xfs: make xchk_iget safer in the presence of corrupt inode btrees 2023-12-06 18:45:17 -08:00
dabtree.c xfs: scrub should use ECHRNG to signal that the drain is needed 2023-04-11 19:00:00 -07:00
dabtree.h xfs: update copyright years for scrub/ files 2023-04-11 18:59:57 -07:00
dir.c xfs: manage inode DONTCACHE status at irele time 2023-04-11 19:00:20 -07:00
fscounters.c xfs: move the xfs_rtbitmap.c declarations to xfs_rtbitmap.h 2023-10-17 16:24:22 -07:00
health.c xfs: always rescan allegedly healthy per-ag metadata after repair 2023-08-10 07:48:09 -07:00
health.h xfs: update copyright years for scrub/ files 2023-04-11 18:59:57 -07:00
ialloc.c xfs: rewrite xchk_inode_is_allocated to work properly 2023-08-10 07:48:12 -07:00
inode.c xfs: make xchk_iget safer in the presence of corrupt inode btrees 2023-12-06 18:45:17 -08:00
newbt.c xfs: implement block reservation accounting for btrees we're staging 2023-12-06 18:45:18 -08:00
newbt.h xfs: implement block reservation accounting for btrees we're staging 2023-12-06 18:45:18 -08:00
parent.c xfs: wrap ilock/iunlock operations on sc->ip 2023-08-10 07:48:08 -07:00
quota.c xfs: wrap ilock/iunlock operations on sc->ip 2023-08-10 07:48:08 -07:00
readdir.c xfs: streamline the directory iteration code for scrub 2023-04-11 19:00:17 -07:00
readdir.h xfs: streamline the directory iteration code for scrub 2023-04-11 19:00:17 -07:00
reap.c xfs: remove __xfs_free_extent_later 2023-12-06 18:45:18 -08:00
reap.h xfs: use per-AG bitmaps to reap unused AG metadata blocks during repair 2023-08-10 07:48:04 -07:00
refcount.c xfs: fix duplicate includes 2023-04-20 08:18:34 +10:00
repair.c xfs: track usage statistics of online fsck 2023-08-10 07:48:07 -07:00
repair.h xfs: track usage statistics of online fsck 2023-08-10 07:48:07 -07:00
rmap.c xfs: cross-reference rmap records with refcount btrees 2023-04-11 19:00:39 -07:00
rtbitmap.c xfs: convert do_div calls to xfs_rtb_to_rtx helper calls 2023-10-17 16:25:55 -07:00
rtsummary.c xfs: simplify rt bitmap/summary block accessor functions 2023-10-19 08:33:42 -07:00
scrub.c xfs: only call xchk_stats_merge after validating scrub inputs 2023-09-12 10:31:08 -07:00
scrub.h New code for 6.6: 2023-08-30 12:34:12 -07:00
stats.c xfs: only call xchk_stats_merge after validating scrub inputs 2023-09-12 10:31:08 -07:00
stats.h xfs: track usage statistics of online fsck 2023-08-10 07:48:07 -07:00
symlink.c xfs: update copyright years for scrub/ files 2023-04-11 18:59:57 -07:00
trace.c xfs: use accessor functions for summary info words 2023-10-18 16:53:00 -07:00
trace.h xfs: implement block reservation accounting for btrees we're staging 2023-12-06 18:45:18 -08:00
xfarray.c xfs: improve xfarray quicksort pivot 2023-08-10 07:48:07 -07:00
xfarray.h xfs: improve xfarray quicksort pivot 2023-08-10 07:48:07 -07:00
xfile.c xfs: Remove duplicate include 2023-10-12 10:14:45 +05:30
xfile.h xfs: cache pages used for xfarray quicksort convergence 2023-08-10 07:48:06 -07:00
xfs_scrub.h xfs: update copyright years for scrub/ files 2023-04-11 18:59:57 -07:00