Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Javier González and committed by
Jens Axboe
9205e449 05b700ba

+6 -1
+6 -1
drivers/lightnvm/pblk-rl.c
··· 233 233 /* To start with, all buffer is available to user I/O writers */ 234 234 rl->rb_budget = budget; 235 235 rl->rb_user_max = budget; 236 - rl->rb_max_io = threshold ? (budget - threshold) : (budget - 1); 237 236 rl->rb_gc_max = 0; 238 237 rl->rb_state = PBLK_RL_HIGH; 238 + 239 + /* Maximize I/O size and ansure that back threshold is respected */ 240 + if (threshold) 241 + rl->rb_max_io = budget - pblk->min_write_pgs_data - threshold; 242 + else 243 + rl->rb_max_io = budget - pblk->min_write_pgs_data - 1; 239 244 240 245 atomic_set(&rl->rb_user_cnt, 0); 241 246 atomic_set(&rl->rb_gc_cnt, 0);