summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-20 05:20:58 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:46 +0300
commitff56d68cf9ea04504be94eb7a476efcb92028a42 (patch)
treef054c63a315609967c217fbe19b8eb6cf33ad37c /fs/bcachefs/journal_io.c
parent96c2e01083f19c75421002bebb819a668839184e (diff)
downloadlinux-ff56d68cf9ea04504be94eb7a476efcb92028a42.tar.xz
bcachefs: Improve journal_read() logging
Print out the journal entries we read and will replay as soon as possible - if we get an error walidating keys it's helpful to know where it was in the journal. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.c')
-rw-r--r--fs/bcachefs/journal_io.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 6b9bd1f55fe3..485fd6f3003b 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1106,7 +1106,6 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
struct bch_dev *ca;
unsigned iter;
struct printbuf buf = PRINTBUF;
- size_t keys = 0, entries = 0;
bool degraded = false;
u64 seq, last_seq = 0;
int ret = 0;
@@ -1137,7 +1136,8 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
if (jlist.ret)
return jlist.ret;
- *start_seq = 0;
+ *start_seq = 0;
+ *blacklist_seq = 0;
/*
* Find most recent flush entry, and ignore newer non flush entries -
@@ -1150,7 +1150,7 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
continue;
if (!*start_seq)
- *start_seq = le64_to_cpu(i->j.seq) + 1;
+ *blacklist_seq = *start_seq = le64_to_cpu(i->j.seq) + 1;
if (!JSET_NO_FLUSH(&i->j)) {
int write = READ;
@@ -1180,6 +1180,13 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
goto err;
}
+ bch_info(c, "journal read done, replaying entries %llu-%llu",
+ last_seq, *blacklist_seq - 1);
+
+ if (*start_seq != *blacklist_seq)
+ bch_info(c, "dropped unflushed entries %llu-%llu",
+ *blacklist_seq, *start_seq - 1);
+
/* Drop blacklisted entries and entries older than last_seq: */
genradix_for_each(&c->journal_entries, radix_iter, _i) {
i = *_i;
@@ -1252,8 +1259,6 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
}
genradix_for_each(&c->journal_entries, radix_iter, _i) {
- struct jset_entry *entry;
- struct bkey_i *k, *_n;
struct bch_replicas_padded replicas = {
.e.data_type = BCH_DATA_journal,
.e.nr_required = 1,
@@ -1303,18 +1308,7 @@ int bch2_journal_read(struct bch_fs *c, u64 *blacklist_seq, u64 *start_seq)
if (ret)
goto err;
}
-
- for_each_jset_key(k, _n, entry, &i->j)
- keys++;
- entries++;
}
-
- bch_info(c, "journal read done, %zu keys in %zu entries, seq %llu",
- keys, entries, *start_seq);
-
- if (*start_seq != *blacklist_seq)
- bch_info(c, "dropped unflushed entries %llu-%llu",
- *blacklist_seq, *start_seq - 1);
err:
fsck_err:
printbuf_exit(&buf);