bcachefs: Optimize bucket reuse
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 28 Dec 2021 04:56:13 +0000 (23:56 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:20 +0000 (17:09 -0400)
commite3ad29379e47014461d540629628c2cc158c025d
tree1a03c3467b88a65fd5e06b88d1bae9a6bd377299
parent8d65e475b20610854419fef8dba155200b45a687
bcachefs: Optimize bucket reuse

If the btree updates pointing to a bucket were never flushed by the
journal before the bucket became empty again, we can reuse the bucket
without a journal flush.

This tweaks the tracking of journal sequence numbers in alloc keys to
implement this optimization: now, we only update the journal sequence
number in alloc keys on transitions to and from empty. When a bucket
becomes empty, we check if we can tell the journal not to flush entries
starting from when the bucket was used.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/buckets.c