summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/journal.c')
-rw-r--r--fs/bcachefs/journal.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index ce5340611de6..f22b05e02c1e 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -1376,6 +1376,7 @@ int bch2_dev_journal_alloc(struct bch_dev *ca, bool new_fs)
return bch_err_throw(c, erofs_filesystem_full);
}
+ unsigned nr;
int ret;
if (dynamic_fault("bcachefs:add:journal_alloc")) {
@@ -1384,19 +1385,16 @@ int bch2_dev_journal_alloc(struct bch_dev *ca, bool new_fs)
}
/* 1/128th of the device by default: */
- unsigned nr = ca->mi.nbuckets >> 7;
+ nr = ca->mi.nbuckets >> 7;
/*
- * clamp journal size to 8GB, or 32GB with large_journal option:
+ * clamp journal size to 8192 buckets or 8GB (in sectors), whichever
+ * is smaller:
*/
- unsigned max_sectors = 1 << 24;
-
- if (c->opts.large_journal)
- max_sectors *= 4;
-
nr = clamp_t(unsigned, nr,
BCH_JOURNAL_BUCKETS_MIN,
- max_sectors / ca->mi.bucket_size);
+ min(1 << 13,
+ (1 << 24) / ca->mi.bucket_size));
ret = bch2_set_nr_journal_buckets_loop(c, ca, nr, new_fs);
err: