In current pblk implementation of erase command
there is a chance tha sector bits are set to some
random values for erase PPA. This is unexpected
situation, since erase shall be always chunk
aligned. This patch fixes that issue

Signed-off-by: Igor Konopko <[email protected]>
---
 drivers/lightnvm/pblk-core.c | 1 +
 drivers/lightnvm/pblk-map.c  | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index a98b2255f963..78b1eea4ab67 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -978,6 +978,7 @@ int pblk_line_erase(struct pblk *pblk, struct pblk_line 
*line)
 
                ppa = pblk->luns[bit].bppa; /* set ch and lun */
                ppa.a.blk = line->id;
+               ppa.a.reserved = 0;
 
                atomic_dec(&line->left_eblks);
                WARN_ON(test_and_set_bit(bit, line->erase_bitmap));
diff --git a/drivers/lightnvm/pblk-map.c b/drivers/lightnvm/pblk-map.c
index 79df583ea709..aea46b4ec40f 100644
--- a/drivers/lightnvm/pblk-map.c
+++ b/drivers/lightnvm/pblk-map.c
@@ -161,6 +161,7 @@ int pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd,
 
                        *erase_ppa = ppa_list[i];
                        erase_ppa->a.blk = e_line->id;
+                       erase_ppa->a.reserved = 0;
 
                        spin_unlock(&e_line->lock);
 
@@ -202,6 +203,7 @@ int pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd,
                atomic_dec(&e_line->left_eblks);
                *erase_ppa = pblk->luns[bit].bppa; /* set ch and lun */
                erase_ppa->a.blk = e_line->id;
+               erase_ppa->a.reserved = 0;
        }
 
        return 0;
-- 
2.17.1

Reply via email to