Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1326780

[RFC 1/4] lightnvm: precalculate controller write boundaries

From "Javier González" <jg@lightnvm.io>
Newsgroups linux.kernel
Subject [RFC 1/4] lightnvm: precalculate controller write boundaries
Date 2016-02-04 14:10 +0100
Message-ID <qYrPC-Co-55@gated-at.bofh.it> (permalink)
References <qYrPA-Co-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <javier@cnexlabs.com>
---
 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
 	 */
-- 
2.1.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/4] lightnvm: add write buffering to rrpc "Javier González" <jg@lightnvm.io> - 2016-02-04 14:10 +0100
  [RFC 4/4] lightnvm: add debug info for rrpc target "Javier González" <jg@lightnvm.io> - 2016-02-04 14:10 +0100
  [RFC 3/4] lightnvm: read from rrpc write buffer if possible "Javier González" <jg@lightnvm.io> - 2016-02-04 14:10 +0100
    Re: [RFC 3/4] lightnvm: read from rrpc write buffer if possible Matias Bjørling <mb@lightnvm.io> - 2016-02-05 16:00 +0100
  [RFC 1/4] lightnvm: precalculate controller write boundaries "Javier González" <jg@lightnvm.io> - 2016-02-04 14:10 +0100
    Re: [RFC 1/4] lightnvm: precalculate controller write boundaries Matias Bjørling <mb@lightnvm.io> - 2016-02-05 16:00 +0100

csiph-web