From patchwork Mon Apr 16 16:46:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Holmberg X-Patchwork-Id: 10343477 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 61789601D7 for ; Mon, 16 Apr 2018 16:47:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5220728821 for ; Mon, 16 Apr 2018 16:47:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4520428824; Mon, 16 Apr 2018 16:47:07 +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 D719A28821 for ; Mon, 16 Apr 2018 16:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751227AbeDPQqx (ORCPT ); Mon, 16 Apr 2018 12:46:53 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39851 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752770AbeDPQqv (ORCPT ); Mon, 16 Apr 2018 12:46:51 -0400 Received: by mail-lf0-f68.google.com with SMTP id p142-v6so23087111lfd.6 for ; Mon, 16 Apr 2018 09:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2kz53ZPbYvKpAVmieoQ28ZP6tTegWv02bmRMvuFUy+0=; b=MywgYyj2alwD98gBCH2HwcZxdO6upoHa+7L+TQnxCtVEk/AFRKZEPc9us5O/ZbzPld LRBHKKEJPO/tjEuGi3mFde3iLZkBb10J2zjm6vXNxLkIbI0WWYKEuJz5MJJu/Lb6otSt K2CXvwihDqAckZ2C+v6t9/1R/ymsVy0PTMiBfLZAUkYJa/fXiwL6jEJap+nz2dePTJOE 7ojyZSt+F8xzbH8LpCGMZtKK2r8MGs2eY2PL6CHa453wpXh7I02ynSxfnL71eFjig1tW llyfXkTRabrWXiKu6wEjCXB6eRmsPKMaoN5PmkDnByzi9dg4v4Vn67wsM1IwdxNzPOhL BqbA== 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; bh=2kz53ZPbYvKpAVmieoQ28ZP6tTegWv02bmRMvuFUy+0=; b=glrmsKkUQJQKV0fa7uJBVD66dzdxnZf1VQkNbRdGYEVVIpYR8CwnuCtq4lm8wCoogk ifNv6ySKoJsA1BZdqmW3VwGk4jR2vtJBsIR0aNuRzW5DyJKL8rYSgncyL8yoVK6GHreS 5SM4AaFYub1Sn4+YqsRWdb/IPzHRH32sPUQzAvCwhPW8TbGWH6OPKaj2x8vEO+BGuH+y ZTsfGML80jowH1KDabZvXujuttsmGTxeWm8DIjM5S7tQ/N5tnGx4STYRT4OPbeVWdg7A yghmh0x2GxT5nJDa27yeqQCQZbaB3NftslIN2KPYo3FOLZlIUiRRR6pYkq5iqH1yU6Mu wNWQ== X-Gm-Message-State: ALQs6tCwSQY6bMnowk9v/dw9p9irc1KtXwvajzVM5LGZXLRi35kbn+sO xCzd2iDIo7xG/yfZ9rMeYubSsQ== X-Google-Smtp-Source: AIpwx4/l1RdAALfjykGCHCwtnl9PCsH/0XU7gNzQl3d32YuA6aBO40o74K876HnhtsPVZ2rAn7O9Hw== X-Received: by 10.46.47.7 with SMTP id v7mr9774177ljv.56.1523897210050; Mon, 16 Apr 2018 09:46:50 -0700 (PDT) Received: from titan.bredbandsbolaget.se (c-b9b6e655.03-91-6d6c6d4.cust.bredbandsbolaget.se. [85.230.182.185]) by smtp.gmail.com with ESMTPSA id f200-v6sm2953241lff.35.2018.04.16.09.46.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 09:46:49 -0700 (PDT) From: Hans Holmberg To: Matias Bjorling Cc: linux-block@vger.kernel.org, Javier Gonzales , linux-kernel@vger.kernel.org, Hans Holmberg Subject: [PATCH 2/2] lightnvm: pblk: kick writer on new flush points Date: Mon, 16 Apr 2018 18:46:16 +0200 Message-Id: <1523897176-6241-3-git-send-email-hans.ml.holmberg@owltronix.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523897176-6241-1-git-send-email-hans.ml.holmberg@owltronix.com> References: <1523897176-6241-1-git-send-email-hans.ml.holmberg@owltronix.com> 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 --- 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 29a2311..b1c6d7e 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 94d5d97..ceacd10 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -320,7 +320,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 52fdd85..7a63291 100644 --- a/drivers/lightnvm/pblk-rb.c +++ b/drivers/lightnvm/pblk-rb.c @@ -350,7 +350,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; @@ -420,7 +420,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 9c682ac..856ac41 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -837,6 +837,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