Skip to content

Commit 6a1c432

Browse files
author
Kent Overstreet
committed
bcachefs: Tweak threshold for allocator triggering discards
The allocator path has a "if we're really low on free buckets, check if we should issue discards" - tweak this to also trigger discards if more than 1/128th of the device is in need_discard state. Signed-off-by: Kent Overstreet <[email protected]>
1 parent b4d6e20 commit 6a1c432

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/bcachefs/alloc_foreground.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
511511
bch2_dev_usage_read_fast(ca, &req->usage);
512512
avail = dev_buckets_free(ca, req->usage, req->watermark);
513513

514-
if (req->usage.buckets[BCH_DATA_need_discard] > avail)
514+
if (req->usage.buckets[BCH_DATA_need_discard] >
515+
min(avail, ca->mi.nbuckets >> 7))
515516
bch2_dev_do_discards(ca);
516517

517518
if (req->usage.buckets[BCH_DATA_need_gc_gens] > avail)

0 commit comments

Comments
 (0)