Skip to content

Commit

Permalink
lightnvm: pblk: schedule if data is not ready
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Javier González authored and Jens Axboe committed Jun 30, 2017
1 parent 653cbb8 commit 1088812
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/lightnvm/pblk-rb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1088812

Please sign in to comment.