summaryrefslogtreecommitdiff
path: root/drivers/lightnvm/pblk-rl.c
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2017-10-13 15:46:05 +0300
committerJens Axboe <axboe@kernel.dk>2017-10-13 17:34:57 +0300
commitda67e68fb9d37fb9072b20cc75d4337a73bc01b4 (patch)
tree81f0a1b1872dfaf14959b8f8b730bafcf512c309 /drivers/lightnvm/pblk-rl.c
parente0e12a707f02fcde1b77a2417d9fb0ae1ce3b003 (diff)
downloadlinux-da67e68fb9d37fb9072b20cc75d4337a73bc01b4.tar.xz
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;