summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-29 16:13:00 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:16 -0400
commit795413c5488536476dacff9e565e53a51d7798d8 (patch)
treef74ab4d253373e25717949d979aa5b0e4d9d423e /fs
parent37fad9497f5d37d89ed06faa64d580d1451be664 (diff)
bcachefs: Fix drop_alloc_keys()
For consistency with the rest of the reconstruct_alloc option, we should be skipping all alloc keys. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/recovery.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index cd037f2e4235..4cd660650e5b 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -35,13 +35,27 @@
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
+static bool btree_id_is_alloc(enum btree_id id)
+{
+ switch (id) {
+ case BTREE_ID_alloc:
+ case BTREE_ID_backpointers:
+ case BTREE_ID_need_discard:
+ case BTREE_ID_freespace:
+ case BTREE_ID_bucket_gens:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* for -o reconstruct_alloc: */
static void drop_alloc_keys(struct journal_keys *keys)
{
size_t src, dst;
for (src = 0, dst = 0; src < keys->nr; src++)
- if (keys->d[src].btree_id != BTREE_ID_alloc)
+ if (!btree_id_is_alloc(keys->d[src].btree_id))
keys->d[dst++] = keys->d[src];
keys->nr = dst;
@@ -332,20 +346,6 @@ static int journal_replay_early(struct bch_fs *c,
/* sb clean section: */
-static bool btree_id_is_alloc(enum btree_id id)
-{
- switch (id) {
- case BTREE_ID_alloc:
- case BTREE_ID_backpointers:
- case BTREE_ID_need_discard:
- case BTREE_ID_freespace:
- case BTREE_ID_bucket_gens:
- return true;
- default:
- return false;
- }
-}
-
static int read_btree_roots(struct bch_fs *c)
{
unsigned i;