aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2017-10-13 14:46:27 +0200
committerJens Axboe <axboe@kernel.dk>2017-10-13 08:34:57 -0600
commite6b754c252bacebdfbe3c57e790431ab8f445d1f (patch)
tree841fb8a9e40a3df783c3e4ccc2e20cc713bcc091 /drivers/lightnvm
parent21d2287119e843929c29fb1adbd271bde1fac7ae (diff)
lightnvm: pblk: ensure right bad block calculation
Make sure that the variable controlling block threshold for allocating extra metadata sectors in case of a line with bad blocks does not get a negative value. Otherwise, the line will be marked as corrupted and wasted. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 3c3749186053..c7239c41ba40 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -710,7 +710,7 @@ add_emeta_page:
goto add_emeta_page;
}
- lm->emeta_bb = geo->nr_luns - i;
+ lm->emeta_bb = geo->nr_luns > i ? geo->nr_luns - i : 0;
lm->min_blk_line = 1;
if (geo->nr_luns > 1)

Privacy Policy