diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-03-17 15:13:26 -0700 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-03-18 12:22:33 -0700 |
commit | 487dded86ea065317aea121bec8f1816f2f235c9 (patch) | |
tree | 3d333832a9b133156985af197d1bd2952b033c6b /drivers/md/bcache/journal.c | |
parent | 0bd143fd800055b1db756693289bbebdb93f2a73 (diff) |
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>
Diffstat (limited to 'drivers/md/bcache/journal.c')
-rw-r--r-- | drivers/md/bcache/journal.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 4152a9119896..cf8e0932aad2 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -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); } } } |