Commit 6a1c4323 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent b4d6e204
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -511,7 +511,8 @@ static struct open_bucket *bch2_bucket_alloc_trans(struct btree_trans *trans,
	bch2_dev_usage_read_fast(ca, &req->usage);
	avail = dev_buckets_free(ca, req->usage, req->watermark);

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

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