]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
lightnvm: pblk: assume that chunks are closed on 1.2 devices
authorHans Holmberg <hans.holmberg@cnexlabs.com>
Fri, 13 Jul 2018 08:48:45 +0000 (10:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:39:40 +0000 (08:39 +0200)
[ Upstream commit f6352103d2e0ad2d2066725eb19bfdfb8763239b ]

We can't know if a block is closed or not on 1.2 devices, so assume
closed state to make sure that blocks are erased before writing.

Fixes: 32ef9412c114 ("lightnvm: pblk: implement get log report chunk")
Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/lightnvm/pblk-init.c

index b57f764d6a167021fd00d27a122556019528c198..93ebba6dcc25a2db60dbb66449a5c7cfe6c4b405 100644 (file)
@@ -716,10 +716,11 @@ static int pblk_setup_line_meta_12(struct pblk *pblk, struct pblk_line *line,
 
                /*
                 * In 1.2 spec. chunk state is not persisted by the device. Thus
-                * some of the values are reset each time pblk is instantiated.
+                * some of the values are reset each time pblk is instantiated,
+                * so we have to assume that the block is closed.
                 */
                if (lun_bb_meta[line->id] == NVM_BLK_T_FREE)
-                       chunk->state =  NVM_CHK_ST_FREE;
+                       chunk->state =  NVM_CHK_ST_CLOSED;
                else
                        chunk->state = NVM_CHK_ST_OFFLINE;