Commit a24eab59 authored by Igor Konopko's avatar Igor Konopko Committed by Jens Axboe

lightnvm: pblk: recover only written metadata

This patch ensures that smeta was fully written before even
trying to read it based on chunk table state and write pointer.
Signed-off-by: default avatarIgor Konopko <igor.j.konopko@intel.com>
Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3e03f632
...@@ -655,10 +655,12 @@ static int pblk_line_was_written(struct pblk_line *line, ...@@ -655,10 +655,12 @@ static int pblk_line_was_written(struct pblk_line *line,
bppa = pblk->luns[smeta_blk].bppa; bppa = pblk->luns[smeta_blk].bppa;
chunk = &line->chks[pblk_ppa_to_pos(geo, bppa)]; chunk = &line->chks[pblk_ppa_to_pos(geo, bppa)];
if (chunk->state & NVM_CHK_ST_FREE) if (chunk->state & NVM_CHK_ST_CLOSED ||
return 0; (chunk->state & NVM_CHK_ST_OPEN
&& chunk->wp >= lm->smeta_sec))
return 1;
return 1; return 0;
} }
static bool pblk_line_is_open(struct pblk *pblk, struct pblk_line *line) static bool pblk_line_is_open(struct pblk *pblk, struct pblk_line *line)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment