Commit b5e063a2 authored by Javier González's avatar Javier González Committed by Jens Axboe

lightnvm: pblk: add initialization check

Add a sanity check to the pblk initialization sequence in order to
ensure that enough LUNs have been allocated to store the line metadata.
Signed-off-by: default avatarJavier González <javier@cnexlabs.com>
Signed-off-by: default avatarMatias Bjørling <matias@cnexlabs.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ee8d5c1a
...@@ -716,6 +716,12 @@ static int pblk_lines_init(struct pblk *pblk) ...@@ -716,6 +716,12 @@ static int pblk_lines_init(struct pblk *pblk)
lm->emeta_bb = geo->nr_luns - i; lm->emeta_bb = geo->nr_luns - i;
lm->min_blk_line = 1 + DIV_ROUND_UP(lm->smeta_sec + lm->emeta_sec[0], lm->min_blk_line = 1 + DIV_ROUND_UP(lm->smeta_sec + lm->emeta_sec[0],
geo->sec_per_blk); geo->sec_per_blk);
if (lm->min_blk_line > lm->blk_per_line) {
pr_err("pblk: config. not supported. Min. LUN in line:%d\n",
lm->blk_per_line);
ret = -EINVAL;
goto fail;
}
ret = pblk_lines_alloc_metadata(pblk); ret = pblk_lines_alloc_metadata(pblk);
if (ret) if (ret)
......
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