diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-16 01:08:25 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-13 21:22:25 -0400 |
commit | a393f3312387597d2e3b6b44bf50ef7f105f623d (patch) | |
tree | 6f35e657b442b598aebe50a8238cb02c45e808bf /fs/bcachefs/alloc_background.h | |
parent | 06d493fee43be69580082f7b9b48c4d3f9c9de64 (diff) | |
download | linux-a393f3312387597d2e3b6b44bf50ef7f105f623d.tar.gz linux-a393f3312387597d2e3b6b44bf50ef7f105f623d.tar.bz2 linux-a393f3312387597d2e3b6b44bf50ef7f105f623d.zip |
bcachefs: Split out discard fastpath
Buckets usually can't be discarded until the transaction that made them
empty has been committed in the journal.
Tracing has indicated that we're queuing the discard worker excessively,
only for it to skip over many buckets that are still waiting on a
journal commit, discarding only one or two buckets per iteration.
We want to switch to only queuing the discard worker after a journal
flush write, but there's an important optimization we need to preserve:
if a bucket becomes empty and it was never committed in the journal
while it was in use, we want to discard it and reuse it right away -
since overwriting it before the previous writes are flushed from the
device cache eans those writes only cost bus bandwidth.
So, this patch implements a fast path for buckets that can be discarded
right away. We need new locking between the two discard workers; the new
list of buckets being discarded provides that locking.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.h')
-rw-r--r-- | fs/bcachefs/alloc_background.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h index e7f7e842ee1b..052b2fac25d6 100644 --- a/fs/bcachefs/alloc_background.h +++ b/fs/bcachefs/alloc_background.h @@ -269,6 +269,7 @@ u64 bch2_min_rw_member_capacity(struct bch_fs *); void bch2_dev_allocator_remove(struct bch_fs *, struct bch_dev *); void bch2_dev_allocator_add(struct bch_fs *, struct bch_dev *); +void bch2_fs_allocator_background_exit(struct bch_fs *); void bch2_fs_allocator_background_init(struct bch_fs *); #endif /* _BCACHEFS_ALLOC_BACKGROUND_H */ |