diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-29 08:44:31 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-02-03 14:08:49 -0500 |
commit | 3fcc955d00d3e395f33ca85d3050fddefea23491 (patch) | |
tree | 843a8e9be01a0cd87c604d7ef86dd51c3707213e /c_src/cmd_list_journal.c | |
parent | c4e25c6c3c9dcbfb151d18462d458099bb8f88be (diff) |
Scrub
Implement 'bcachefs data scrub', frontend for
BCH_IOCTL_DATA.BCH_DATA_OP_scrub.
Takes a path to a device, mountpoint, or filesystem uuid. Can be run on
a specific device by passing a device, or if run on a filesystem scrubs
all devices in parallel.
Metadata only scrubbing is supported via -m.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/cmd_list_journal.c')
-rw-r--r-- | c_src/cmd_list_journal.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/c_src/cmd_list_journal.c b/c_src/cmd_list_journal.c index fe7f9b05..93efc362 100644 --- a/c_src/cmd_list_journal.c +++ b/c_src/cmd_list_journal.c @@ -51,6 +51,11 @@ static inline bool entry_is_transaction_start(struct jset_entry *entry) return entry->type == BCH_JSET_ENTRY_log && !entry->level; } +static inline bool entry_is_log_msg(struct jset_entry *entry) +{ + return entry->type == BCH_JSET_ENTRY_log && entry->level; +} + typedef DARRAY(struct bbpos_range) d_bbpos_range; typedef DARRAY(enum btree_id) d_btree_id; @@ -60,8 +65,8 @@ static bool bkey_matches_filter(d_bbpos_range filter, struct jset_entry *entry, struct bbpos k_start = BBPOS(entry->btree_id, bkey_start_pos(&k->k)); struct bbpos k_end = BBPOS(entry->btree_id, k->k.p); - if (bbpos_cmp(k_start, i->end) < 0 && - bbpos_cmp(k_end, i->start) > 0) + if (bbpos_cmp(k_start, i->start) >= 0 && + bbpos_cmp(k_end, i->end) <= 0) return true; } return false; @@ -96,7 +101,8 @@ static bool should_print_transaction(struct jset_entry *entry, struct jset_entry for (entry = vstruct_next(entry); entry != end && !entry_is_transaction_start(entry); entry = vstruct_next(entry)) - if (entry_matches_transaction_filter(entry, key_filter)) + if (entry_is_log_msg(entry) || + entry_matches_transaction_filter(entry, key_filter)) return true; return false; |