bcachefs: Increase default journal size

The default was 1/256th of the device and capped at 512MB, which is
fairly tiny these days.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2021-03-24 22:49:05 -04:00 committed by Kent Overstreet
parent a9d79c6e8b
commit 7c8b166e58

View File

@ -913,14 +913,17 @@ int bch2_dev_journal_alloc(struct bch_dev *ca)
if (dynamic_fault("bcachefs:add:journal_alloc"))
return -ENOMEM;
/* 1/128th of the device by default: */
nr = ca->mi.nbuckets >> 7;
/*
* clamp journal size to 1024 buckets or 512MB (in sectors), whichever
* clamp journal size to 8192 buckets or 8GB (in sectors), whichever
* is smaller:
*/
nr = clamp_t(unsigned, ca->mi.nbuckets >> 8,
nr = clamp_t(unsigned, nr,
BCH_JOURNAL_BUCKETS_MIN,
min(1 << 10,
(1 << 20) / ca->mi.bucket_size));
min(1 << 13,
(1 << 24) / ca->mi.bucket_size));
return __bch2_set_nr_journal_buckets(ca, nr, true, NULL);
}