• Darrick J. Wong's avatar
    xfs: implement block reservation accounting for btrees we're staging · be408417
    Darrick J. Wong authored
    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#n1349Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
    be408417
Makefile 4.19 KB