]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
lightnvm: pblk: schedule if data is not ready
authorJavier González <jg@lightnvm.io>
Fri, 30 Jun 2017 15:56:37 +0000 (17:56 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 30 Jun 2017 17:08:18 +0000 (11:08 -0600)
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>
drivers/lightnvm/pblk-rb.c

index 665a4ccfe7f5d7ab57ff56303fcf407de3b7a4cc..2dda874af8909383f3861af830d7f0194c5a09a0 100644 (file)
@@ -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) {