Commit bb845ae4 authored by Javier González's avatar Javier González Committed by Jens Axboe

lightnvm: pblk: rename ppaf* to addrf*

In preparation for 2.0 support in pblk, rename variables referring to
the address format to addrf and reserve ppaf for the 1.2 path.
Signed-off-by: default avatarJavier González <javier@cnexlabs.com>
Signed-off-by: default avatarMatias Bjørling <mb@lightnvm.io>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 7ad5039e
...@@ -80,7 +80,7 @@ static size_t pblk_trans_map_size(struct pblk *pblk) ...@@ -80,7 +80,7 @@ static size_t pblk_trans_map_size(struct pblk *pblk)
{ {
int entry_size = 8; int entry_size = 8;
if (pblk->ppaf_bitsize < 32) if (pblk->addrf_len < 32)
entry_size = 4; entry_size = 4;
return entry_size * pblk->rl.nr_secs; return entry_size * pblk->rl.nr_secs;
...@@ -229,7 +229,7 @@ static int pblk_set_addrf_12(struct nvm_geo *geo, struct nvm_addrf_12 *dst) ...@@ -229,7 +229,7 @@ static int pblk_set_addrf_12(struct nvm_geo *geo, struct nvm_addrf_12 *dst)
return dst->blk_offset + src->blk_len; return dst->blk_offset + src->blk_len;
} }
static int pblk_set_ppaf(struct pblk *pblk) static int pblk_set_addrf(struct pblk *pblk)
{ {
struct nvm_tgt_dev *dev = pblk->dev; struct nvm_tgt_dev *dev = pblk->dev;
struct nvm_geo *geo = &dev->geo; struct nvm_geo *geo = &dev->geo;
...@@ -241,7 +241,7 @@ static int pblk_set_ppaf(struct pblk *pblk) ...@@ -241,7 +241,7 @@ static int pblk_set_ppaf(struct pblk *pblk)
return -EINVAL; return -EINVAL;
} }
pblk->ppaf_bitsize = pblk_set_addrf_12(geo, (void *)&pblk->ppaf); pblk->addrf_len = pblk_set_addrf_12(geo, (void *)&pblk->addrf);
return 0; return 0;
} }
...@@ -377,7 +377,7 @@ static int pblk_core_init(struct pblk *pblk) ...@@ -377,7 +377,7 @@ static int pblk_core_init(struct pblk *pblk)
if (!pblk->r_end_wq) if (!pblk->r_end_wq)
goto free_bb_wq; goto free_bb_wq;
if (pblk_set_ppaf(pblk)) if (pblk_set_addrf(pblk))
goto free_r_end_wq; goto free_r_end_wq;
INIT_LIST_HEAD(&pblk->compl_list); INIT_LIST_HEAD(&pblk->compl_list);
......
...@@ -117,12 +117,12 @@ static ssize_t pblk_sysfs_ppaf(struct pblk *pblk, char *page) ...@@ -117,12 +117,12 @@ static ssize_t pblk_sysfs_ppaf(struct pblk *pblk, char *page)
struct nvm_addrf_12 *geo_ppaf; struct nvm_addrf_12 *geo_ppaf;
ssize_t sz = 0; ssize_t sz = 0;
ppaf = (struct nvm_addrf_12 *)&pblk->ppaf; ppaf = (struct nvm_addrf_12 *)&pblk->addrf;
geo_ppaf = (struct nvm_addrf_12 *)&geo->addrf; geo_ppaf = (struct nvm_addrf_12 *)&geo->addrf;
sz = snprintf(page, PAGE_SIZE, sz = snprintf(page, PAGE_SIZE,
"g:(b:%d)blk:%d/%d,pg:%d/%d,lun:%d/%d,ch:%d/%d,pl:%d/%d,sec:%d/%d\n", "g:(b:%d)blk:%d/%d,pg:%d/%d,lun:%d/%d,ch:%d/%d,pl:%d/%d,sec:%d/%d\n",
pblk->ppaf_bitsize, pblk->addrf_len,
ppaf->blk_offset, ppaf->blk_len, ppaf->blk_offset, ppaf->blk_len,
ppaf->pg_offset, ppaf->pg_len, ppaf->pg_offset, ppaf->pg_len,
ppaf->lun_offset, ppaf->lun_len, ppaf->lun_offset, ppaf->lun_len,
......
...@@ -570,8 +570,8 @@ struct pblk { ...@@ -570,8 +570,8 @@ struct pblk {
struct pblk_line_mgmt l_mg; /* Line management */ struct pblk_line_mgmt l_mg; /* Line management */
struct pblk_line_meta lm; /* Line metadata */ struct pblk_line_meta lm; /* Line metadata */
struct nvm_addrf ppaf; struct nvm_addrf addrf;
int ppaf_bitsize; int addrf_len;
struct pblk_rb rwb; struct pblk_rb rwb;
...@@ -947,7 +947,7 @@ static inline int pblk_ppa_to_pos(struct nvm_geo *geo, struct ppa_addr p) ...@@ -947,7 +947,7 @@ static inline int pblk_ppa_to_pos(struct nvm_geo *geo, struct ppa_addr p)
static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr, static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr,
u64 line_id) u64 line_id)
{ {
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->ppaf; struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->addrf;
struct ppa_addr ppa; struct ppa_addr ppa;
ppa.ppa = 0; ppa.ppa = 0;
...@@ -964,7 +964,7 @@ static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr, ...@@ -964,7 +964,7 @@ static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr,
static inline u64 pblk_dev_ppa_to_line_addr(struct pblk *pblk, static inline u64 pblk_dev_ppa_to_line_addr(struct pblk *pblk,
struct ppa_addr p) struct ppa_addr p)
{ {
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->ppaf; struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->addrf;
u64 paddr; u64 paddr;
paddr = (u64)p.g.ch << ppaf->ch_offset; paddr = (u64)p.g.ch << ppaf->ch_offset;
...@@ -988,7 +988,7 @@ static inline struct ppa_addr pblk_ppa32_to_ppa64(struct pblk *pblk, u32 ppa32) ...@@ -988,7 +988,7 @@ static inline struct ppa_addr pblk_ppa32_to_ppa64(struct pblk *pblk, u32 ppa32)
ppa64.c.line = ppa32 & ((~0U) >> 1); ppa64.c.line = ppa32 & ((~0U) >> 1);
ppa64.c.is_cached = 1; ppa64.c.is_cached = 1;
} else { } else {
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->ppaf; struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->addrf;
ppa64.g.ch = (ppa32 & ppaf->ch_mask) >> ppaf->ch_offset; ppa64.g.ch = (ppa32 & ppaf->ch_mask) >> ppaf->ch_offset;
ppa64.g.lun = (ppa32 & ppaf->lun_mask) >> ppaf->lun_offset; ppa64.g.lun = (ppa32 & ppaf->lun_mask) >> ppaf->lun_offset;
...@@ -1011,7 +1011,7 @@ static inline u32 pblk_ppa64_to_ppa32(struct pblk *pblk, struct ppa_addr ppa64) ...@@ -1011,7 +1011,7 @@ static inline u32 pblk_ppa64_to_ppa32(struct pblk *pblk, struct ppa_addr ppa64)
ppa32 |= ppa64.c.line; ppa32 |= ppa64.c.line;
ppa32 |= 1U << 31; ppa32 |= 1U << 31;
} else { } else {
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->ppaf; struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&pblk->addrf;
ppa32 |= ppa64.g.ch << ppaf->ch_offset; ppa32 |= ppa64.g.ch << ppaf->ch_offset;
ppa32 |= ppa64.g.lun << ppaf->lun_offset; ppa32 |= ppa64.g.lun << ppaf->lun_offset;
...@@ -1029,7 +1029,7 @@ static inline struct ppa_addr pblk_trans_map_get(struct pblk *pblk, ...@@ -1029,7 +1029,7 @@ static inline struct ppa_addr pblk_trans_map_get(struct pblk *pblk,
{ {
struct ppa_addr ppa; struct ppa_addr ppa;
if (pblk->ppaf_bitsize < 32) { if (pblk->addrf_len < 32) {
u32 *map = (u32 *)pblk->trans_map; u32 *map = (u32 *)pblk->trans_map;
ppa = pblk_ppa32_to_ppa64(pblk, map[lba]); ppa = pblk_ppa32_to_ppa64(pblk, map[lba]);
...@@ -1045,7 +1045,7 @@ static inline struct ppa_addr pblk_trans_map_get(struct pblk *pblk, ...@@ -1045,7 +1045,7 @@ static inline struct ppa_addr pblk_trans_map_get(struct pblk *pblk,
static inline void pblk_trans_map_set(struct pblk *pblk, sector_t lba, static inline void pblk_trans_map_set(struct pblk *pblk, sector_t lba,
struct ppa_addr ppa) struct ppa_addr ppa)
{ {
if (pblk->ppaf_bitsize < 32) { if (pblk->addrf_len < 32) {
u32 *map = (u32 *)pblk->trans_map; u32 *map = (u32 *)pblk->trans_map;
map[lba] = pblk_ppa64_to_ppa32(pblk, ppa); map[lba] = pblk_ppa64_to_ppa32(pblk, ppa);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment