From patchwork Thu Feb 4 13:08:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 8221381 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 545ACBEEE5 for ; Thu, 4 Feb 2016 13:10:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80701201B9 for ; Thu, 4 Feb 2016 13:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94E22202C8 for ; Thu, 4 Feb 2016 13:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965613AbcBDNKu (ORCPT ); Thu, 4 Feb 2016 08:10:50 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:33174 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933974AbcBDNI1 (ORCPT ); Thu, 4 Feb 2016 08:08:27 -0500 Received: by mail-wm0-f45.google.com with SMTP id g62so3606280wme.0 for ; Thu, 04 Feb 2016 05:08:26 -0800 (PST) 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-type:content-transfer-encoding; bh=2QHXaQIEeTwmLhZ6RszTSpH6X2cZWjuWya6TklsiRnE=; b=HVWd4NapQtWE+DImcoC8nXdYJJ0jSDqDENz3B27lUhlVtqG4Y799YG2WpCh2ASeifZ 0q5Be6CV9VQpMiw02lIwO8ZwD+4LQvHv8gAWMirMpXHnDmZyYYK5Rzl7eMuGJIlESOlT G81Me6TDcL4AbSKPYH6HYUpfTSjtYobJug8JwODl0uqt3hYxn1R3eMgHKstFMLSCi4s/ HNB0MBEQEDHrFhLAHcx1i2+Cqp5ZjrrX2ReHJMejTQBxCBN8iQ8kT9p/++Oujo9RMTvR eQhrhXcBoSSC9+VEXz2uk98/a2UkCRgmUTBJMKdy2Rl+tNPJ07XTQIFMj4+/OmmygJVI 1v3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=2QHXaQIEeTwmLhZ6RszTSpH6X2cZWjuWya6TklsiRnE=; b=fgUrEBRQPXJqHnPPaylzWq2dz+pS5D7Vj2F8AXKwzawHgrbKsRvEMac1hfkKttynxm TpU5HiwCUSFh+l54g9c9Ird2ZXR8JHaVoA62KiUSqZsoEb+vPSR6Ns6uNPuxnXwpu3+C Hycbx8u+z6JQKuH0HORje1JB8DfZVm+zw4hmKd+N35OuZ98bK9ieWoYDeCbRfrF4m3UL /xx0sVuuL4Iw6ak4y1R9MQZyJaQ9ZE8AK8xwXbfqu1y7odPJc6RRtfDJuzcBvMeX4Qob QNC6U5hv0hbnvWj4eMThhEToekMnEBnUZq60+LEoeHhygYsYk8M8zG5djcwepi5dqrBR XJAw== X-Gm-Message-State: AG10YOScOLH6NIXgql39oQn34MPGEqA3sGeX5CtuZrdqgO5BWBNYQu9M4jCpwS8iXRa7FQ== X-Received: by 10.28.229.20 with SMTP id c20mr9723222wmh.79.1454591305713; Thu, 04 Feb 2016 05:08:25 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id w62sm26238647wmg.21.2016.02.04.05.08.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 05:08:25 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [RFC 1/4] lightnvm: precalculate controller write boundaries Date: Thu, 4 Feb 2016 14:08:16 +0100 Message-Id: <1454591299-30305-2-git-send-email-javier@javigon.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454591299-30305-1-git-send-email-javier@javigon.com> References: <1454591299-30305-1-git-send-email-javier@javigon.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-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Flash controllers typically define flash pages as a collection of flash sectors of typically 4K. Moreover, flash controllers might program flash pages across several planes. This defines the write granurality at which flash can be programmed. This is different for each flash controller. In order to simplify calculations, and avoid repeating them in a per-I/O basis, this patch pre-calculates write granurality values as part of the device characteristics in the bring up. Signed-off-by: Javier González --- drivers/lightnvm/rrpc.c | 4 ++++ drivers/lightnvm/rrpc.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 775bf6c2..8187bf3 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -1149,6 +1149,10 @@ static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end) if (!rrpc->luns) return -ENOMEM; + rrpc->min_write_pgs = dev->sec_per_pl * (dev->sec_size / PAGE_SIZE); + /* assume max_phys_sect % dev->min_write_pgs == 0 */ + rrpc->max_write_pgs = dev->ops->max_phys_sect; + /* 1:1 mapping */ for (i = 0; i < rrpc->nr_luns; i++) { struct nvm_lun *lun = dev->mt->get_lun(dev, lun_begin + i); diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h index 3989d65..868e91a 100644 --- a/drivers/lightnvm/rrpc.h +++ b/drivers/lightnvm/rrpc.h @@ -107,6 +107,9 @@ struct rrpc { unsigned long long nr_sects; unsigned long total_blocks; + int min_write_pgs; /* minimum amount of pages required by controller */ + int max_write_pgs; /* maximum amount of pages supported by controller */ + /* Write strategy variables. Move these into each for structure for each * strategy */