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>
This commit is contained in:
parent
aff3fb18f9
commit
afdc23c91e
|
@ -376,12 +376,6 @@ static int pblk_core_init(struct pblk *pblk)
|
|||
pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA);
|
||||
pblk_set_sec_per_write(pblk, pblk->min_write_pgs);
|
||||
|
||||
if (pblk->max_write_pgs > PBLK_MAX_REQ_ADDRS) {
|
||||
pblk_err(pblk, "vector list too big(%u > %u)\n",
|
||||
pblk->max_write_pgs, PBLK_MAX_REQ_ADDRS);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t),
|
||||
GFP_KERNEL);
|
||||
if (!pblk->pad_dist)
|
||||
|
|
|
@ -43,7 +43,7 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
|
|||
unsigned long *read_bitmap)
|
||||
{
|
||||
struct pblk_sec_meta *meta_list = rqd->meta_list;
|
||||
struct ppa_addr ppas[PBLK_MAX_REQ_ADDRS];
|
||||
struct ppa_addr ppas[NVM_MAX_VLBA];
|
||||
int nr_secs = rqd->nr_ppas;
|
||||
bool advanced_bio = false;
|
||||
int i, j = 0;
|
||||
|
@ -450,7 +450,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio)
|
|||
int ret = NVM_IO_ERR;
|
||||
|
||||
/* logic error: lba out-of-bounds. Ignore read request */
|
||||
if (blba >= pblk->rl.nr_secs || nr_secs > PBLK_MAX_REQ_ADDRS) {
|
||||
if (blba >= pblk->rl.nr_secs || nr_secs > NVM_MAX_VLBA) {
|
||||
WARN(1, "pblk: read lba out of bounds (lba:%llu, nr:%d)\n",
|
||||
(unsigned long long)blba, nr_secs);
|
||||
return NVM_IO_ERR;
|
||||
|
@ -547,7 +547,7 @@ static int read_ppalist_rq_gc(struct pblk *pblk, struct nvm_rq *rqd,
|
|||
struct pblk_line *line, u64 *lba_list,
|
||||
u64 *paddr_list_gc, unsigned int nr_secs)
|
||||
{
|
||||
struct ppa_addr ppa_list_l2p[PBLK_MAX_REQ_ADDRS];
|
||||
struct ppa_addr ppa_list_l2p[NVM_MAX_VLBA];
|
||||
struct ppa_addr ppa_gc;
|
||||
int valid_secs = 0;
|
||||
int i;
|
||||
|
|
|
@ -127,7 +127,7 @@ static void __pblk_rl_update_rates(struct pblk_rl *rl,
|
|||
} else if (free_blocks < rl->high) {
|
||||
int shift = rl->high_pw - rl->rb_windows_pw;
|
||||
int user_windows = free_blocks >> shift;
|
||||
int user_max = user_windows << PBLK_MAX_REQ_ADDRS_PW;
|
||||
int user_max = user_windows << ilog2(NVM_MAX_VLBA);
|
||||
|
||||
rl->rb_user_max = user_max;
|
||||
rl->rb_gc_max = max - user_max;
|
||||
|
@ -228,7 +228,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget)
|
|||
rl->rsv_blocks = min_blocks;
|
||||
|
||||
/* This will always be a power-of-2 */
|
||||
rb_windows = budget / PBLK_MAX_REQ_ADDRS;
|
||||
rb_windows = budget / NVM_MAX_VLBA;
|
||||
rl->rb_windows_pw = get_count_order(rb_windows);
|
||||
|
||||
/* To start with, all buffer is available to user I/O writers */
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
|
||||
#define PBLK_SECTOR (512)
|
||||
#define PBLK_EXPOSED_PAGE_SIZE (4096)
|
||||
#define PBLK_MAX_REQ_ADDRS (64)
|
||||
#define PBLK_MAX_REQ_ADDRS_PW (6)
|
||||
|
||||
#define PBLK_NR_CLOSE_JOBS (4)
|
||||
|
||||
|
@ -99,8 +97,8 @@ enum {
|
|||
PBLK_RL_LOW = 4
|
||||
};
|
||||
|
||||
#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * PBLK_MAX_REQ_ADDRS)
|
||||
#define pblk_dma_ppa_size (sizeof(u64) * PBLK_MAX_REQ_ADDRS)
|
||||
#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * NVM_MAX_VLBA)
|
||||
#define pblk_dma_ppa_size (sizeof(u64) * NVM_MAX_VLBA)
|
||||
|
||||
/* write buffer completion context */
|
||||
struct pblk_c_ctx {
|
||||
|
@ -218,8 +216,8 @@ struct pblk_lun {
|
|||
struct pblk_gc_rq {
|
||||
struct pblk_line *line;
|
||||
void *data;
|
||||
u64 paddr_list[PBLK_MAX_REQ_ADDRS];
|
||||
u64 lba_list[PBLK_MAX_REQ_ADDRS];
|
||||
u64 paddr_list[NVM_MAX_VLBA];
|
||||
u64 lba_list[NVM_MAX_VLBA];
|
||||
int nr_secs;
|
||||
int secs_to_gc;
|
||||
struct list_head list;
|
||||
|
|
Loading…
Reference in New Issue