linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>,
	bfoster@redhat.com, sandeen@redhat.com
Subject: [PATCH 08/10] bcachefs: Stash journal replay params in bch_fs
Date: Sun,  9 Jul 2023 13:15:49 -0400	[thread overview]
Message-ID: <20230709171551.2349961-9-kent.overstreet@linux.dev> (raw)
In-Reply-To: <20230709171551.2349961-1-kent.overstreet@linux.dev>

For the upcoming enumeration of recovery passes, we need all recovery
passes to be called the same way - including journal replay.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 fs/bcachefs/bcachefs.h |  3 +++
 fs/bcachefs/recovery.c | 11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 1ab32b61f0..67ed55761a 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -993,6 +993,9 @@ struct bch_fs {
 	/* QUOTAS */
 	struct bch_memquota_type quotas[QTYP_NR];
 
+	/* RECOVERY */
+	u64			journal_replay_seq_start;
+	u64			journal_replay_seq_end;
 	/* DEBUG JUNK */
 	struct dentry		*fs_debug_dir;
 	struct dentry		*btree_debug_dir;
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 4c61a28e49..1499efc9d2 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -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);
 }
 
-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_key **keys_sorted, *k;
 	struct journal *j = &c->journal;
+	u64 start_seq	= c->journal_replay_seq_start;
+	u64 end_seq	= c->journal_replay_seq_start;
 	size_t i;
 	int ret;
 
@@ -1256,6 +1258,9 @@ int bch2_fs_recovery(struct bch_fs *c)
 		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) {
 		c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
 		drop_alloc_keys(&c->journal_keys);
@@ -1346,7 +1351,7 @@ int bch2_fs_recovery(struct bch_fs *c)
 		set_bit(BCH_FS_MAY_GO_RW, &c->flags);
 
 		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)
 			goto err;
 		if (c->opts.verbose || !c->sb.clean)
@@ -1406,7 +1411,7 @@ int bch2_fs_recovery(struct bch_fs *c)
 		set_bit(BCH_FS_MAY_GO_RW, &c->flags);
 
 		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)
 			goto err;
 		if (c->opts.verbose || !c->sb.clean)
-- 
2.40.1


  parent reply	other threads:[~2023-07-09 17:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-09 17:15 [PATCH 00/10] bcachefs - semvar, forward compatibility Kent Overstreet
2023-07-09 17:15 ` [PATCH 01/10] bcachefs: Allow for unknown btree IDs Kent Overstreet
2023-07-09 17:15 ` [PATCH 02/10] bcachefs: Allow for unknown key types Kent Overstreet
2023-07-09 17:15 ` [PATCH 03/10] bcachefs: Refactor bch_sb_field_ops handling Kent Overstreet
2023-07-09 17:15 ` [PATCH 04/10] bcachefs: Change check for invalid key types Kent Overstreet
2023-07-09 17:15 ` [PATCH 05/10] bcachefs: BCH_SB_VERSION_UPGRADE_COMPLETE() Kent Overstreet
2023-07-13 13:42   ` Brian Foster
2023-07-13 15:31     ` Kent Overstreet
2023-07-09 17:15 ` [PATCH 06/10] bcachefs: version_upgrade is now an enum Kent Overstreet
2023-07-09 17:15 ` [PATCH 07/10] bcachefs: Kill bch2_bucket_gens_read() Kent Overstreet
2023-07-09 17:15 ` Kent Overstreet [this message]
2023-07-09 17:15 ` [PATCH 09/10] bcachefs: Enumerate recovery passes Kent Overstreet
2023-07-09 17:15 ` [PATCH 10/10] bcachefs: bcachefs_metadata_version_major_minor Kent Overstreet
2023-07-09 17:49   ` Thomas Weißschuh
2023-07-09 18:31     ` Kent Overstreet
2023-07-09 19:29       ` Thomas Weißschuh
2023-07-09 20:08         ` Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230709171551.2349961-9-kent.overstreet@linux.dev \
    --to=kent.overstreet@linux.dev \
    --cc=bfoster@redhat.com \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).