lightnvm: sectors first in ppa list
authorMatias Bjørling <m@bjorling.me>
Tue, 12 Jan 2016 06:49:26 +0000 (07:49 +0100)
committerJens Axboe <axboe@fb.com>
Tue, 12 Jan 2016 15:21:16 +0000 (08:21 -0700)
The Westlake controller requires that the PPA list has sectors defined
sequentially. Currently, the PPA list is created with planes first, then
sectors. Change this to sectors first, then planes.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/core.c

index fa1a052c4737af97279716268523e8daecfdf865..0c8f42fc5f01efa3947e3dee93f48ca834253d46 100644 (file)
@@ -245,10 +245,10 @@ int nvm_set_rqd_ppalist(struct nvm_dev *dev, struct nvm_rq *rqd,
                return -ENOMEM;
        }
 
-       for (i = 0; i < nr_ppas; i++) {
-               for (pl_idx = 0; pl_idx < plane_cnt; pl_idx++) {
+       for (pl_idx = 0; pl_idx < plane_cnt; pl_idx++) {
+               for (i = 0; i < nr_ppas; i++) {
                        ppas[i].g.pl = pl_idx;
-                       rqd->ppa_list[(i * plane_cnt) + pl_idx] = ppas[i];
+                       rqd->ppa_list[(pl_idx * nr_ppas) + i] = ppas[i];
                }
        }