From patchwork Tue Oct 9 11:12:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6AA7112B for ; Tue, 9 Oct 2018 11:15:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C700428A5E for ; Tue, 9 Oct 2018 11:15:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB0A628A6E; Tue, 9 Oct 2018 11:15: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=ham 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 60DAE28A5E for ; Tue, 9 Oct 2018 11:15:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728067AbeJIScB (ORCPT ); Tue, 9 Oct 2018 14:32:01 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46323 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728065AbeJIScA (ORCPT ); Tue, 9 Oct 2018 14:32:00 -0400 Received: by mail-pf1-f196.google.com with SMTP id r64-v6so662121pfb.13 for ; Tue, 09 Oct 2018 04:15:33 -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=scqHsI3HlhjRne5zqhqQcdC0bvrSN31aH4jvWzbjnHs=; b=A/KTUzajkUFoYYKFrg1YawGzpQCPE3174xtLwhMe/CMAgnvsGwFpV8m5jTtG+MmQFG BAnyLvbq5FCuKNfqFgkFY/dUGAD+KtgMwY5diduwONK9nSkFgjBlFtxs70Egre3HYajg Q3w5x5WxQ1Xh+zKLPM+PQNreUhYPQjHlvmRjaDvINrKpBEi8ZtCX6RG6NW5ZzCJsjl8t MivqkAmopb8PpCDJtz1O/DHyT/WoUxwF3uZOtj92nKTe2GOFwc5Y+5MNo/O++hUIkPLo uNz9L39cf10otGg5Q+7N4Vk9lUoNPxCXlzFESDEHgfK7twJZWEg5FP/Ex311oDEAMdke B2+A== 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=scqHsI3HlhjRne5zqhqQcdC0bvrSN31aH4jvWzbjnHs=; b=LZ3DfuXJfVdKpjDl0wjadfDQD/9fvdI/e+fvvTWzYTAbVGl/0IkBlHcxvJuUaat/HF FgqwijvR8fSyf3GfKpJoeIicekUaKx4ehGTV4A9gXvdKrwl56mRs2B5JUPk3Pnvqw5B8 PBt/u7XHZniGUjN/lyeVGMd0edH8jdric5yqlAfS+inHgf9elejeu2SmSYqdV16VlUmF dfoscFYSOfmCba3QeomgSNf4YsdIEhxA33Q0lMRuE1gkHxaauqsBbVmTpriBGRwQ45Qc ONvV2YLMaYb3C7+jBjm8j1ZUxX8sa7o/HCj1En/ucy9T2ptIImW6439AUln30LoD7bUr Qe0Q== X-Gm-Message-State: ABuFfoiXe5Dk9CaW/AzdZMTx3DClP33GoX8jGZuLcy2w9tBRA5XJ6rB4 TYrwRqXrybhCAJjxoK+mShHcxw== X-Google-Smtp-Source: ACcGV613HIo9cyNGOvkPkx9nqescbZcXBaeAWCB5YFRsDT0lqQS8aer+1XujBd9gwe7mOxJCW94osQ== X-Received: by 2002:a63:b04f:: with SMTP id z15-v6mr23485255pgo.442.1539083733101; Tue, 09 Oct 2018 04:15:33 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.15.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:15:31 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Jav?= =?utf-8?q?ier_Gonz=C3=A1lez?= , =?utf-8?q?Javier_Gonz?= =?utf-8?q?=C3=A1lez?= , =?utf-8?q?Matias_Bj=C3=B8rling?= Subject: [GIT PULL 41/45] lightnvm: pblk: guarantee mw_cunits on read buffer Date: Tue, 9 Oct 2018 13:12:11 +0200 Message-Id: <20181009111215.7653-42-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-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: Javier González OCSSD 2.0 defines the amount of data that the host must buffer per chunk to guarantee reads through the geometry field mw_cunits. This value is the base that pblk uses to determine the size of its read buffer. Currently, this size is set to be the closes power-of-2 to mw_cunits times the number of parallel units available to the pblk instance for each open line (currently one). When an entry (4KB) is put in the buffer, the L2P table points to it. As the buffer wraps up, the L2P is updated to point to addresses on the device, thus guaranteeing mw_cunits at a chunk level. However, given that pblk cannot write to the device under ws_min (normally ws_opt), there might be a window in which the buffer starts wrapping up and updating L2P entries before the mw_cunits value in a chunk has been surpassed. In order not to violate the mw_cunits constrain in this case, account for ws_opt on the read buffer creation. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index b2c49fc006c9..e0db0cb3122d 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -195,7 +195,8 @@ static int pblk_rwb_init(struct pblk *pblk) unsigned long buffer_size; int pgs_in_buffer; - pgs_in_buffer = max(geo->mw_cunits, geo->ws_opt) * geo->all_luns; + pgs_in_buffer = (max(geo->mw_cunits, geo->ws_opt) + geo->ws_opt) + * geo->all_luns; if (write_buffer_size && (write_buffer_size > pgs_in_buffer)) buffer_size = write_buffer_size;