lightnvm: fix incorrect nr_free_blocks stat
authorChao Yu <chao2.yu@samsung.com>
Tue, 12 Jan 2016 06:49:16 +0000 (07:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2016 06:27:40 +0000 (08:27 +0200)
[ Upstream commit bdded1552085b12d23c9be76147d2e96647a098f ]

When initing bad block list in gennvm_block_bb, once we move bad block
from free_list to bb_list, we should maintain both stat info
nr_free_blocks and nr_bad_blocks. So this patch fixes to add missing
operation related to nr_free_blocks.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/lightnvm/gennvm.c

index 62c6f4d11f249e5ebc3800066294b5b22ad60c1d..2a96ff6923f02c331190581da6c3be8b07797566 100644 (file)
@@ -89,6 +89,7 @@ static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,
 
                list_move_tail(&blk->list, &lun->bb_list);
                lun->vlun.nr_bad_blocks++;
+               lun->vlun.nr_free_blocks--;
        }
 
        return 0;