summaryrefslogtreecommitdiff
path: root/cmd_debug.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-01 14:21:20 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2022-03-02 15:25:57 -0500
commit465e90314cc5e6f910933d092c8b0b2965a5c32b (patch)
tree5e886187a223693056ead996140d97ddd94718da /cmd_debug.c
parent87f685d12948bf89a791f3472dd9c244ea7d6c28 (diff)
cmd_list_journal: Indicate which journal entries are blacklisted
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'cmd_debug.c')
-rw-r--r--cmd_debug.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/cmd_debug.c b/cmd_debug.c
index 10eef75f..36cadfa9 100644
--- a/cmd_debug.c
+++ b/cmd_debug.c
@@ -18,6 +18,7 @@
#include "libbcachefs/error.h"
#include "libbcachefs/journal.h"
#include "libbcachefs/journal_io.h"
+#include "libbcachefs/journal_seq_blacklist.h"
#include "libbcachefs/super.h"
static void dump_usage(void)
@@ -577,6 +578,17 @@ static void list_journal_usage(void)
"Report bugs to <linux-bcache@vger.kernel.org>");
}
+static void star_start_of_lines(char *buf)
+{
+ char *p = buf;
+
+ if (*p == ' ')
+ *p = '*';
+
+ while ((p = strstr(p, "\n ")))
+ p[1] = '*';
+}
+
int cmd_list_journal(int argc, char *argv[])
{
struct bch_opts opts = bch2_opts_empty();
@@ -610,21 +622,34 @@ int cmd_list_journal(int argc, char *argv[])
struct journal_replay *p;
struct jset_entry *entry;
+ struct printbuf buf = PRINTBUF;
list_for_each_entry(p, &c->journal_entries, list) {
- struct printbuf buf = PRINTBUF;
+ bool blacklisted =
+ bch2_journal_seq_is_blacklisted(c,
+ le64_to_cpu(p->j.seq), false);
- bch2_journal_ptrs_to_text(&buf, c, p);
- printf("journal entry %llu\n"
- " version %u\n"
- " last seq %llu\n"
- " written at %s\n"
- ,
- le64_to_cpu(p->j.seq),
+ if (blacklisted)
+ printf("blacklisted ");
+
+ printf("journal entry %llu\n", le64_to_cpu(p->j.seq));
+
+ printbuf_reset(&buf);
+
+ pr_buf(&buf,
+ " version %u\n"
+ " last seq %llu\n"
+ " flush %u\n"
+ " written at ",
le32_to_cpu(p->j.version),
le64_to_cpu(p->j.last_seq),
- buf.buf);
+ !JSET_NO_FLUSH(&p->j));
+ bch2_journal_ptrs_to_text(&buf, c, p);
+
+ if (blacklisted)
+ star_start_of_lines(buf.buf);
+ printf("%s\n", buf.buf);
vstruct_for_each(&p->j, entry) {
printbuf_reset(&buf);
@@ -636,12 +661,14 @@ int cmd_list_journal(int argc, char *argv[])
pr_indent_push(&buf,
entry->type == BCH_JSET_ENTRY_log ? 2 : 4);
bch2_journal_entry_to_text(&buf, c, entry);
+
+ if (blacklisted)
+ star_start_of_lines(buf.buf);
printf("%s\n", buf.buf);
}
-
- printbuf_exit(&buf);
}
+ printbuf_exit(&buf);
bch2_fs_stop(c);
return 0;
}