提交 27201cfd 编写于 作者: K Kent Overstreet

bcache: Fix a journalling reclaim after recovery bug

On recovery we weren't correctly keeping track of what journal buckets had open
journal entries, thus it was possible for them to be overwritten until we'd
written all new journal entries.
Signed-off-by: NKent Overstreet <kmo@daterainc.com>
上级 65ddf45a
...@@ -237,8 +237,14 @@ int bch_journal_read(struct cache_set *c, struct list_head *list) ...@@ -237,8 +237,14 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)
for (i = 0; i < ca->sb.njournal_buckets; i++) for (i = 0; i < ca->sb.njournal_buckets; i++)
if (ja->seq[i] > seq) { if (ja->seq[i] > seq) {
seq = ja->seq[i]; seq = ja->seq[i];
ja->cur_idx = ja->discard_idx = /*
ja->last_idx = i; * When journal_reclaim() goes to allocate for
* the first time, it'll use the bucket after
* ja->cur_idx
*/
ja->cur_idx = i;
ja->last_idx = ja->discard_idx = (i + 1) %
ca->sb.njournal_buckets;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册