Skip to content

Commit 795413c

Browse files
author
Kent Overstreet
committed
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 <[email protected]>
1 parent 37fad94 commit 795413c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

fs/bcachefs/recovery.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,27 @@
3535

3636
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
3737

38+
static bool btree_id_is_alloc(enum btree_id id)
39+
{
40+
switch (id) {
41+
case BTREE_ID_alloc:
42+
case BTREE_ID_backpointers:
43+
case BTREE_ID_need_discard:
44+
case BTREE_ID_freespace:
45+
case BTREE_ID_bucket_gens:
46+
return true;
47+
default:
48+
return false;
49+
}
50+
}
51+
3852
/* for -o reconstruct_alloc: */
3953
static void drop_alloc_keys(struct journal_keys *keys)
4054
{
4155
size_t src, dst;
4256

4357
for (src = 0, dst = 0; src < keys->nr; src++)
44-
if (keys->d[src].btree_id != BTREE_ID_alloc)
58+
if (!btree_id_is_alloc(keys->d[src].btree_id))
4559
keys->d[dst++] = keys->d[src];
4660

4761
keys->nr = dst;
@@ -332,20 +346,6 @@ static int journal_replay_early(struct bch_fs *c,
332346

333347
/* sb clean section: */
334348

335-
static bool btree_id_is_alloc(enum btree_id id)
336-
{
337-
switch (id) {
338-
case BTREE_ID_alloc:
339-
case BTREE_ID_backpointers:
340-
case BTREE_ID_need_discard:
341-
case BTREE_ID_freespace:
342-
case BTREE_ID_bucket_gens:
343-
return true;
344-
default:
345-
return false;
346-
}
347-
}
348-
349349
static int read_btree_roots(struct bch_fs *c)
350350
{
351351
unsigned i;

0 commit comments

Comments
 (0)