aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2018-03-29 18:05:14 -0400
committerJens Axboe <axboe@kernel.dk>2018-03-29 19:29:09 -0400
commita40afad90b9a253b282183eb9365f1cc14aeff77 (patch)
tree7285af81f7c740fadea5d58383114bd20ca86d58
parent3f48021bad73696421e2725c856b9b3aec7f567c (diff)
lightnvm: normalize geometry nomenclature
Normalize nomenclature for naming channels, luns, chunks, planes and sectors as well as derivations in order to improve readability. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/lightnvm/core.c89
-rw-r--r--drivers/lightnvm/pblk-core.c4
-rw-r--r--drivers/lightnvm/pblk-init.c30
-rw-r--r--drivers/lightnvm/pblk-sysfs.c4
-rw-r--r--drivers/lightnvm/pblk.h20
-rw-r--r--drivers/nvme/host/lightnvm.c54
-rw-r--r--include/linux/lightnvm.h16
7 files changed, 108 insertions, 109 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 103e0ad9622c..94b3b423840b 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -36,13 +36,13 @@ static DECLARE_RWSEM(nvm_lock);
36/* Map between virtual and physical channel and lun */ 36/* Map between virtual and physical channel and lun */
37struct nvm_ch_map { 37struct nvm_ch_map {
38 int ch_off; 38 int ch_off;
39 int nr_luns; 39 int num_lun;
40 int *lun_offs; 40 int *lun_offs;
41}; 41};
42 42
43struct nvm_dev_map { 43struct nvm_dev_map {
44 struct nvm_ch_map *chnls; 44 struct nvm_ch_map *chnls;
45 int nr_chnls; 45 int num_ch;
46}; 46};
47 47
48static struct nvm_target *nvm_find_target(struct nvm_dev *dev, const char *name) 48static struct nvm_target *nvm_find_target(struct nvm_dev *dev, const char *name)
@@ -114,15 +114,15 @@ static void nvm_remove_tgt_dev(struct nvm_tgt_dev *tgt_dev, int clear)
114 struct nvm_dev_map *dev_map = tgt_dev->map; 114 struct nvm_dev_map *dev_map = tgt_dev->map;
115 int i, j; 115 int i, j;
116 116
117 for (i = 0; i < dev_map->nr_chnls; i++) { 117 for (i = 0; i < dev_map->num_ch; i++) {
118 struct nvm_ch_map *ch_map = &dev_map->chnls[i]; 118 struct nvm_ch_map *ch_map = &dev_map->chnls[i];
119 int *lun_offs = ch_map->lun_offs; 119 int *lun_offs = ch_map->lun_offs;
120 int ch = i + ch_map->ch_off; 120 int ch = i + ch_map->ch_off;
121 121
122 if (clear) { 122 if (clear) {
123 for (j = 0; j < ch_map->nr_luns; j++) { 123 for (j = 0; j < ch_map->num_lun; j++) {
124 int lun = j + lun_offs[j]; 124 int lun = j + lun_offs[j];
125 int lunid = (ch * dev->geo.nr_luns) + lun; 125 int lunid = (ch * dev->geo.num_lun) + lun;
126 126
127 WARN_ON(!test_and_clear_bit(lunid, 127 WARN_ON(!test_and_clear_bit(lunid,
128 dev->lun_map)); 128 dev->lun_map));
@@ -147,47 +147,46 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev,
147 struct nvm_dev_map *dev_rmap = dev->rmap; 147 struct nvm_dev_map *dev_rmap = dev->rmap;
148 struct nvm_dev_map *dev_map; 148 struct nvm_dev_map *dev_map;
149 struct ppa_addr *luns; 149 struct ppa_addr *luns;
150 int nr_luns = lun_end - lun_begin + 1; 150 int num_lun = lun_end - lun_begin + 1;
151 int luns_left = nr_luns; 151 int luns_left = num_lun;
152 int nr_chnls = nr_luns / dev->geo.nr_luns; 152 int num_ch = num_lun / dev->geo.num_lun;
153 int nr_chnls_mod = nr_luns % dev->geo.nr_luns; 153 int num_ch_mod = num_lun % dev->geo.num_lun;
154 int bch = lun_begin / dev->geo.nr_luns; 154 int bch = lun_begin / dev->geo.num_lun;
155 int blun = lun_begin % dev->geo.nr_luns; 155 int blun = lun_begin % dev->geo.num_lun;
156 int lunid = 0; 156 int lunid = 0;
157 int lun_balanced = 1; 157 int lun_balanced = 1;
158 int sec_per_lun, prev_nr_luns; 158 int sec_per_lun, prev_num_lun;
159 int i, j; 159 int i, j;
160 160
161 nr_chnls = (nr_chnls_mod == 0) ? nr_chnls : nr_chnls + 1; 161 num_ch = (num_ch_mod == 0) ? num_ch : num_ch + 1;
162 162
163 dev_map = kmalloc(sizeof(struct nvm_dev_map), GFP_KERNEL); 163 dev_map = kmalloc(sizeof(struct nvm_dev_map), GFP_KERNEL);
164 if (!dev_map) 164 if (!dev_map)
165 goto err_dev; 165 goto err_dev;
166 166
167 dev_map->chnls = kcalloc(nr_chnls, sizeof(struct nvm_ch_map), 167 dev_map->chnls = kcalloc(num_ch, sizeof(struct nvm_ch_map), GFP_KERNEL);
168 GFP_KERNEL);
169 if (!dev_map->chnls) 168 if (!dev_map->chnls)
170 goto err_chnls; 169 goto err_chnls;
171 170
172 luns = kcalloc(nr_luns, sizeof(struct ppa_addr), GFP_KERNEL); 171 luns = kcalloc(num_lun, sizeof(struct ppa_addr), GFP_KERNEL);
173 if (!luns) 172 if (!luns)
174 goto err_luns; 173 goto err_luns;
175 174
176 prev_nr_luns = (luns_left > dev->geo.nr_luns) ? 175 prev_num_lun = (luns_left > dev->geo.num_lun) ?
177 dev->geo.nr_luns : luns_left; 176 dev->geo.num_lun : luns_left;
178 for (i = 0; i < nr_chnls; i++) { 177 for (i = 0; i < num_ch; i++) {
179 struct nvm_ch_map *ch_rmap = &dev_rmap->chnls[i + bch]; 178 struct nvm_ch_map *ch_rmap = &dev_rmap->chnls[i + bch];
180 int *lun_roffs = ch_rmap->lun_offs; 179 int *lun_roffs = ch_rmap->lun_offs;
181 struct nvm_ch_map *ch_map = &dev_map->chnls[i]; 180 struct nvm_ch_map *ch_map = &dev_map->chnls[i];
182 int *lun_offs; 181 int *lun_offs;
183 int luns_in_chnl = (luns_left > dev->geo.nr_luns) ? 182 int luns_in_chnl = (luns_left > dev->geo.num_lun) ?
184 dev->geo.nr_luns : luns_left; 183 dev->geo.num_lun : luns_left;
185 184
186 if (lun_balanced && prev_nr_luns != luns_in_chnl) 185 if (lun_balanced && prev_num_lun != luns_in_chnl)
187 lun_balanced = 0; 186 lun_balanced = 0;
188 187
189 ch_map->ch_off = ch_rmap->ch_off = bch; 188 ch_map->ch_off = ch_rmap->ch_off = bch;
190 ch_map->nr_luns = luns_in_chnl; 189 ch_map->num_lun = luns_in_chnl;
191 190
192 lun_offs = kcalloc(luns_in_chnl, sizeof(int), GFP_KERNEL); 191 lun_offs = kcalloc(luns_in_chnl, sizeof(int), GFP_KERNEL);
193 if (!lun_offs) 192 if (!lun_offs)
@@ -209,7 +208,7 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev,
209 luns_left -= luns_in_chnl; 208 luns_left -= luns_in_chnl;
210 } 209 }
211 210
212 dev_map->nr_chnls = nr_chnls; 211 dev_map->num_ch = num_ch;
213 212
214 tgt_dev = kmalloc(sizeof(struct nvm_tgt_dev), GFP_KERNEL); 213 tgt_dev = kmalloc(sizeof(struct nvm_tgt_dev), GFP_KERNEL);
215 if (!tgt_dev) 214 if (!tgt_dev)
@@ -219,15 +218,15 @@ static struct nvm_tgt_dev *nvm_create_tgt_dev(struct nvm_dev *dev,
219 memcpy(&tgt_dev->geo, &dev->geo, sizeof(struct nvm_geo)); 218 memcpy(&tgt_dev->geo, &dev->geo, sizeof(struct nvm_geo));
220 219
221 /* Target device only owns a portion of the physical device */ 220 /* Target device only owns a portion of the physical device */
222 tgt_dev->geo.nr_chnls = nr_chnls; 221 tgt_dev->geo.num_ch = num_ch;
223 tgt_dev->geo.nr_luns = (lun_balanced) ? prev_nr_luns : -1; 222 tgt_dev->geo.num_lun = (lun_balanced) ? prev_num_lun : -1;
224 tgt_dev->geo.all_luns = nr_luns; 223 tgt_dev->geo.all_luns = num_lun;
225 tgt_dev->geo.all_chunks = nr_luns * dev->geo.nr_chks; 224 tgt_dev->geo.all_chunks = num_lun * dev->geo.num_chk;
226 225
227 tgt_dev->geo.op = op; 226 tgt_dev->geo.op = op;
228 227
229 sec_per_lun = dev->geo.clba * dev->geo.nr_chks; 228 sec_per_lun = dev->geo.clba * dev->geo.num_chk;
230 tgt_dev->geo.total_secs = nr_luns * sec_per_lun; 229 tgt_dev->geo.total_secs = num_lun * sec_per_lun;
231 230
232 tgt_dev->q = dev->q; 231 tgt_dev->q = dev->q;
233 tgt_dev->map = dev_map; 232 tgt_dev->map = dev_map;
@@ -505,20 +504,20 @@ static int nvm_register_map(struct nvm_dev *dev)
505 if (!rmap) 504 if (!rmap)
506 goto err_rmap; 505 goto err_rmap;
507 506
508 rmap->chnls = kcalloc(dev->geo.nr_chnls, sizeof(struct nvm_ch_map), 507 rmap->chnls = kcalloc(dev->geo.num_ch, sizeof(struct nvm_ch_map),
509 GFP_KERNEL); 508 GFP_KERNEL);
510 if (!rmap->chnls) 509 if (!rmap->chnls)
511 goto err_chnls; 510 goto err_chnls;
512 511
513 for (i = 0; i < dev->geo.nr_chnls; i++) { 512 for (i = 0; i < dev->geo.num_ch; i++) {
514 struct nvm_ch_map *ch_rmap; 513 struct nvm_ch_map *ch_rmap;
515 int *lun_roffs; 514 int *lun_roffs;
516 int luns_in_chnl = dev->geo.nr_luns; 515 int luns_in_chnl = dev->geo.num_lun;
517 516
518 ch_rmap = &rmap->chnls[i]; 517 ch_rmap = &rmap->chnls[i];
519 518
520 ch_rmap->ch_off = -1; 519 ch_rmap->ch_off = -1;
521 ch_rmap->nr_luns = luns_in_chnl; 520 ch_rmap->num_lun = luns_in_chnl;
522 521
523 lun_roffs = kcalloc(luns_in_chnl, sizeof(int), GFP_KERNEL); 522 lun_roffs = kcalloc(luns_in_chnl, sizeof(int), GFP_KERNEL);
524 if (!lun_roffs) 523 if (!lun_roffs)
@@ -547,7 +546,7 @@ static void nvm_unregister_map(struct nvm_dev *dev)
547 struct nvm_dev_map *rmap = dev->rmap; 546 struct nvm_dev_map *rmap = dev->rmap;
548 int i; 547 int i;
549 548
550 for (i = 0; i < dev->geo.nr_chnls; i++) 549 for (i = 0; i < dev->geo.num_ch; i++)
551 kfree(rmap->chnls[i].lun_offs); 550 kfree(rmap->chnls[i].lun_offs);
552 551
553 kfree(rmap->chnls); 552 kfree(rmap->chnls);
@@ -676,7 +675,7 @@ static int nvm_set_rqd_ppalist(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd,
676 int i, plane_cnt, pl_idx; 675 int i, plane_cnt, pl_idx;
677 struct ppa_addr ppa; 676 struct ppa_addr ppa;
678 677
679 if (geo->plane_mode == NVM_PLANE_SINGLE && nr_ppas == 1) { 678 if (geo->pln_mode == NVM_PLANE_SINGLE && nr_ppas == 1) {
680 rqd->nr_ppas = nr_ppas; 679 rqd->nr_ppas = nr_ppas;
681 rqd->ppa_addr = ppas[0]; 680 rqd->ppa_addr = ppas[0];
682 681
@@ -690,7 +689,7 @@ static int nvm_set_rqd_ppalist(struct nvm_tgt_dev *tgt_dev, struct nvm_rq *rqd,
690 return -ENOMEM; 689 return -ENOMEM;
691 } 690 }
692 691
693 plane_cnt = geo->plane_mode; 692 plane_cnt = geo->pln_mode;
694 rqd->nr_ppas *= plane_cnt; 693 rqd->nr_ppas *= plane_cnt;
695 694
696 for (i = 0; i < nr_ppas; i++) { 695 for (i = 0; i < nr_ppas; i++) {
@@ -808,15 +807,15 @@ int nvm_bb_tbl_fold(struct nvm_dev *dev, u8 *blks, int nr_blks)
808 struct nvm_geo *geo = &dev->geo; 807 struct nvm_geo *geo = &dev->geo;
809 int blk, offset, pl, blktype; 808 int blk, offset, pl, blktype;
810 809
811 if (nr_blks != geo->nr_chks * geo->plane_mode) 810 if (nr_blks != geo->num_chk * geo->pln_mode)
812 return -EINVAL; 811 return -EINVAL;
813 812
814 for (blk = 0; blk < geo->nr_chks; blk++) { 813 for (blk = 0; blk < geo->num_chk; blk++) {
815 offset = blk * geo->plane_mode; 814 offset = blk * geo->pln_mode;
816 blktype = blks[offset]; 815 blktype = blks[offset];
817 816
818 /* Bad blocks on any planes take precedence over other types */ 817 /* Bad blocks on any planes take precedence over other types */
819 for (pl = 0; pl < geo->plane_mode; pl++) { 818 for (pl = 0; pl < geo->pln_mode; pl++) {
820 if (blks[offset + pl] & 819 if (blks[offset + pl] &
821 (NVM_BLK_T_BAD|NVM_BLK_T_GRWN_BAD)) { 820 (NVM_BLK_T_BAD|NVM_BLK_T_GRWN_BAD)) {
822 blktype = blks[offset + pl]; 821 blktype = blks[offset + pl];
@@ -827,7 +826,7 @@ int nvm_bb_tbl_fold(struct nvm_dev *dev, u8 *blks, int nr_blks)
827 blks[blk] = blktype; 826 blks[blk] = blktype;
828 } 827 }
829 828
830 return geo->nr_chks; 829 return geo->num_chk;
831} 830}
832EXPORT_SYMBOL(nvm_bb_tbl_fold); 831EXPORT_SYMBOL(nvm_bb_tbl_fold);
833 832
@@ -901,9 +900,9 @@ static int nvm_init(struct nvm_dev *dev)
901 } 900 }
902 901
903 pr_info("nvm: registered %s [%u/%u/%u/%u/%u]\n", 902 pr_info("nvm: registered %s [%u/%u/%u/%u/%u]\n",
904 dev->name, geo->ws_min, geo->ws_opt, 903 dev->name, dev->geo.ws_min, dev->geo.ws_opt,
905 geo->nr_chks, geo->all_luns, 904 dev->geo.num_chk, dev->geo.all_luns,
906 geo->nr_chnls); 905 dev->geo.num_ch);
907 return 0; 906 return 0;
908err: 907err:
909 pr_err("nvm: failed to initialize nvm\n"); 908 pr_err("nvm: failed to initialize nvm\n");
diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 52c0c3e5ec6e..64c87dd4f1cd 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1742,10 +1742,10 @@ void pblk_up_rq(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas,
1742 struct nvm_tgt_dev *dev = pblk->dev; 1742 struct nvm_tgt_dev *dev = pblk->dev;
1743 struct nvm_geo *geo = &dev->geo; 1743 struct nvm_geo *geo = &dev->geo;
1744 struct pblk_lun *rlun; 1744 struct pblk_lun *rlun;
1745 int nr_luns = geo->all_luns; 1745 int num_lun = geo->all_luns;
1746 int bit = -1; 1746 int bit = -1;
1747 1747
1748 while ((bit = find_next_bit(lun_bitmap, nr_luns, bit + 1)) < nr_luns) { 1748 while ((bit = find_next_bit(lun_bitmap, num_lun, bit + 1)) < num_lun) {
1749 rlun = &pblk->luns[bit]; 1749 rlun = &pblk->luns[bit];
1750 up(&rlun->wr_sem); 1750 up(&rlun->wr_sem);
1751 } 1751 }
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 2fca27d0a9b5..4656d1ff81a6 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -193,15 +193,15 @@ static int pblk_set_addrf_12(struct nvm_geo *geo, struct nvm_addrf_12 *dst)
193 int power_len; 193 int power_len;
194 194
195 /* Re-calculate channel and lun format to adapt to configuration */ 195 /* Re-calculate channel and lun format to adapt to configuration */
196 power_len = get_count_order(geo->nr_chnls); 196 power_len = get_count_order(geo->num_ch);
197 if (1 << power_len != geo->nr_chnls) { 197 if (1 << power_len != geo->num_ch) {
198 pr_err("pblk: supports only power-of-two channel config.\n"); 198 pr_err("pblk: supports only power-of-two channel config.\n");
199 return -EINVAL; 199 return -EINVAL;
200 } 200 }
201 dst->ch_len = power_len; 201 dst->ch_len = power_len;
202 202
203 power_len = get_count_order(geo->nr_luns); 203 power_len = get_count_order(geo->num_lun);
204 if (1 << power_len != geo->nr_luns) { 204 if (1 << power_len != geo->num_lun) {
205 pr_err("pblk: supports only power-of-two LUN config.\n"); 205 pr_err("pblk: supports only power-of-two LUN config.\n");
206 return -EINVAL; 206 return -EINVAL;
207 } 207 }
@@ -210,16 +210,16 @@ static int pblk_set_addrf_12(struct nvm_geo *geo, struct nvm_addrf_12 *dst)
210 dst->blk_len = src->blk_len; 210 dst->blk_len = src->blk_len;
211 dst->pg_len = src->pg_len; 211 dst->pg_len = src->pg_len;
212 dst->pln_len = src->pln_len; 212 dst->pln_len = src->pln_len;
213 dst->sect_len = src->sect_len; 213 dst->sec_len = src->sec_len;
214 214
215 dst->sect_offset = 0; 215 dst->sec_offset = 0;
216 dst->pln_offset = dst->sect_len; 216 dst->pln_offset = dst->sec_len;
217 dst->ch_offset = dst->pln_offset + dst->pln_len; 217 dst->ch_offset = dst->pln_offset + dst->pln_len;
218 dst->lun_offset = dst->ch_offset + dst->ch_len; 218 dst->lun_offset = dst->ch_offset + dst->ch_len;
219 dst->pg_offset = dst->lun_offset + dst->lun_len; 219 dst->pg_offset = dst->lun_offset + dst->lun_len;
220 dst->blk_offset = dst->pg_offset + dst->pg_len; 220 dst->blk_offset = dst->pg_offset + dst->pg_len;
221 221
222 dst->sec_mask = ((1ULL << dst->sect_len) - 1) << dst->sect_offset; 222 dst->sec_mask = ((1ULL << dst->sec_len) - 1) << dst->sec_offset;
223 dst->pln_mask = ((1ULL << dst->pln_len) - 1) << dst->pln_offset; 223 dst->pln_mask = ((1ULL << dst->pln_len) - 1) << dst->pln_offset;
224 dst->ch_mask = ((1ULL << dst->ch_len) - 1) << dst->ch_offset; 224 dst->ch_mask = ((1ULL << dst->ch_len) - 1) << dst->ch_offset;
225 dst->lun_mask = ((1ULL << dst->lun_len) - 1) << dst->lun_offset; 225 dst->lun_mask = ((1ULL << dst->lun_len) - 1) << dst->lun_offset;
@@ -503,7 +503,7 @@ static void *pblk_bb_get_log(struct pblk *pblk)
503 int i, nr_blks, blk_per_lun; 503 int i, nr_blks, blk_per_lun;
504 int ret; 504 int ret;
505 505
506 blk_per_lun = geo->nr_chks * geo->plane_mode; 506 blk_per_lun = geo->num_chk * geo->pln_mode;
507 nr_blks = blk_per_lun * geo->all_luns; 507 nr_blks = blk_per_lun * geo->all_luns;
508 508
509 log = kmalloc(nr_blks, GFP_KERNEL); 509 log = kmalloc(nr_blks, GFP_KERNEL);
@@ -530,7 +530,7 @@ static int pblk_bb_line(struct pblk *pblk, struct pblk_line *line,
530 struct nvm_tgt_dev *dev = pblk->dev; 530 struct nvm_tgt_dev *dev = pblk->dev;
531 struct nvm_geo *geo = &dev->geo; 531 struct nvm_geo *geo = &dev->geo;
532 int i, bb_cnt = 0; 532 int i, bb_cnt = 0;
533 int blk_per_lun = geo->nr_chks * geo->plane_mode; 533 int blk_per_lun = geo->num_chk * geo->pln_mode;
534 534
535 for (i = 0; i < blk_per_line; i++) { 535 for (i = 0; i < blk_per_line; i++) {
536 struct pblk_lun *rlun = &pblk->luns[i]; 536 struct pblk_lun *rlun = &pblk->luns[i];
@@ -554,7 +554,7 @@ static int pblk_luns_init(struct pblk *pblk)
554 int i; 554 int i;
555 555
556 /* TODO: Implement unbalanced LUN support */ 556 /* TODO: Implement unbalanced LUN support */
557 if (geo->nr_luns < 0) { 557 if (geo->num_lun < 0) {
558 pr_err("pblk: unbalanced LUN config.\n"); 558 pr_err("pblk: unbalanced LUN config.\n");
559 return -EINVAL; 559 return -EINVAL;
560 } 560 }
@@ -566,9 +566,9 @@ static int pblk_luns_init(struct pblk *pblk)
566 566
567 for (i = 0; i < geo->all_luns; i++) { 567 for (i = 0; i < geo->all_luns; i++) {
568 /* Stripe across channels */ 568 /* Stripe across channels */
569 int ch = i % geo->nr_chnls; 569 int ch = i % geo->num_ch;
570 int lun_raw = i / geo->nr_chnls; 570 int lun_raw = i / geo->num_ch;
571 int lunid = lun_raw + ch * geo->nr_luns; 571 int lunid = lun_raw + ch * geo->num_lun;
572 572
573 rlun = &pblk->luns[i]; 573 rlun = &pblk->luns[i];
574 rlun->bppa = dev->luns[lunid]; 574 rlun->bppa = dev->luns[lunid];
@@ -672,7 +672,7 @@ static int pblk_line_mg_init(struct pblk *pblk)
672 struct pblk_line_meta *lm = &pblk->lm; 672 struct pblk_line_meta *lm = &pblk->lm;
673 int i, bb_distance; 673 int i, bb_distance;
674 674
675 l_mg->nr_lines = geo->nr_chks; 675 l_mg->nr_lines = geo->num_chk;
676 l_mg->log_line = l_mg->data_line = NULL; 676 l_mg->log_line = l_mg->data_line = NULL;
677 l_mg->l_seq_nr = l_mg->d_seq_nr = 0; 677 l_mg->l_seq_nr = l_mg->d_seq_nr = 0;
678 l_mg->nr_free_lines = 0; 678 l_mg->nr_free_lines = 0;
diff --git a/drivers/lightnvm/pblk-sysfs.c b/drivers/lightnvm/pblk-sysfs.c
index 2474ef4366fa..3e9364f60b44 100644
--- a/drivers/lightnvm/pblk-sysfs.c
+++ b/drivers/lightnvm/pblk-sysfs.c
@@ -128,7 +128,7 @@ static ssize_t pblk_sysfs_ppaf(struct pblk *pblk, char *page)
128 ppaf->lun_offset, ppaf->lun_len, 128 ppaf->lun_offset, ppaf->lun_len,
129 ppaf->ch_offset, ppaf->ch_len, 129 ppaf->ch_offset, ppaf->ch_len,
130 ppaf->pln_offset, ppaf->pln_len, 130 ppaf->pln_offset, ppaf->pln_len,
131 ppaf->sect_offset, ppaf->sect_len); 131 ppaf->sec_offset, ppaf->sec_len);
132 132
133 sz += snprintf(page + sz, PAGE_SIZE - sz, 133 sz += snprintf(page + sz, PAGE_SIZE - sz,
134 "d:blk:%d/%d,pg:%d/%d,lun:%d/%d,ch:%d/%d,pl:%d/%d,sec:%d/%d\n", 134 "d:blk:%d/%d,pg:%d/%d,lun:%d/%d,ch:%d/%d,pl:%d/%d,sec:%d/%d\n",
@@ -137,7 +137,7 @@ static ssize_t pblk_sysfs_ppaf(struct pblk *pblk, char *page)
137 geo_ppaf->lun_offset, geo_ppaf->lun_len, 137 geo_ppaf->lun_offset, geo_ppaf->lun_len,
138 geo_ppaf->ch_offset, geo_ppaf->ch_len, 138 geo_ppaf->ch_offset, geo_ppaf->ch_len,
139 geo_ppaf->pln_offset, geo_ppaf->pln_len, 139 geo_ppaf->pln_offset, geo_ppaf->pln_len,
140 geo_ppaf->sect_offset, geo_ppaf->sect_len); 140 geo_ppaf->sec_offset, geo_ppaf->sec_len);
141 141
142 return sz; 142 return sz;
143} 143}
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 898c4e49f77d..dcdad255ccb5 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -941,7 +941,7 @@ static inline int pblk_ppa_to_line(struct ppa_addr p)
941 941
942static inline int pblk_ppa_to_pos(struct nvm_geo *geo, struct ppa_addr p) 942static inline int pblk_ppa_to_pos(struct nvm_geo *geo, struct ppa_addr p)
943{ 943{
944 return p.g.lun * geo->nr_chnls + p.g.ch; 944 return p.g.lun * geo->num_ch + p.g.ch;
945} 945}
946 946
947static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr, 947static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr,
@@ -956,7 +956,7 @@ static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr,
956 ppa.g.lun = (paddr & ppaf->lun_mask) >> ppaf->lun_offset; 956 ppa.g.lun = (paddr & ppaf->lun_mask) >> ppaf->lun_offset;
957 ppa.g.ch = (paddr & ppaf->ch_mask) >> ppaf->ch_offset; 957 ppa.g.ch = (paddr & ppaf->ch_mask) >> ppaf->ch_offset;
958 ppa.g.pl = (paddr & ppaf->pln_mask) >> ppaf->pln_offset; 958 ppa.g.pl = (paddr & ppaf->pln_mask) >> ppaf->pln_offset;
959 ppa.g.sec = (paddr & ppaf->sec_mask) >> ppaf->sect_offset; 959 ppa.g.sec = (paddr & ppaf->sec_mask) >> ppaf->sec_offset;
960 960
961 return ppa; 961 return ppa;
962} 962}
@@ -971,7 +971,7 @@ static inline u64 pblk_dev_ppa_to_line_addr(struct pblk *pblk,
971 paddr |= (u64)p.g.lun << ppaf->lun_offset; 971 paddr |= (u64)p.g.lun << ppaf->lun_offset;
972 paddr |= (u64)p.g.pg << ppaf->pg_offset; 972 paddr |= (u64)p.g.pg << ppaf->pg_offset;
973 paddr |= (u64)p.g.pl << ppaf->pln_offset; 973 paddr |= (u64)p.g.pl << ppaf->pln_offset;
974 paddr |= (u64)p.g.sec << ppaf->sect_offset; 974 paddr |= (u64)p.g.sec << ppaf->sec_offset;
975 975
976 return paddr; 976 return paddr;
977} 977}
@@ -995,7 +995,7 @@ static inline struct ppa_addr pblk_ppa32_to_ppa64(struct pblk *pblk, u32 ppa32)
995 ppa64.g.blk = (ppa32 & ppaf->blk_mask) >> ppaf->blk_offset; 995 ppa64.g.blk = (ppa32 & ppaf->blk_mask) >> ppaf->blk_offset;
996 ppa64.g.pg = (ppa32 & ppaf->pg_mask) >> ppaf->pg_offset; 996 ppa64.g.pg = (ppa32 & ppaf->pg_mask) >> ppaf->pg_offset;
997 ppa64.g.pl = (ppa32 & ppaf->pln_mask) >> ppaf->pln_offset; 997 ppa64.g.pl = (ppa32 & ppaf->pln_mask) >> ppaf->pln_offset;
998 ppa64.g.sec = (ppa32 & ppaf->sec_mask) >> ppaf->sect_offset; 998 ppa64.g.sec = (ppa32 & ppaf->sec_mask) >> ppaf->sec_offset;
999 } 999 }
1000 1000
1001 return ppa64; 1001 return ppa64;
@@ -1018,7 +1018,7 @@ static inline u32 pblk_ppa64_to_ppa32(struct pblk *pblk, struct ppa_addr ppa64)
1018 ppa32 |= ppa64.g.blk << ppaf->blk_offset; 1018 ppa32 |= ppa64.g.blk << ppaf->blk_offset;
1019 ppa32 |= ppa64.g.pg << ppaf->pg_offset; 1019 ppa32 |= ppa64.g.pg << ppaf->pg_offset;
1020 ppa32 |= ppa64.g.pl << ppaf->pln_offset; 1020 ppa32 |= ppa64.g.pl << ppaf->pln_offset;
1021 ppa32 |= ppa64.g.sec << ppaf->sect_offset; 1021 ppa32 |= ppa64.g.sec << ppaf->sec_offset;
1022 } 1022 }
1023 1023
1024 return ppa32; 1024 return ppa32;
@@ -1136,7 +1136,7 @@ static inline int pblk_set_progr_mode(struct pblk *pblk, int type)
1136 struct nvm_geo *geo = &dev->geo; 1136 struct nvm_geo *geo = &dev->geo;
1137 int flags; 1137 int flags;
1138 1138
1139 flags = geo->plane_mode >> 1; 1139 flags = geo->pln_mode >> 1;
1140 1140
1141 if (type == PBLK_WRITE) 1141 if (type == PBLK_WRITE)
1142 flags |= NVM_IO_SCRAMBLE_ENABLE; 1142 flags |= NVM_IO_SCRAMBLE_ENABLE;
@@ -1157,7 +1157,7 @@ static inline int pblk_set_read_mode(struct pblk *pblk, int type)
1157 1157
1158 flags = NVM_IO_SUSPEND | NVM_IO_SCRAMBLE_ENABLE; 1158 flags = NVM_IO_SUSPEND | NVM_IO_SCRAMBLE_ENABLE;
1159 if (type == PBLK_READ_SEQUENTIAL) 1159 if (type == PBLK_READ_SEQUENTIAL)
1160 flags |= geo->plane_mode >> 1; 1160 flags |= geo->pln_mode >> 1;
1161 1161
1162 return flags; 1162 return flags;
1163} 1163}
@@ -1210,10 +1210,10 @@ static inline int pblk_boundary_ppa_checks(struct nvm_tgt_dev *tgt_dev,
1210 ppa = &ppas[i]; 1210 ppa = &ppas[i];
1211 1211
1212 if (!ppa->c.is_cached && 1212 if (!ppa->c.is_cached &&
1213 ppa->g.ch < geo->nr_chnls && 1213 ppa->g.ch < geo->num_ch &&
1214 ppa->g.lun < geo->nr_luns && 1214 ppa->g.lun < geo->num_lun &&
1215 ppa->g.pl < geo->num_pln && 1215 ppa->g.pl < geo->num_pln &&
1216 ppa->g.blk < geo->nr_chks && 1216 ppa->g.blk < geo->num_chk &&
1217 ppa->g.pg < geo->num_pg && 1217 ppa->g.pg < geo->num_pg &&
1218 ppa->g.sec < geo->ws_min) 1218 ppa->g.sec < geo->ws_min)
1219 continue; 1219 continue;
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 41b38ebdb1f3..08f0f6b5bc06 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -262,21 +262,21 @@ static void nvme_nvm_set_addr_12(struct nvm_addrf_12 *dst,
262 dst->blk_len = src->blk_len; 262 dst->blk_len = src->blk_len;
263 dst->pg_len = src->pg_len; 263 dst->pg_len = src->pg_len;
264 dst->pln_len = src->pln_len; 264 dst->pln_len = src->pln_len;
265 dst->sect_len = src->sec_len; 265 dst->sec_len = src->sec_len;
266 266
267 dst->ch_offset = src->ch_offset; 267 dst->ch_offset = src->ch_offset;
268 dst->lun_offset = src->lun_offset; 268 dst->lun_offset = src->lun_offset;
269 dst->blk_offset = src->blk_offset; 269 dst->blk_offset = src->blk_offset;
270 dst->pg_offset = src->pg_offset; 270 dst->pg_offset = src->pg_offset;
271 dst->pln_offset = src->pln_offset; 271 dst->pln_offset = src->pln_offset;
272 dst->sect_offset = src->sec_offset; 272 dst->sec_offset = src->sec_offset;
273 273
274 dst->ch_mask = ((1ULL << dst->ch_len) - 1) << dst->ch_offset; 274 dst->ch_mask = ((1ULL << dst->ch_len) - 1) << dst->ch_offset;
275 dst->lun_mask = ((1ULL << dst->lun_len) - 1) << dst->lun_offset; 275 dst->lun_mask = ((1ULL << dst->lun_len) - 1) << dst->lun_offset;
276 dst->blk_mask = ((1ULL << dst->blk_len) - 1) << dst->blk_offset; 276 dst->blk_mask = ((1ULL << dst->blk_len) - 1) << dst->blk_offset;
277 dst->pg_mask = ((1ULL << dst->pg_len) - 1) << dst->pg_offset; 277 dst->pg_mask = ((1ULL << dst->pg_len) - 1) << dst->pg_offset;
278 dst->pln_mask = ((1ULL << dst->pln_len) - 1) << dst->pln_offset; 278 dst->pln_mask = ((1ULL << dst->pln_len) - 1) << dst->pln_offset;
279 dst->sec_mask = ((1ULL << dst->sect_len) - 1) << dst->sect_offset; 279 dst->sec_mask = ((1ULL << dst->sec_len) - 1) << dst->sec_offset;
280} 280}
281 281
282static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id, 282static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id,
@@ -302,11 +302,11 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id,
302 /* Set compacted version for upper layers */ 302 /* Set compacted version for upper layers */
303 geo->version = NVM_OCSSD_SPEC_12; 303 geo->version = NVM_OCSSD_SPEC_12;
304 304
305 geo->nr_chnls = src->num_ch; 305 geo->num_ch = src->num_ch;
306 geo->nr_luns = src->num_lun; 306 geo->num_lun = src->num_lun;
307 geo->all_luns = geo->nr_chnls * geo->nr_luns; 307 geo->all_luns = geo->num_ch * geo->num_lun;
308 308
309 geo->nr_chks = le16_to_cpu(src->num_chk); 309 geo->num_chk = le16_to_cpu(src->num_chk);
310 310
311 geo->csecs = le16_to_cpu(src->csecs); 311 geo->csecs = le16_to_cpu(src->csecs);
312 geo->sos = le16_to_cpu(src->sos); 312 geo->sos = le16_to_cpu(src->sos);
@@ -316,7 +316,7 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id,
316 sec_per_pl = sec_per_pg * src->num_pln; 316 sec_per_pl = sec_per_pg * src->num_pln;
317 geo->clba = sec_per_pl * pg_per_blk; 317 geo->clba = sec_per_pl * pg_per_blk;
318 318
319 geo->all_chunks = geo->all_luns * geo->nr_chks; 319 geo->all_chunks = geo->all_luns * geo->num_chk;
320 geo->total_secs = geo->clba * geo->all_chunks; 320 geo->total_secs = geo->clba * geo->all_chunks;
321 321
322 geo->ws_min = sec_per_pg; 322 geo->ws_min = sec_per_pg;
@@ -327,8 +327,8 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id,
327 * unspecified in 1.2. Users of 1.2 must be aware of this and eventually 327 * unspecified in 1.2. Users of 1.2 must be aware of this and eventually
328 * specify these values through a quirk if restrictions apply. 328 * specify these values through a quirk if restrictions apply.
329 */ 329 */
330 geo->maxoc = geo->all_luns * geo->nr_chks; 330 geo->maxoc = geo->all_luns * geo->num_chk;
331 geo->maxocpu = geo->nr_chks; 331 geo->maxocpu = geo->num_chk;
332 332
333 geo->mccap = le32_to_cpu(src->mccap); 333 geo->mccap = le32_to_cpu(src->mccap);
334 334
@@ -350,13 +350,13 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id,
350 geo->cpar = le16_to_cpu(src->cpar); 350 geo->cpar = le16_to_cpu(src->cpar);
351 geo->mpos = le32_to_cpu(src->mpos); 351 geo->mpos = le32_to_cpu(src->mpos);
352 352
353 geo->plane_mode = NVM_PLANE_SINGLE; 353 geo->pln_mode = NVM_PLANE_SINGLE;
354 354
355 if (geo->mpos & 0x020202) { 355 if (geo->mpos & 0x020202) {
356 geo->plane_mode = NVM_PLANE_DOUBLE; 356 geo->pln_mode = NVM_PLANE_DOUBLE;
357 geo->ws_opt <<= 1; 357 geo->ws_opt <<= 1;
358 } else if (geo->mpos & 0x040404) { 358 } else if (geo->mpos & 0x040404) {
359 geo->plane_mode = NVM_PLANE_QUAD; 359 geo->pln_mode = NVM_PLANE_QUAD;
360 geo->ws_opt <<= 2; 360 geo->ws_opt <<= 2;
361 } 361 }
362 362
@@ -403,14 +403,14 @@ static int nvme_nvm_setup_20(struct nvme_nvm_id20 *id,
403 return -EINVAL; 403 return -EINVAL;
404 } 404 }
405 405
406 geo->nr_chnls = le16_to_cpu(id->num_grp); 406 geo->num_ch = le16_to_cpu(id->num_grp);
407 geo->nr_luns = le16_to_cpu(id->num_pu); 407 geo->num_lun = le16_to_cpu(id->num_pu);
408 geo->all_luns = geo->nr_chnls * geo->nr_luns; 408 geo->all_luns = geo->num_ch * geo->num_lun;
409 409
410 geo->nr_chks = le32_to_cpu(id->num_chk); 410 geo->num_chk = le32_to_cpu(id->num_chk);
411 geo->clba = le32_to_cpu(id->clba); 411 geo->clba = le32_to_cpu(id->clba);
412 412
413 geo->all_chunks = geo->all_luns * geo->nr_chks; 413 geo->all_chunks = geo->all_luns * geo->num_chk;
414 geo->total_secs = geo->clba * geo->all_chunks; 414 geo->total_secs = geo->clba * geo->all_chunks;
415 415
416 geo->ws_min = le32_to_cpu(id->ws_min); 416 geo->ws_min = le32_to_cpu(id->ws_min);
@@ -484,7 +484,7 @@ static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa,
484 struct nvme_ctrl *ctrl = ns->ctrl; 484 struct nvme_ctrl *ctrl = ns->ctrl;
485 struct nvme_nvm_command c = {}; 485 struct nvme_nvm_command c = {};
486 struct nvme_nvm_bb_tbl *bb_tbl; 486 struct nvme_nvm_bb_tbl *bb_tbl;
487 int nr_blks = geo->nr_chks * geo->num_pln; 487 int nr_blks = geo->num_chk * geo->num_pln;
488 int tblsz = sizeof(struct nvme_nvm_bb_tbl) + nr_blks; 488 int tblsz = sizeof(struct nvme_nvm_bb_tbl) + nr_blks;
489 int ret = 0; 489 int ret = 0;
490 490
@@ -525,7 +525,7 @@ static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa,
525 goto out; 525 goto out;
526 } 526 }
527 527
528 memcpy(blks, bb_tbl->blk, geo->nr_chks * geo->num_pln); 528 memcpy(blks, bb_tbl->blk, geo->num_chk * geo->num_pln);
529out: 529out:
530 kfree(bb_tbl); 530 kfree(bb_tbl);
531 return ret; 531 return ret;
@@ -968,7 +968,7 @@ static ssize_t nvm_dev_attr_show_ppaf(struct nvm_addrf_12 *ppaf, char *page)
968 ppaf->pln_offset, ppaf->pln_len, 968 ppaf->pln_offset, ppaf->pln_len,
969 ppaf->blk_offset, ppaf->blk_len, 969 ppaf->blk_offset, ppaf->blk_len,
970 ppaf->pg_offset, ppaf->pg_len, 970 ppaf->pg_offset, ppaf->pg_len,
971 ppaf->sect_offset, ppaf->sect_len); 971 ppaf->sec_offset, ppaf->sec_len);
972} 972}
973 973
974static ssize_t nvm_dev_attr_show_12(struct device *dev, 974static ssize_t nvm_dev_attr_show_12(struct device *dev,
@@ -998,13 +998,13 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
998 } else if (strcmp(attr->name, "flash_media_type") == 0) { 998 } else if (strcmp(attr->name, "flash_media_type") == 0) {
999 return scnprintf(page, PAGE_SIZE, "%u\n", geo->fmtype); 999 return scnprintf(page, PAGE_SIZE, "%u\n", geo->fmtype);
1000 } else if (strcmp(attr->name, "num_channels") == 0) { 1000 } else if (strcmp(attr->name, "num_channels") == 0) {
1001 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_chnls); 1001 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_ch);
1002 } else if (strcmp(attr->name, "num_luns") == 0) { 1002 } else if (strcmp(attr->name, "num_luns") == 0) {
1003 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_luns); 1003 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_lun);
1004 } else if (strcmp(attr->name, "num_planes") == 0) { 1004 } else if (strcmp(attr->name, "num_planes") == 0) {
1005 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_pln); 1005 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_pln);
1006 } else if (strcmp(attr->name, "num_blocks") == 0) { /* u16 */ 1006 } else if (strcmp(attr->name, "num_blocks") == 0) { /* u16 */
1007 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_chks); 1007 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_chk);
1008 } else if (strcmp(attr->name, "num_pages") == 0) { 1008 } else if (strcmp(attr->name, "num_pages") == 0) {
1009 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_pg); 1009 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_pg);
1010 } else if (strcmp(attr->name, "page_size") == 0) { 1010 } else if (strcmp(attr->name, "page_size") == 0) {
@@ -1048,11 +1048,11 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev,
1048 attr = &dattr->attr; 1048 attr = &dattr->attr;
1049 1049
1050 if (strcmp(attr->name, "groups") == 0) { 1050 if (strcmp(attr->name, "groups") == 0) {
1051 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_chnls); 1051 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_ch);
1052 } else if (strcmp(attr->name, "punits") == 0) { 1052 } else if (strcmp(attr->name, "punits") == 0) {
1053 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_luns); 1053 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_lun);
1054 } else if (strcmp(attr->name, "chunks") == 0) { 1054 } else if (strcmp(attr->name, "chunks") == 0) {
1055 return scnprintf(page, PAGE_SIZE, "%u\n", geo->nr_chks); 1055 return scnprintf(page, PAGE_SIZE, "%u\n", geo->num_chk);
1056 } else if (strcmp(attr->name, "clba") == 0) { 1056 } else if (strcmp(attr->name, "clba") == 0) {
1057 return scnprintf(page, PAGE_SIZE, "%u\n", geo->clba); 1057 return scnprintf(page, PAGE_SIZE, "%u\n", geo->clba);
1058 } else if (strcmp(attr->name, "ws_min") == 0) { 1058 } else if (strcmp(attr->name, "ws_min") == 0) {
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 870959a58fef..00295d9f9522 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -163,14 +163,14 @@ struct nvm_addrf_12 {
163 u8 blk_len; 163 u8 blk_len;
164 u8 pg_len; 164 u8 pg_len;
165 u8 pln_len; 165 u8 pln_len;
166 u8 sect_len; 166 u8 sec_len;
167 167
168 u8 ch_offset; 168 u8 ch_offset;
169 u8 lun_offset; 169 u8 lun_offset;
170 u8 blk_offset; 170 u8 blk_offset;
171 u8 pg_offset; 171 u8 pg_offset;
172 u8 pln_offset; 172 u8 pln_offset;
173 u8 sect_offset; 173 u8 sec_offset;
174 174
175 u64 ch_mask; 175 u64 ch_mask;
176 u64 lun_mask; 176 u64 lun_mask;
@@ -275,8 +275,8 @@ struct nvm_geo {
275 u8 version; 275 u8 version;
276 276
277 /* instance specific geometry */ 277 /* instance specific geometry */
278 int nr_chnls; 278 int num_ch;
279 int nr_luns; /* per channel */ 279 int num_lun; /* per channel */
280 280
281 /* calculated values */ 281 /* calculated values */
282 int all_luns; /* across channels */ 282 int all_luns; /* across channels */
@@ -287,7 +287,7 @@ struct nvm_geo {
287 sector_t total_secs; /* across channels */ 287 sector_t total_secs; /* across channels */
288 288
289 /* chunk geometry */ 289 /* chunk geometry */
290 u32 nr_chks; /* chunks per lun */ 290 u32 num_chk; /* chunks per lun */
291 u32 clba; /* sectors per chunk */ 291 u32 clba; /* sectors per chunk */
292 u16 csecs; /* sector size */ 292 u16 csecs; /* sector size */
293 u16 sos; /* out-of-band area size */ 293 u16 sos; /* out-of-band area size */
@@ -325,7 +325,7 @@ struct nvm_geo {
325 u32 mpos; 325 u32 mpos;
326 326
327 u8 num_pln; 327 u8 num_pln;
328 u8 plane_mode; 328 u8 pln_mode;
329 u16 num_pg; 329 u16 num_pg;
330 u16 fpg_sz; 330 u16 fpg_sz;
331}; 331};
@@ -382,7 +382,7 @@ static inline struct ppa_addr generic_to_dev_addr(struct nvm_tgt_dev *tgt_dev,
382 l.ppa |= ((u64)r.g.blk) << ppaf->blk_offset; 382 l.ppa |= ((u64)r.g.blk) << ppaf->blk_offset;
383 l.ppa |= ((u64)r.g.pg) << ppaf->pg_offset; 383 l.ppa |= ((u64)r.g.pg) << ppaf->pg_offset;
384 l.ppa |= ((u64)r.g.pl) << ppaf->pln_offset; 384 l.ppa |= ((u64)r.g.pl) << ppaf->pln_offset;
385 l.ppa |= ((u64)r.g.sec) << ppaf->sect_offset; 385 l.ppa |= ((u64)r.g.sec) << ppaf->sec_offset;
386 386
387 return l; 387 return l;
388} 388}
@@ -401,7 +401,7 @@ static inline struct ppa_addr dev_to_generic_addr(struct nvm_tgt_dev *tgt_dev,
401 l.g.blk = (r.ppa & ppaf->blk_mask) >> ppaf->blk_offset; 401 l.g.blk = (r.ppa & ppaf->blk_mask) >> ppaf->blk_offset;
402 l.g.pg = (r.ppa & ppaf->pg_mask) >> ppaf->pg_offset; 402 l.g.pg = (r.ppa & ppaf->pg_mask) >> ppaf->pg_offset;
403 l.g.pl = (r.ppa & ppaf->pln_mask) >> ppaf->pln_offset; 403 l.g.pl = (r.ppa & ppaf->pln_mask) >> ppaf->pln_offset;
404 l.g.sec = (r.ppa & ppaf->sec_mask) >> ppaf->sect_offset; 404 l.g.sec = (r.ppa & ppaf->sec_mask) >> ppaf->sec_offset;
405 405
406 return l; 406 return l;
407} 407}