lightnvm: pblk: set conservative threshold for user writes
authorHans Holmberg <hans.holmberg@cnexlabs.com>
Tue, 11 Dec 2018 19:16:13 +0000 (20:16 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 11 Dec 2018 19:22:33 +0000 (12:22 -0700)
commit3bcebc5bac0935d662f30d317e33ffa660bebf93
treea253b85173c905425e6dc5bcdd285399faa2419f
parent525f7bb2c9f9b2c6673854eade89e98fb3ba7802
lightnvm: pblk: set conservative threshold for user writes

In a worst-case scenario (random writes), OP% of sectors
in each line will be invalid, and we will then need
to move data out of 100/OP% lines to free a single line.

So, to prevent the possibility of running out of lines,
temporarily block user writes when there is less than
100/OP% free lines.

Also ensure that pblk creation does not produce instances
with insufficient over provisioning.

Insufficient over-provising is not a problem on real hardware,
but often an issue when running QEMU simulations (with few lines).
100 lines is enough to create a sane instance with the standard
(11%) over provisioning.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-init.c
drivers/lightnvm/pblk-rl.c
drivers/lightnvm/pblk.h