bcache: Fix another bug recovering from unclean shutdown
The on disk bucket gens are allowed to be out of date, when we reuse buckets that didn't have any live data in them. To deal with this, the initial gc has to update the bucket gen when we find a pointer gen newer than the bucket's gen. Unfortunately we weren't doing this for pointers in the journal that we're about to replay. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
This commit is contained in:
@@ -293,21 +293,12 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list)
|
||||
k < bset_bkey_last(&i->j);
|
||||
k = bkey_next(k)) {
|
||||
unsigned j;
|
||||
struct bucket *g;
|
||||
|
||||
for (j = 0; j < KEY_PTRS(k); j++) {
|
||||
if (!ptr_available(c, k, j))
|
||||
continue;
|
||||
for (j = 0; j < KEY_PTRS(k); j++)
|
||||
if (ptr_available(c, k, j))
|
||||
atomic_inc(&PTR_BUCKET(c, k, j)->pin);
|
||||
|
||||
g = PTR_BUCKET(c, k, j);
|
||||
atomic_inc(&g->pin);
|
||||
|
||||
if (g->prio == BTREE_PRIO &&
|
||||
!ptr_stale(c, k, j))
|
||||
g->prio = INITIAL_PRIO;
|
||||
}
|
||||
|
||||
__bch_btree_mark_key(c, 0, k);
|
||||
bch_initial_mark_key(c, 0, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user