From f6c92ebbb8f84ad9b993691b02d5b38736b7a922 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 10 Mar 2022 15:49:03 -0500 Subject: [PATCH] bcachefs: Allocate journal buckets sequentially This tweaks __bch2_set_nr_journal_buckets() so that we aren't reversing their order in the jorunal anymore - nice for rotating disks. Signed-off-by: Kent Overstreet --- fs/bcachefs/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 9d16b9d30ad70..11b44467aeabb 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -837,7 +837,7 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, * superblock before inserting into the journal array */ - pos = ja->nr ? (ja->cur_idx + 1) % ja->nr : 0; + pos = ja->discard_idx ?: ja->nr; __array_insert_item(ja->buckets, ja->nr, pos); __array_insert_item(ja->bucket_seq, ja->nr, pos); __array_insert_item(journal_buckets->buckets, ja->nr, pos); -- 2.30.2