• Kent Overstreet's avatar
    bcachefs: Run insert triggers before overwrite triggers · f0c3f88b
    Kent Overstreet authored
    Currently, btree triggers are run in natural key order, which presents a
    problem for fallocate in INSERT_RANGE mode: since we're moving existing
    extents to higher offsets, the trigger for deleting the old extent runs
    before the trigger that adds the new extent, potentially leading to
    indirect extents being deleted that shouldn't be when the delete causes
    the refcount to hit 0.
    
    This changes the order we run triggers so that for a givin btree, we run
    all insert triggers before overwrite triggers, nicely sidestepping this
    issue.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
    f0c3f88b
buckets.h 7.71 KB