Received: by 10.192.165.156 with SMTP id m28csp858407imm; Mon, 16 Apr 2018 09:49:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/IFUMe5bZzmW0PJM+N4UU7wc/oRxKkAeoUZoSdQ3oNi5Z+iSUEEIJConU/SymjwEvpA6sg X-Received: by 10.98.103.86 with SMTP id b83mr2014961pfc.76.1523897362616; Mon, 16 Apr 2018 09:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523897362; cv=none; d=google.com; s=arc-20160816; b=wG5WwLapTxicncUHicYp9AnPm3Y163nM4viSjVWY2nt4IRI7MoBRsJ2NtF3KQdLWgH n0H/acmnRUul6huGn4EtxcULbUZGmcTmhfnuCcC+lbcKTzp7JI6rTBB6Nfs+DpjC3vik jW7DhljmkjCMX0WxG+NWN+KnztxODEzqAGdV7HCCANNzr9yA4fBHlqVetmfEwhV3cAt8 2tHcEQKZBiswYW7ezTcxlGiv5CQAb/gKdKsvTbQYdJAYOOHVVNnztrJIT92Bt+H1XIIN QPfdsfTmp2Lo5z9YDhD9BTrB4Deb1ymt9zgHUcVWzFkSwiVCVl+9iCkyLtJDPbVebCa5 3mgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2kz53ZPbYvKpAVmieoQ28ZP6tTegWv02bmRMvuFUy+0=; b=FZiynd9KnL5SikU7j9YISzXwKNh1S+DoLabgeqD8EfsGsokmQtHsS+0w/AhGh8P+iH B0/DyYPLMyUlyL7a2SCBAz28T4uzpggw8wzTbYlg1z/OjYVJCE95btAeQD1NRzvS7I46 7C7ZJv7s79LLmvHoNCmyf0qW6gyxhJAewhNUxAx+Fo2nGxDMx8LqdSbdVxMT2f3Tcvfj 1H04qGd/9jUYy056lGOOoBHph1TCo6pXJO8rm0/UbF7nE7slSqf4WpqMipWvEOKR2ufB T429s9BZ8qQdXFwX9I2S2Ie3j/iJPiqyWvOICjzozE1Ue41P9Yw1p33rGKPMKtBOnW2q uFUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=MywgYyj2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si9369956pgf.125.2018.04.16.09.49.08; Mon, 16 Apr 2018 09:49:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=MywgYyj2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752866AbeDPQqy (ORCPT + 99 others); Mon, 16 Apr 2018 12:46:54 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38412 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbeDPQqv (ORCPT ); Mon, 16 Apr 2018 12:46:51 -0400 Received: by mail-lf0-f67.google.com with SMTP id n14-v6so5493490lfe.5 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=Mm3X7p4PCfyP7LYKtHjjtI0Vz7LkQZsaDhwhUIsbjWT3RksuXeCLIbflRVnPytL9Q/ IADYnDS44ho6CPHfGFgnw+nW4SBpuQz3m3Uj5GPldvcUeyFO1INldk349ROhPqD6gN3p mHehRBdrXEfaYvFsR9ZWMj7p2L9x1kjldmXdy7dNgnyiS8egDFr6D7SQPaAcDBEhNaWh KLGJqRkXHHYsVvW66FNgBKZ+07ysYyGfhiYqzJwyay11cpLd8Q19ApQJBlrKuOmOpFn+ nvNZ/fjFOnMA8Lc9VQhIXzk+IAezs6rk9nW8MDtB3JdBdO4rWqd2CFsLPk01GdDEQkLv p+pQ== X-Gm-Message-State: ALQs6tCkDytOM03CwvqgKBxDpjzeo8xj49vmJhGbO08dR0hjKJPpfWX/ mqMEMFN1WNMdpDjBV8I547rFhA== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.7.4