• Brian Foster's avatar
    bcachefs: allow writeback to fill bio completely · 2a4e7497
    Brian Foster authored
    The bcachefs folio writeback code includes a bio full check as well
    as a fixed size check to determine when to split off and submit
    writeback I/O. The inclusive check of the latter against the limit
    means that writeback can submit slightly prematurely. This is not a
    functional problem, but results in unnecessarily split I/Os and
    extent merging.
    
    This can be observed with a buffered write sized exactly to the
    current maximum value (1MB) and with key_merging_disabled=1. The
    latter prevents the merge from the second write such that a
    subsequent check of the extent list shows a 1020k extent followed by
    a contiguous 4k extent.
    
    The purpose for the fixed size check is also undocumented and
    somewhat obscure. Lift this check into a new helper that wraps the
    bio check, fix the comparison logic, and add a comment to document
    the purpose and how we might improve on this in the future.
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    2a4e7497
fs-io-buffered.c 26.5 KB