diff options
author | Javier González <javier@javigon.com> | 2019-03-07 13:18:53 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-03-07 08:59:26 -0700 |
commit | 9205e44916b2ca2e959be4210133292a19e79b0d (patch) | |
tree | cdb5ac5d9609ae0966601476460cdb97d5570db7 | |
parent | 05b700ba6003fd98c41314f390df36e2b893e167 (diff) | |
download | blackbird-op-linux-9205e44916b2ca2e959be4210133292a19e79b0d.tar.gz blackbird-op-linux-9205e44916b2ca2e959be4210133292a19e79b0d.zip |
pblk: fix max_io calculation
When calculating the maximun I/O size allowed into the buffer, consider
the write size (ws_opt) used by the write thread in order to cover the
case in which, due to flushes, the mem and subm pointers are disaligned
by (ws_opt - 1). This case currently translates into a stall when
an I/O of the largest possible size is submitted.
Fixes: f9f9d1ae2c66 ("lightnvm: pblk: prevent stall due to wb threshold")
Signed-off-by: Javier González <javier@javigon.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/lightnvm/pblk-rl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-rl.c b/drivers/lightnvm/pblk-rl.c index b014957dde0b..a5f8bc2defbc 100644 --- a/drivers/lightnvm/pblk-rl.c +++ b/drivers/lightnvm/pblk-rl.c @@ -233,10 +233,15 @@ void pblk_rl_init(struct pblk_rl *rl, int budget, int threshold) /* To start with, all buffer is available to user I/O writers */ rl->rb_budget = budget; rl->rb_user_max = budget; - rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1); rl->rb_gc_max = 0; rl->rb_state = PBLK_RL_HIGH; + /* Maximize I/O size and ansure that back threshold is respected */ + if (threshold) + rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold; + else + rl->rb_max_io = budget - pblk->min_write_pgs_data - 1; + atomic_set(&rl->rb_user_cnt, 0); atomic_set(&rl->rb_gc_cnt, 0); atomic_set(&rl->rb_space, -1); |