aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorMatias Bjørling <mb@lightnvm.io>2018-10-09 07:11:37 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-09 10:25:06 -0400
commitafdc23c91e085c56d1b0c119563c202b07255599 (patch)
treeb6fb38867f5f5872cf67787b62daefff795f829c /drivers/lightnvm
parentaff3fb18f957de93e629c7d3d2c4ef1f360aa511 (diff)
lightnvm: pblk: unify vector max req constants
Both NVM_MAX_VLBA and PBLK_MAX_REQ_ADDRS define how many LBAs that are available in a vector command. pblk uses them interchangeably in its implementation. Use NVM_MAX_VLBA as the main one and remove usages of PBLK_MAX_REQ_ADDRS. Also remove the power representation that only has one user, and instead calculate it at runtime. Signed-off-by: Matias Bjørling <mb@lightnvm.io> Reviewed-by: Javier González <javier@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-init.c6
-rw-r--r--drivers/lightnvm/pblk-read.c6
-rw-r--r--drivers/lightnvm/pblk-rl.c4
-rw-r--r--drivers/lightnvm/pblk.h10
4 files changed, 9 insertions, 17 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 53bd52114aee..9119c64d6f62 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -376,12 +376,6 @@ static int pblk_core_init(struct pblk *pblk)
376 pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA); 376 pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA);
377 pblk_set_sec_per_write(pblk, pblk->min_write_pgs); 377 pblk_set_sec_per_write(pblk, pblk->min_write_pgs);
378 378
379 if (pblk->max_write_pgs > PBLK_MAX_REQ_ADDRS) {
380 pblk_err(pblk, "vector list too big(%u > %u)\n",
381 pblk->max_write_pgs, PBLK_MAX_REQ_ADDRS);
382 return -EINVAL;
383 }
384
385 pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t), 379 pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t),
386 GFP_KERNEL); 380 GFP_KERNEL);
387 if (!pblk->pad_dist) 381 if (!pblk->pad_dist)
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 07b7f82c7595..9c61c19be5dc 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -43,7 +43,7 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
43 unsigned long *read_bitmap) 43 unsigned long *read_bitmap)
44{ 44{
45 struct pblk_sec_meta *meta_list = rqd->meta_list; 45 struct pblk_sec_meta *meta_list = rqd->meta_list;
46 struct ppa_addr ppas[PBLK_MAX_REQ_ADDRS]; 46 struct ppa_addr ppas[NVM_MAX_VLBA];
47 int nr_secs = rqd->nr_ppas; 47 int nr_secs = rqd->nr_ppas;
48 bool advanced_bio = false; 48 bool advanced_bio = false;
49 int i, j = 0; 49 int i, j = 0;
@@ -450,7 +450,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
450 int ret = NVM_IO_ERR; 450 int ret = NVM_IO_ERR;
451 451
452 /* logic error: lba out-of-bounds. Ignore read request */ 452 /* logic error: lba out-of-bounds. Ignore read request */
453 if (blba >= pblk->rl.nr_secs || nr_secs > PBLK_MAX_REQ_ADDRS) { 453 if (blba >= pblk->rl.nr_secs || nr_secs > NVM_MAX_VLBA) {
454 WARN(1, "pblk: read lba out of bounds (lba:%llu, nr:%d)\n", 454 WARN(1, "pblk: read lba out of bounds (lba:%llu, nr:%d)\n",
455 (unsigned long long)blba, nr_secs); 455 (unsigned long long)blba, nr_secs);
456 return NVM_IO_ERR; 456 return NVM_IO_ERR;
@@ -547,7 +547,7 @@ static int read_ppalist_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
547 struct pblk_line *line, u64 *lba_list, 547 struct pblk_line *line, u64 *lba_list,
548 u64 *paddr_list_gc, unsigned int nr_secs) 548 u64 *paddr_list_gc, unsigned int nr_secs)
549{ 549{
550 struct ppa_addr ppa_list_l2p[PBLK_MAX_REQ_ADDRS]; 550 struct ppa_addr ppa_list_l2p[NVM_MAX_VLBA];
551 struct ppa_addr ppa_gc; 551 struct ppa_addr ppa_gc;
552 int valid_secs = 0; 552 int valid_secs = 0;
553 int i; 553 int i;
diff --git a/drivers/lightnvm/pblk-rl.c b/drivers/lightnvm/pblk-rl.c
index 6a0616a6fcaf..a32790f7b7fc 100644
--- a/drivers/lightnvm/pblk-rl.c
+++ b/drivers/lightnvm/pblk-rl.c
@@ -127,7 +127,7 @@ static void __pblk_rl_update_rates(struct pblk_rl *rl,
127 } else if (free_blocks < rl->high) { 127 } else if (free_blocks < rl->high) {
128 int shift = rl->high_pw - rl->rb_windows_pw; 128 int shift = rl->high_pw - rl->rb_windows_pw;
129 int user_windows = free_blocks >> shift; 129 int user_windows = free_blocks >> shift;
130 int user_max = user_windows << PBLK_MAX_REQ_ADDRS_PW; 130 int user_max = user_windows << ilog2(NVM_MAX_VLBA);
131 131
132 rl->rb_user_max = user_max; 132 rl->rb_user_max = user_max;
133 rl->rb_gc_max = max - user_max; 133 rl->rb_gc_max = max - user_max;
@@ -228,7 +228,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget)
228 rl->rsv_blocks = min_blocks; 228 rl->rsv_blocks = min_blocks;
229 229
230 /* This will always be a power-of-2 */ 230 /* This will always be a power-of-2 */
231 rb_windows = budget / PBLK_MAX_REQ_ADDRS; 231 rb_windows = budget / NVM_MAX_VLBA;
232 rl->rb_windows_pw = get_count_order(rb_windows); 232 rl->rb_windows_pw = get_count_order(rb_windows);
233 233
234 /* To start with, all buffer is available to user I/O writers */ 234 /* To start with, all buffer is available to user I/O writers */
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 579b4ea9716c..64ae0c7ed3bb 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -37,8 +37,6 @@
37 37
38#define PBLK_SECTOR (512) 38#define PBLK_SECTOR (512)
39#define PBLK_EXPOSED_PAGE_SIZE (4096) 39#define PBLK_EXPOSED_PAGE_SIZE (4096)
40#define PBLK_MAX_REQ_ADDRS (64)
41#define PBLK_MAX_REQ_ADDRS_PW (6)
42 40
43#define PBLK_NR_CLOSE_JOBS (4) 41#define PBLK_NR_CLOSE_JOBS (4)
44 42
@@ -99,8 +97,8 @@ enum {
99 PBLK_RL_LOW = 4 97 PBLK_RL_LOW = 4
100}; 98};
101 99
102#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * PBLK_MAX_REQ_ADDRS) 100#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * NVM_MAX_VLBA)
103#define pblk_dma_ppa_size (sizeof(u64) * PBLK_MAX_REQ_ADDRS) 101#define pblk_dma_ppa_size (sizeof(u64) * NVM_MAX_VLBA)
104 102
105/* write buffer completion context */ 103/* write buffer completion context */
106struct pblk_c_ctx { 104struct pblk_c_ctx {
@@ -218,8 +216,8 @@ struct pblk_lun {
218struct pblk_gc_rq { 216struct pblk_gc_rq {
219 struct pblk_line *line; 217 struct pblk_line *line;
220 void *data; 218 void *data;
221 u64 paddr_list[PBLK_MAX_REQ_ADDRS]; 219 u64 paddr_list[NVM_MAX_VLBA];
222 u64 lba_list[PBLK_MAX_REQ_ADDRS]; 220 u64 lba_list[NVM_MAX_VLBA];
223 int nr_secs; 221 int nr_secs;
224 int secs_to_gc; 222 int secs_to_gc;
225 struct list_head list; 223 struct list_head list;