bcachefs: Allocate journal buckets sequentially
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 10 Mar 2022 20:49:03 +0000 (15:49 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:27 +0000 (17:09 -0400)
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 <kent.overstreet@gmail.com>
fs/bcachefs/journal.c

index 9d16b9d30ad70c568c46b213c86f12cff57c484f..11b44467aeabbf2ad082ec1cae168c924676a09a 100644 (file)
@@ -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);