From patchwork Fri Jun 1 14:41:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C43D603D7 for ; Fri, 1 Jun 2018 14:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFB32860A for ; Fri, 1 Jun 2018 14:44:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 023D228944; Fri, 1 Jun 2018 14:44:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93BD92860A for ; Fri, 1 Jun 2018 14:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751777AbeFAOoU (ORCPT ); Fri, 1 Jun 2018 10:44:20 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35556 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752091AbeFAOoG (ORCPT ); Fri, 1 Jun 2018 10:44:06 -0400 Received: by mail-lf0-f67.google.com with SMTP id y72-v6so15199051lfd.2 for ; Fri, 01 Jun 2018 07:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t4UJgmPAoWXAPzkJXegkwQF3rEmJOP6O+pYEdYN9bis=; b=N7t4vQ+wJncG46q0D8NYRTSY5YpYyXdlTF1YMw+yAVFzQRLzsWsodmB3wBofa70prn F44kub6tCyZSLFRHvafS6K8lQuLZ1a7QS95PEMhejPSLU/QNF4DtZ6/+LlbQa0GpLS2X xkBXxWVSf1b3/WCM73dGWJH1xTT13PfcO2cU4Nf74cAsG62PUs7/v/dXhiBwXVtvvws8 7ZhKJfiVneH3XPWsK08kA2HGNJ8kfljzoozSsCBoSyWCi6Fn+BVViN43qVWQDPcQVYKp 10+uGLiQdu28xTvS0KWO9VpOWJbm498la6QQVOs9TmI8iCNxXevFYp5En5me2fXYR706 +LSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t4UJgmPAoWXAPzkJXegkwQF3rEmJOP6O+pYEdYN9bis=; b=S3Z7W6BMo+MYkd7+fhcpy2ep8YH+31umYbmR99nAFqk2YP8r/5C1tJ03nOBzEc3ZU8 EvQIcb9q1Z2TllIBf0lSBq94lQcoMyMpDpB/UhrqsPdGVxw7Tg8HABQioiIP3JknOJqF GRAJGpjw8oo4yoaQE0XpDptQ7jBdSXM3ZgBun848M3mN1hIJzepGNOyr2280wzViG3kA k3C3KHqu9JVNxvCRaAUSGt2xcsOMfEoOPEudhRTYefGLS3g1+lKLCBTq46vlil4Ou4yt +GNQbKCxuygE5txweHT4+7hpGOCfnAaK6/hn8R4ERCUI0fLyRvwAqbDLaaj2y1EJxI0C zXqA== X-Gm-Message-State: ALKqPweTI++e+Z9U/RjYTkmYlw9eUzPJWUJIBtclrKUy6wybv8porH+o dWJnN9iS9nU4GDq9kmguyoJPVw== X-Google-Smtp-Source: ADUXVKIMRfljU0GZV7cwlP28zDA0d/lSIZR7cBwJZPso9HMfjvWCazu7jgnZ9CRVOLWU3KEW3MkHOQ== X-Received: by 2002:a2e:7310:: with SMTP id o16-v6mr3657451ljc.29.1527864244759; Fri, 01 Jun 2018 07:44:04 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id e65-v6sm356488lff.13.2018.06.01.07.44.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 07:44:03 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, Hans Holmberg , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 09/10] lightnvm: pblk: kick writer on new flush points Date: Fri, 1 Jun 2018 16:41:13 +0200 Message-Id: <20180601144114.17490-10-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601144114.17490-1-mb@lightnvm.io> References: <20180601144114.17490-1-mb@lightnvm.io> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Holmberg 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 Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-cache.c | 10 ++++++---- drivers/lightnvm/pblk-core.c | 2 +- drivers/lightnvm/pblk-rb.c | 4 ++-- drivers/lightnvm/pblk.h | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/lightnvm/pblk-cache.c b/drivers/lightnvm/pblk-cache.c index 29a23111b31c..b1c6d7eb6115 100644 --- a/drivers/lightnvm/pblk-cache.c +++ b/drivers/lightnvm/pblk-cache.c @@ -44,13 +44,15 @@ int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags) 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); diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 99036befb571..a5750534efed 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -322,7 +322,7 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags, 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)); diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c index 1b74ec51a4ad..00cd1f20a196 100644 --- a/drivers/lightnvm/pblk-rb.c +++ b/drivers/lightnvm/pblk-rb.c @@ -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, diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 725bc1bfa849..34cc1d64a9d4 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -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