• Kent Overstreet's avatar
    bcachefs: New discard implementation · 59cc38b8
    Kent Overstreet authored
    In the old allocator code, buckets would be discarded just prior to
    being used - this made sense in bcache where we were discarding buckets
    just after invalidating the cached data they contain, but in a
    filesystem where we typically have more free space we want to be
    discarding buckets when they become empty.
    
    This patch implements the new behaviour - it checks the need_discard
    btree for buckets awaiting discards, and then clears the appropriate
    bit in the alloc btree, which moves the buckets to the freespace btree.
    
    Additionally, discards are now enabled by default.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    59cc38b8
super.c 44.9 KB