mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Javier González" <jg@lightnvm.io>
To: mb@lightnvm.io
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	"Javier González" <javier@cnexlabs.com>
Subject: [PATCH 4/4] lightnvm: Precalculate max/min sectors per req.
Date: Wed,  4 May 2016 17:31:32 +0200	[thread overview]
Message-ID: <1462375892-26533-4-git-send-email-javier@cnexlabs.com> (raw)
In-Reply-To: <1462375892-26533-1-git-send-email-javier@cnexlabs.com>

Add two precalculated values to nvm_rq: (i) maximum number of sectors
per general request; and (ii) minimum number of sectors per write
request.

Signed-off-by: Javier González <javier@cnexlabs.com>
---
 drivers/lightnvm/core.c  | 3 +++
 include/linux/lightnvm.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 4cd9803..85682d91 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -573,6 +573,9 @@ static int nvm_core_init(struct nvm_dev *dev)
 
 	dev->plane_mode = NVM_PLANE_SINGLE;
 	dev->max_rq_size = dev->ops->max_phys_sect * dev->sec_size;
+	dev->max_sec_rq = dev->ops->max_phys_sect;
+	/* assume max_phys_sect % dev->min_write_pgs == 0 */
+	dev->min_sec_w_rq = dev->sec_per_pl * (dev->sec_size / PAGE_SIZE);
 
 	if (grp->mpos & 0x020202)
 		dev->plane_mode = NVM_PLANE_DOUBLE;
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h
index 67e72f5..c2dfd0c 100644
--- a/include/linux/lightnvm.h
+++ b/include/linux/lightnvm.h
@@ -351,7 +351,9 @@ struct nvm_dev {
 	/* Calculated/Cached values. These do not reflect the actual usable
 	 * blocks at run-time.
 	 */
-	int max_rq_size;
+	int max_rq_size; /* maximum size of a single request */
+	int max_sec_rq; /* maximum amount of sectors that fit in one req. */
+	int min_sec_w_rq; /* minimum amount of sectors required on write req. */
 	int plane_mode; /* drive device in single, double or quad mode */
 
 	int sec_per_pl; /* all sectors across planes */
-- 
2.5.0

  parent reply	other threads:[~2016-05-04 15:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 15:31 [PATCH 1/4] lightnvm: add sync and close block I/O types Javier González
2016-05-04 15:31 ` [PATCH 2/4] lightnvm: rename nr_pages to nr_ppas on nvm_rq Javier González
2016-05-05  9:34   ` Matias Bjørling
2016-05-04 15:31 ` [PATCH 3/4] lightnvm: eliminate redundant variable Javier González
2016-05-05  9:52   ` Matias Bjørling
2016-05-04 15:31 ` Javier González [this message]
2016-05-05  9:54   ` [PATCH 4/4] lightnvm: Precalculate max/min sectors per req Matias Bjørling
2016-05-05 10:02     ` Javier González
2016-05-05  9:21 ` [PATCH 1/4] lightnvm: add sync and close block I/O types Matias Bjørling
2016-05-05  9:38   ` Javier González
2016-05-05 10:08     ` Matias Bjørling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462375892-26533-4-git-send-email-javier@cnexlabs.com \
    --to=jg@lightnvm.io \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@lightnvm.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®