Commit 795413c5 authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 37fad949
...@@ -35,13 +35,27 @@ ...@@ -35,13 +35,27 @@
#define QSTR(n) { { { .len = strlen(n) } }, .name = n } #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: */ /* for -o reconstruct_alloc: */
static void drop_alloc_keys(struct journal_keys *keys) static void drop_alloc_keys(struct journal_keys *keys)
{ {
size_t src, dst; size_t src, dst;
for (src = 0, dst = 0; src < keys->nr; src++) 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->d[dst++] = keys->d[src];
keys->nr = dst; keys->nr = dst;
...@@ -332,20 +346,6 @@ static int journal_replay_early(struct bch_fs *c, ...@@ -332,20 +346,6 @@ static int journal_replay_early(struct bch_fs *c,
/* sb clean section: */ /* 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) static int read_btree_roots(struct bch_fs *c)
{ {
unsigned i; unsigned i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment