summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-06-30 17:56:41 +0200
committerJens Axboe <axboe@kernel.dk>2017-06-30 11:08:18 -0600
commitb5e063a2861a3af00fe3770e5fb85f936facbf42 (patch)
tree461030bb83c92c026791b7db9de55e100d38aa0c
parentee8d5c1ad54e48ec44b6ae9cf91144fcab6ebf83 (diff)
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: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <matias@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/lightnvm/pblk-init.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 025d8fe52154..1b0f61233c21 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -716,6 +716,12 @@ add_emeta_page:
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)