diff options
-rw-r--r-- | fs/bcachefs/btree_cache.c | 5 | ||||
-rw-r--r-- | fs/bcachefs/btree_journal_iter.c | 17 | ||||
-rw-r--r-- | fs/bcachefs/btree_node_scan.c | 4 | ||||
-rw-r--r-- | fs/bcachefs/journal.c | 14 | ||||
-rw-r--r-- | fs/bcachefs/opts.h | 11 |
5 files changed, 13 insertions, 38 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c index 702c8f7081d7..49505653fe12 100644 --- a/fs/bcachefs/btree_cache.c +++ b/fs/bcachefs/btree_cache.c @@ -187,10 +187,7 @@ static struct btree *__btree_node_mem_alloc(struct bch_fs *c, gfp_t gfp) struct btree *__bch2_btree_node_mem_alloc(struct bch_fs *c) { - struct btree_cache *bc = &c->btree_cache; - struct btree *b; - - b = __btree_node_mem_alloc(c, GFP_KERNEL); + struct btree *b = __btree_node_mem_alloc(c, GFP_KERNEL); if (!b) return NULL; diff --git a/fs/bcachefs/btree_journal_iter.c b/fs/bcachefs/btree_journal_iter.c index 341d31b3a1f1..ea839560a136 100644 --- a/fs/bcachefs/btree_journal_iter.c +++ b/fs/bcachefs/btree_journal_iter.c @@ -717,18 +717,6 @@ static void __journal_keys_sort(struct journal_keys *keys) keys->nr = dst - keys->data; } -static bool should_rewind_entry(struct bch_fs *c, struct jset_entry *entry) -{ - if (entry->level) - return false; - if (btree_id_is_alloc(entry->btree_id)) - return false; - if (c->opts.journal_rewind_no_extents && - entry->btree_id == BTREE_ID_extents) - return false; - return true; -} - int bch2_journal_keys_sort(struct bch_fs *c) { struct genradix_iter iter; @@ -747,8 +735,9 @@ int bch2_journal_keys_sort(struct bch_fs *c) cond_resched(); vstruct_for_each(&i->j, entry) { - bool rewind = le64_to_cpu(i->j.seq) >= rewind_seq && - should_rewind_entry(c, entry); + bool rewind = !entry->level && + !btree_id_is_alloc(entry->btree_id) && + le64_to_cpu(i->j.seq) >= rewind_seq; if (entry->type != (rewind ? BCH_JSET_ENTRY_overwrite diff --git a/fs/bcachefs/btree_node_scan.c b/fs/bcachefs/btree_node_scan.c index cc7af8fe689e..365808b4b7c0 100644 --- a/fs/bcachefs/btree_node_scan.c +++ b/fs/bcachefs/btree_node_scan.c @@ -196,12 +196,14 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, CLASS(printbuf, buf)(); if (!bch2_btree_node_read_done(c, ca, b, NULL, &buf)) { + /* read_done will swap out b->data for another buffer */ + bn = b->data; /* * Grab journal_seq here because we want the max journal_seq of * any bset; read_done sorts down to a single set and picks the * max journal_seq */ - n.journal_seq = le64_to_cpu(b->data->keys.journal_seq), + n.journal_seq = le64_to_cpu(bn->keys.journal_seq), n.sectors_written = b->written; mutex_lock(&f->lock); 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: diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h index 4a7a60588c10..63f8e254495c 100644 --- a/fs/bcachefs/opts.h +++ b/fs/bcachefs/opts.h @@ -343,12 +343,6 @@ enum fsck_err_opts { OPT_UINT(0, U32_MAX), \ BCH_SB_JOURNAL_RECLAIM_DELAY, 100, \ NULL, "Delay in milliseconds before automatic journal reclaim")\ - x(large_journal, bool, \ - OPT_FS|OPT_MOUNT|OPT_FORMAT, \ - OPT_BOOL(), \ - BCH2_NO_SB_OPT, false, \ - NULL, "Allocate a bigger than normal journal: recovery from unclean "\ - "shutdown will be slower, but more info will be available for debugging")\ x(move_bytes_in_flight, u32, \ OPT_HUMAN_READABLE|OPT_FS|OPT_MOUNT|OPT_RUNTIME, \ OPT_UINT(1024, U32_MAX), \ @@ -395,11 +389,6 @@ enum fsck_err_opts { OPT_UINT(0, U64_MAX), \ BCH2_NO_SB_OPT, 0, \ NULL, "Rewind journal") \ - x(journal_rewind_no_extents, bool, \ - OPT_FS|OPT_MOUNT, \ - OPT_BOOL(), \ - BCH2_NO_SB_OPT, 0, \ - NULL, "Don't rewind extents when rewinding journal") \ x(recovery_passes, u64, \ OPT_FS|OPT_MOUNT, \ OPT_BITFIELD(bch2_recovery_passes), \ |