Commit 78328fec authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Stash journal replay params in bch_fs

For the upcoming enumeration of recovery passes, we need all recovery
passes to be called the same way - including journal replay.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 10a6ced2
...@@ -993,6 +993,9 @@ struct bch_fs { ...@@ -993,6 +993,9 @@ struct bch_fs {
/* QUOTAS */ /* QUOTAS */
struct bch_memquota_type quotas[QTYP_NR]; struct bch_memquota_type quotas[QTYP_NR];
/* RECOVERY */
u64 journal_replay_seq_start;
u64 journal_replay_seq_end;
/* DEBUG JUNK */ /* DEBUG JUNK */
struct dentry *fs_debug_dir; struct dentry *fs_debug_dir;
struct dentry *btree_debug_dir; struct dentry *btree_debug_dir;
......
...@@ -624,11 +624,13 @@ static int journal_sort_seq_cmp(const void *_l, const void *_r) ...@@ -624,11 +624,13 @@ static int journal_sort_seq_cmp(const void *_l, const void *_r)
return cmp_int(l->journal_seq, r->journal_seq); return cmp_int(l->journal_seq, r->journal_seq);
} }
static int bch2_journal_replay(struct bch_fs *c, u64 start_seq, u64 end_seq) static int bch2_journal_replay(struct bch_fs *c)
{ {
struct journal_keys *keys = &c->journal_keys; struct journal_keys *keys = &c->journal_keys;
struct journal_key **keys_sorted, *k; struct journal_key **keys_sorted, *k;
struct journal *j = &c->journal; struct journal *j = &c->journal;
u64 start_seq = c->journal_replay_seq_start;
u64 end_seq = c->journal_replay_seq_start;
size_t i; size_t i;
int ret; int ret;
...@@ -1256,6 +1258,9 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1256,6 +1258,9 @@ int bch2_fs_recovery(struct bch_fs *c)
blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1; blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1;
} }
c->journal_replay_seq_start = last_seq;
c->journal_replay_seq_end = blacklist_seq - 1;;
if (c->opts.reconstruct_alloc) { if (c->opts.reconstruct_alloc) {
c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info); c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
drop_alloc_keys(&c->journal_keys); drop_alloc_keys(&c->journal_keys);
...@@ -1346,7 +1351,7 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1346,7 +1351,7 @@ int bch2_fs_recovery(struct bch_fs *c)
set_bit(BCH_FS_MAY_GO_RW, &c->flags); set_bit(BCH_FS_MAY_GO_RW, &c->flags);
bch_info(c, "starting journal replay, %zu keys", c->journal_keys.nr); bch_info(c, "starting journal replay, %zu keys", c->journal_keys.nr);
ret = bch2_journal_replay(c, last_seq, blacklist_seq - 1); ret = bch2_journal_replay(c);
if (ret) if (ret)
goto err; goto err;
if (c->opts.verbose || !c->sb.clean) if (c->opts.verbose || !c->sb.clean)
...@@ -1406,7 +1411,7 @@ int bch2_fs_recovery(struct bch_fs *c) ...@@ -1406,7 +1411,7 @@ int bch2_fs_recovery(struct bch_fs *c)
set_bit(BCH_FS_MAY_GO_RW, &c->flags); set_bit(BCH_FS_MAY_GO_RW, &c->flags);
bch_verbose(c, "starting journal replay, %zu keys", c->journal_keys.nr); bch_verbose(c, "starting journal replay, %zu keys", c->journal_keys.nr);
ret = bch2_journal_replay(c, last_seq, blacklist_seq - 1); ret = bch2_journal_replay(c);
if (ret) if (ret)
goto err; goto err;
if (c->opts.verbose || !c->sb.clean) if (c->opts.verbose || !c->sb.clean)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment