bcachefs: opts.read_journal_only
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 19 Feb 2022 10:15:53 +0000 (05:15 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:24 +0000 (17:09 -0400)
Add an option that tells recovery to only read the journal, to be used
by the list_journal command.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/opts.h
fs/bcachefs/recovery.c

index 57c829b6eee1e61ec0daf3f188516799fa36eb79..b03cac016f0be033794191efde51628bddb65816 100644 (file)
@@ -329,6 +329,11 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          NO_SB_OPT,                    false,                          \
          NULL,         "Read all journal entries, not just dirty ones")\
+       x(read_journal_only,            u8,                             \
+         0,                                                            \
+         OPT_BOOL(),                                                   \
+         NO_SB_OPT,                    false,                          \
+         NULL,         "Only read the journal, skip the rest of recovery")\
        x(journal_transaction_names,    u8,                             \
          OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,                      \
          OPT_BOOL(),                                                   \
index 3fef06faf32fe557db26925a998496102841c615..7def5938e24d47cd0fe982c1731beaa205190465 100644 (file)
@@ -1072,6 +1072,9 @@ use_clean:
                blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1;
        }
 
+       if (c->opts.read_journal_only)
+               goto out;
+
        if (c->opts.reconstruct_alloc) {
                c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
                drop_alloc_keys(&c->journal_keys);