When a ppa_list with vblks is expanded, it can either go block or
plane first. Currently it is been plane first. This works well for a
single vblk that is expanded, but fails for controllers that
require data for all planes is grouped together. Make the ppa_list
expand first expand with block, and then plane to support this
behavior.

 Before (2 blocks, 4 planes per vblk)
  idx block plane
   0      0     0
   1      1     0
   2      0     1
   3      1     1
   4      0     2
   5      1     2
   6      0     3
   7      1     3

 After
  idx block plane
   0      0     0
   1      0     1
   2      0     2
   3      0     3
   4      1     0
   5      1     1
   6      1     2
   7      1     3

Signed-off-by: Matias Bjørling <[email protected]>
---
 drivers/lightnvm/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index de5db7b..0e82798 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -279,7 +279,8 @@ int nvm_set_rqd_ppalist(struct nvm_dev *dev, struct nvm_rq 
*rqd,
                for (i = 0; i < nr_ppas; i++) {
                        for (pl_idx = 0; pl_idx < plane_cnt; pl_idx++) {
                                ppas[i].g.pl = pl_idx;
-                               rqd->ppa_list[(pl_idx * nr_ppas) + i] = ppas[i];
+                               rqd->ppa_list[(plane_cnt * i) + pl_idx] =
+                                                                       ppas[i];
                        }
                }
        }
-- 
2.1.4

Reply via email to