lightnvm: pblk: kick writer on new flush points
authorHans Holmberg <hans.holmberg@cnexlabs.com>
Fri, 1 Jun 2018 14:41:13 +0000 (16:41 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 1 Jun 2018 15:02:53 +0000 (09:02 -0600)
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>
drivers/lightnvm/pblk-cache.c
drivers/lightnvm/pblk-core.c
drivers/lightnvm/pblk-rb.c
drivers/lightnvm/pblk.h

index 29a23111b31c4792128acb749b0b679c4ba0abcb..b1c6d7eb61157138513ff0ebcff8a3ffcc65b193 100644 (file)
@@ -44,13 +44,15 @@ retry:
                goto out;
        }
 
-       if (unlikely(!bio_has_data(bio)))
-               goto out;
-
        pblk_ppa_set_empty(&w_ctx.ppa);
        w_ctx.flags = flags;
-       if (bio->bi_opf & REQ_PREFLUSH)
+       if (bio->bi_opf & REQ_PREFLUSH) {
                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++) {
                void *data = bio_data(bio);
index 99036befb571829acd0353f498d4f679362083ed..a5750534efed075bb37c376fbceaf5a1714ef7db 100644 (file)
@@ -322,7 +322,7 @@ err:
        return -1;
 }
 
-static void pblk_write_kick(struct pblk *pblk)
+void pblk_write_kick(struct pblk *pblk)
 {
        wake_up_process(pblk->writer_ts);
        mod_timer(&pblk->wtimer, jiffies + msecs_to_jiffies(1000));
index 1b74ec51a4ad09ebcd9db2345ad3a390f26a6161..00cd1f20a1962f74c7c5e8abec6b9fec53a61af1 100644 (file)
@@ -349,7 +349,7 @@ void pblk_rb_write_entry_gc(struct pblk_rb *rb, void *data,
 }
 
 static int pblk_rb_flush_point_set(struct pblk_rb *rb, struct bio *bio,
-                                 unsigned int pos)
+                                  unsigned int pos)
 {
        struct pblk_rb_entry *entry;
        unsigned int sync, flush_point;
@@ -419,7 +419,7 @@ void pblk_rb_flush(struct pblk_rb *rb)
        if (pblk_rb_flush_point_set(rb, NULL, mem))
                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,
index 725bc1bfa849b3f0edcaa068219ecd2e2e9b28b5..34cc1d64a9d42a9646af08d6695d260883aa54a8 100644 (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);
 void pblk_write_timer_fn(struct timer_list *t);
 void pblk_write_should_kick(struct pblk *pblk);
+void pblk_write_kick(struct pblk *pblk);
 
 /*
  * pblk read path