Skip to content

Commit

Permalink
lightnvm: pblk: add initialization check
Browse files Browse the repository at this point in the history
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: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Javier González authored and Jens Axboe committed Jun 30, 2017
1 parent ee8d5c1 commit b5e063a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/lightnvm/pblk-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ static int pblk_lines_init(struct pblk *pblk)
lm->emeta_bb = geo->nr_luns - i;
lm->min_blk_line = 1 + DIV_ROUND_UP(lm->smeta_sec + lm->emeta_sec[0],
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);
if (ret)
Expand Down

0 comments on commit b5e063a

Please sign in to comment.