From patchwork Tue Sep 18 08:03:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 10603817 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 5852113AD for ; Tue, 18 Sep 2018 08:03:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B2C428DEC for ; Tue, 18 Sep 2018 08:03:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F53529AAE; Tue, 18 Sep 2018 08:03:21 +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 D1CCE28DEC for ; Tue, 18 Sep 2018 08:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729310AbeIRNep (ORCPT ); Tue, 18 Sep 2018 09:34:45 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:45257 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729353AbeIRNeo (ORCPT ); Tue, 18 Sep 2018 09:34:44 -0400 Received: by mail-ed1-f67.google.com with SMTP id p52-v6so1081844eda.12 for ; Tue, 18 Sep 2018 01:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CwFrTRwqcZheB46+CYp0QBZLe0++Nso4ZveGciYkTPE=; b=VEBX5VKRc+6TdmBBlCV3rTfOGdu0j7Up8/nera208nk9yqjOMGDDP9tfCoiIJMmLcf d/H1JFGTL3tixjCGJ95EjmbOCS23XmYits7GWIcGfoEG0Tz5ouJO/H0wP3+znl4j2dSP +ke65OUqvBfQd8ehInDmA1Qa5pvnR08zaDlShoWSrj0Kh0uJvwAH1SdiVT6w1wiuZKio 9HkFFa6Cp3XMCh1rHOPXTuf+wE7jpIIZm57aorgYQcisZ+or1GF1Q4CoucOWpvk8Bklk Mw9RqUJpOOGd1WKCOX5D9PYvh8MTJO5acqKExQGa4FhNCR0dPJ73qz6Pt+fTesvNbCVb 57kA== 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=CwFrTRwqcZheB46+CYp0QBZLe0++Nso4ZveGciYkTPE=; b=XE4Aip/42+JPsF3pLZOBXVb04fZIjWzQu7crc8bNxM+Qhc/n8kcweoR32EVrRJlEV1 2jMAI++C6Dco+dASevt2U7oFoWrkwWWU3eebkqgW77mhOM3U8EX5md6B+UqpKi8y3TXG nszNjYs4Y5pO8vc8Cughtm0RhSj4VlaXVdnxSDxKKXR91/KjICu+I4IfPf1FpoMkeCwZ 19wloELufdSQXgpTyi06Z6h4azLYaBwRNPxJfBILM8qkJSSgN7PFOVNu2gDMlYdD1LLO e2029HoDEdU+Uq/egVkecz0x3N5CHbwaai/UsRw4AAHijYEkNuVjrWuI8FPTg0CQRQ1i 8/9g== X-Gm-Message-State: APzg51AmcPSBRviUwSlwCXtvPJKBKQi9aZBmJXraf6uzeeUjryiNp/OA pKjW8YlY/y/owHUrVRLBvPUWn7FpJVQ= X-Google-Smtp-Source: ANB0VdaVCtCkWshMrV0SyLBwXPSU9HEKazenWfTL1gzT9lWNzUlbIPMSNoWMbaXelykS0NpxDxVFgg== X-Received: by 2002:aa7:c40a:: with SMTP id j10-v6mr48344154edq.134.1537257796601; Tue, 18 Sep 2018 01:03:16 -0700 (PDT) Received: from ch-wrk-javier.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id l48-v6sm7221062eda.94.2018.09.18.01.03.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Sep 2018 01:03:15 -0700 (PDT) From: " =?utf-8?q?Javier_Gonz=C3=A1lez?= " X-Google-Original-From: =?utf-8?q?Javier_Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Jav?= =?utf-8?q?ier_Gonz=C3=A1lez?= Subject: [PATCH 4/4] lightnvm: pblk: guarantee mw_cunits on read buffer Date: Tue, 18 Sep 2018 10:03:05 +0200 Message-Id: <1537257785-31630-5-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537257785-31630-1-git-send-email-javier@cnexlabs.com> References: <1537257785-31630-1-git-send-email-javier@cnexlabs.com> 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 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 --- 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 549f13a58b33..604bb743b92b 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;