summaryrefslogtreecommitdiff
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-06-30 18:56:37 +0300
committerJens Axboe <axboe@kernel.dk>2017-06-30 20:08:18 +0300
commit10888129783cc8daeeb9c47942876b917532b58c (patch)
tree1658076640b2113a91e191f72e4033c8d40b6a9f /drivers/lightnvm
parent653cbb8472b88f0781d9191685bd6603f344214d (diff)
downloadlinux-10888129783cc8daeeb9c47942876b917532b58c.tar.xz
lightnvm: pblk: schedule if data is not ready
When user threads place data into the write buffer, they reserve space and do the memory copy out of the lock. As a consequence, when the write thread starts persisting data, there is a chance that it is not copied yet. In this case, avoid polling, and schedule before retrying. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <matias@cnexlabs.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/pblk-rb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c
index 665a4ccfe7f5..2dda874af890 100644
--- a/drivers/lightnvm/pblk-rb.c
+++ b/drivers/lightnvm/pblk-rb.c
@@ -578,8 +578,10 @@ unsigned int pblk_rb_read_to_bio(struct pblk_rb *rb, struct nvm_rq *rqd,
*/
try:
flags = READ_ONCE(entry->w_ctx.flags);
- if (!(flags & PBLK_WRITTEN_DATA))
+ if (!(flags & PBLK_WRITTEN_DATA)) {
+ io_schedule();
goto try;
+ }
page = virt_to_page(entry->data);
if (!page) {