summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-rl.c
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2017-10-13 14:46:05 +0200
committerJens Axboe <axboe@kernel.dk>2017-10-13 16:34:57 +0200
commitda67e68fb9d37fb9072b20cc75d4337a73bc01b4 (patch)
tree81f0a1b1872dfaf14959b8f8b730bafcf512c309 /drivers/lightnvm/pblk-rl.c
parentlightnvm: pblk: fix write I/O sync stat (diff)
downloadlinux-da67e68fb9d37fb9072b20cc75d4337a73bc01b4.tar.xz
linux-da67e68fb9d37fb9072b20cc75d4337a73bc01b4.zip
lightnvm: pblk: avoid deadlock on low LUN config
On low LUN configurations, make sure not to send bios that are bigger than the buffer size. Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target") Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-rl.c')
-rw-r--r--drivers/lightnvm/pblk-rl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/lightnvm/pblk-rl.c b/drivers/lightnvm/pblk-rl.c
index 9565c3bc4d0b..0896439a91b0 100644
--- a/drivers/lightnvm/pblk-rl.c
+++ b/drivers/lightnvm/pblk-rl.c
@@ -163,6 +163,11 @@ int pblk_rl_sysfs_rate_show(struct pblk_rl *rl)
return rl->rb_user_max;
}
+int pblk_rl_max_io(struct pblk_rl *rl)
+{
+ return rl->rb_max_io;
+}
+
static void pblk_rl_u_timer(unsigned long data)
{
struct pblk_rl *rl = (struct pblk_rl *)data;
@@ -199,6 +204,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget)
/* 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 = budget >> 1;
rl->rb_gc_max = 0;
rl->rb_state = PBLK_RL_HIGH;