lightnvm: pblk: kick writer on new flush points

Unless we kick the writer directly when setting a new flush point, the
user risks having to wait for up to one second (the default timeout for
the write thread to be kicked) for the IO to complete.

Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Hans Holmberg 2018-06-01 16:41:13 +02:00 committed by Jens Axboe
parent b06be2873d
commit cc9c9a00b1
4 changed files with 10 additions and 7 deletions

View file

@ -44,13 +44,15 @@ int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags)
goto out; goto out;
} }
if (unlikely(!bio_has_data(bio)))
goto out;
pblk_ppa_set_empty(&w_ctx.ppa); pblk_ppa_set_empty(&w_ctx.ppa);
w_ctx.flags = flags; w_ctx.flags = flags;
if (bio->bi_opf & REQ_PREFLUSH) if (bio->bi_opf & REQ_PREFLUSH) {
w_ctx.flags |= PBLK_FLUSH_ENTRY; w_ctx.flags |= PBLK_FLUSH_ENTRY;
pblk_write_kick(pblk);
}
if (unlikely(!bio_has_data(bio)))
goto out;
for (i = 0; i < nr_entries; i++) { for (i = 0; i < nr_entries; i++) {
void *data = bio_data(bio); void *data = bio_data(bio);

View file

@ -322,7 +322,7 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags,
return -1; return -1;
} }
static void pblk_write_kick(struct pblk *pblk) void pblk_write_kick(struct pblk *pblk)
{ {
wake_up_process(pblk->writer_ts); wake_up_process(pblk->writer_ts);
mod_timer(&pblk->wtimer, jiffies + msecs_to_jiffies(1000)); mod_timer(&pblk->wtimer, jiffies + msecs_to_jiffies(1000));

View file

@ -419,7 +419,7 @@ void pblk_rb_flush(struct pblk_rb *rb)
if (pblk_rb_flush_point_set(rb, NULL, mem)) if (pblk_rb_flush_point_set(rb, NULL, mem))
return; return;
pblk_write_should_kick(pblk); pblk_write_kick(pblk);
} }
static int pblk_rb_may_write_flush(struct pblk_rb *rb, unsigned int nr_entries, static int pblk_rb_may_write_flush(struct pblk_rb *rb, unsigned int nr_entries,

View file

@ -851,6 +851,7 @@ void pblk_map_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned int sentry,
int pblk_write_ts(void *data); int pblk_write_ts(void *data);
void pblk_write_timer_fn(struct timer_list *t); void pblk_write_timer_fn(struct timer_list *t);
void pblk_write_should_kick(struct pblk *pblk); void pblk_write_should_kick(struct pblk *pblk);
void pblk_write_kick(struct pblk *pblk);
/* /*
* pblk read path * pblk read path