From: Matias Bjørling Date: Thu, 7 Jul 2016 07:54:21 +0000 (+0200) Subject: lightnvm: fix lun offset calculation for mark blk X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=24d4a7d721484498462bc3117d6d5c88ca623574;p=linux-beck.git lightnvm: fix lun offset calculation for mark blk The gen_mark_blk_bad function marks the wrong block when a block is on a different channel. Fix the index calculation, so that it updates the correct block. Reported-by: Javier Gonzalez Signed-off-by: Matias Bjørling Signed-off-by: Jens Axboe --- diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c index c65fb675e374..b74174c6d021 100644 --- a/drivers/lightnvm/gennvm.c +++ b/drivers/lightnvm/gennvm.c @@ -542,7 +542,7 @@ static void gen_mark_blk(struct nvm_dev *dev, struct ppa_addr ppa, int type) return; } - lun = &gn->luns[ppa.g.lun * ppa.g.ch]; + lun = &gn->luns[(dev->luns_per_chnl * ppa.g.ch) + ppa.g.lun]; blk = &lun->vlun.blocks[ppa.g.blk]; /* will be moved to bb list on put_blk from target */