• Kent Overstreet's avatar
    bcachefs: Fragmentation LRU · 80c33085
    Kent Overstreet authored
    Now that we have much more efficient updates to the LRU btree, this
    patch adds a new LRU that indexes buckets by fragmentation.
    
    This means copygc no longer has to scan every bucket to find buckets
    that need to be evacuated.
    
    Changes:
     - A new field in bch_alloc_v4, fragmentation_lru - this corresponds to
       the bucket's position in the fragmentation LRU. We add a new field
       for this instead of calculating it as needed because we may make the
       fragmentation LRU optional; this field indicates whether a bucket is
       on the fragmentation LRU.
    
       Also, zoned devices will introduce variable bucket sizes; explicitly
       recording the LRU position will be safer for them.
    
     - A new copygc path for using the fragmentation LRU instead of
       scanning every bucket and building up an in-memory heap.
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    80c33085
move.h 2.33 KB