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:
Kent Overstreet
2014-03-17 15:13:26 -07:00
parent 0bd143fd80
commit 487dded86e
3 changed files with 36 additions and 65 deletions

View File

@@ -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);
}
}
}