* [PATCH] lightnvm: calculate device values correctly
@ 2015-11-22 13:51 Wenwei Tao
2015-11-22 14:05 ` Wenwei Tao
2015-11-22 18:34 ` Matias
0 siblings, 2 replies; 4+ messages in thread
From: Wenwei Tao @ 2015-11-22 13:51 UTC (permalink / raw)
To: mb; +Cc: linux-kernel
In the original calculation, the relationships among
block, plane and lun was confusing, refine it on the
basis of Open-channelSSDInterfaceSpecification.
Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
---
drivers/lightnvm/core.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index f659e60..1864b94 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -174,8 +174,8 @@ static int nvm_core_init(struct nvm_dev *dev)
dev->nr_chnls = grp->num_ch;
dev->luns_per_chnl = grp->num_lun;
dev->pgs_per_blk = grp->num_pg;
- dev->blks_per_lun = grp->num_blk;
dev->nr_planes = grp->num_pln;
+ dev->blks_per_lun = grp->num_blk * grp->num_pln;
dev->sec_size = grp->csecs;
dev->oob_size = grp->sos;
dev->sec_per_pg = grp->fpg_sz / grp->csecs;
@@ -191,13 +191,12 @@ static int nvm_core_init(struct nvm_dev *dev)
dev->plane_mode = NVM_PLANE_QUAD;
/* calculated values */
- dev->sec_per_pl = dev->sec_per_pg * dev->nr_planes;
- dev->sec_per_blk = dev->sec_per_pl * dev->pgs_per_blk;
+ dev->sec_per_blk = dev->sec_per_pg * dev->pgs_per_blk;
+ dev->sec_per_pl = dev->sec_per_blk * grp->num_blk;
dev->sec_per_lun = dev->sec_per_blk * dev->blks_per_lun;
dev->nr_luns = dev->luns_per_chnl * dev->nr_chnls;
- dev->total_blocks = dev->nr_planes *
- dev->blks_per_lun *
+ dev->total_blocks = dev->blks_per_lun *
dev->luns_per_chnl *
dev->nr_chnls;
dev->total_pages = dev->total_blocks * dev->pgs_per_blk;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lightnvm: calculate device values correctly
2015-11-22 13:51 [PATCH] lightnvm: calculate device values correctly Wenwei Tao
@ 2015-11-22 14:05 ` Wenwei Tao
2015-11-22 18:34 ` Matias
1 sibling, 0 replies; 4+ messages in thread
From: Wenwei Tao @ 2015-11-22 14:05 UTC (permalink / raw)
To: mb; +Cc: linux-kernel
I'm a new guy to flash, if I'm wrong about this patch, please correct me.
Thanks.
2015-11-22 21:51 GMT+08:00 Wenwei Tao <ww.tao0320@gmail.com>:
> In the original calculation, the relationships among
> block, plane and lun was confusing, refine it on the
> basis of Open-channelSSDInterfaceSpecification.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
> drivers/lightnvm/core.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index f659e60..1864b94 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -174,8 +174,8 @@ static int nvm_core_init(struct nvm_dev *dev)
> dev->nr_chnls = grp->num_ch;
> dev->luns_per_chnl = grp->num_lun;
> dev->pgs_per_blk = grp->num_pg;
> - dev->blks_per_lun = grp->num_blk;
> dev->nr_planes = grp->num_pln;
> + dev->blks_per_lun = grp->num_blk * grp->num_pln;
> dev->sec_size = grp->csecs;
> dev->oob_size = grp->sos;
> dev->sec_per_pg = grp->fpg_sz / grp->csecs;
> @@ -191,13 +191,12 @@ static int nvm_core_init(struct nvm_dev *dev)
> dev->plane_mode = NVM_PLANE_QUAD;
>
> /* calculated values */
> - dev->sec_per_pl = dev->sec_per_pg * dev->nr_planes;
> - dev->sec_per_blk = dev->sec_per_pl * dev->pgs_per_blk;
> + dev->sec_per_blk = dev->sec_per_pg * dev->pgs_per_blk;
> + dev->sec_per_pl = dev->sec_per_blk * grp->num_blk;
> dev->sec_per_lun = dev->sec_per_blk * dev->blks_per_lun;
> dev->nr_luns = dev->luns_per_chnl * dev->nr_chnls;
>
> - dev->total_blocks = dev->nr_planes *
> - dev->blks_per_lun *
> + dev->total_blocks = dev->blks_per_lun *
> dev->luns_per_chnl *
> dev->nr_chnls;
> dev->total_pages = dev->total_blocks * dev->pgs_per_blk;
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lightnvm: calculate device values correctly
2015-11-22 13:51 [PATCH] lightnvm: calculate device values correctly Wenwei Tao
2015-11-22 14:05 ` Wenwei Tao
@ 2015-11-22 18:34 ` Matias
2015-11-23 2:26 ` Wenwei Tao
1 sibling, 1 reply; 4+ messages in thread
From: Matias @ 2015-11-22 18:34 UTC (permalink / raw)
To: Wenwei Tao; +Cc: linux-kernel, linux-block
On 11/22/2015 02:51 PM, Wenwei Tao wrote:
> In the original calculation, the relationships among
> block, plane and lun was confusing, refine it on the
> basis of Open-channelSSDInterfaceSpecification.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
> drivers/lightnvm/core.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index f659e60..1864b94 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -174,8 +174,8 @@ static int nvm_core_init(struct nvm_dev *dev)
> dev->nr_chnls = grp->num_ch;
> dev->luns_per_chnl = grp->num_lun;
> dev->pgs_per_blk = grp->num_pg;
> - dev->blks_per_lun = grp->num_blk;
> dev->nr_planes = grp->num_pln;
> + dev->blks_per_lun = grp->num_blk * grp->num_pln;
> dev->sec_size = grp->csecs;
> dev->oob_size = grp->sos;
> dev->sec_per_pg = grp->fpg_sz / grp->csecs;
> @@ -191,13 +191,12 @@ static int nvm_core_init(struct nvm_dev *dev)
> dev->plane_mode = NVM_PLANE_QUAD;
>
> /* calculated values */
> - dev->sec_per_pl = dev->sec_per_pg * dev->nr_planes;
> - dev->sec_per_blk = dev->sec_per_pl * dev->pgs_per_blk;
> + dev->sec_per_blk = dev->sec_per_pg * dev->pgs_per_blk;
> + dev->sec_per_pl = dev->sec_per_blk * grp->num_blk;
> dev->sec_per_lun = dev->sec_per_blk * dev->blks_per_lun;
> dev->nr_luns = dev->luns_per_chnl * dev->nr_chnls;
>
> - dev->total_blocks = dev->nr_planes *
> - dev->blks_per_lun *
> + dev->total_blocks = dev->blks_per_lun *
> dev->luns_per_chnl *
> dev->nr_chnls;
> dev->total_pages = dev->total_blocks * dev->pgs_per_blk;
>
The reason I had it as before, was because I wanted to drive the device
in either single/double/quad read/write/erase plane mode. That way we
could get away with only managing 1/4 or 1/2 of the block metadata.
What is your use case? It could make sense, but it will require a little
more work to build up the framework for having the various modes. i.e.
detect supported plane mode, make a explicit decision about which plane
mode to always use (or dynamically) and afterwards allocate the
appropriate data structures.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lightnvm: calculate device values correctly
2015-11-22 18:34 ` Matias
@ 2015-11-23 2:26 ` Wenwei Tao
0 siblings, 0 replies; 4+ messages in thread
From: Wenwei Tao @ 2015-11-23 2:26 UTC (permalink / raw)
To: Matias; +Cc: linux-kernel, linux-block
OK, I see. Thanks for the explanation.
2015-11-23 2:34 GMT+08:00 Matias <mb@lightnvm.io>:
> On 11/22/2015 02:51 PM, Wenwei Tao wrote:
>>
>> In the original calculation, the relationships among
>> block, plane and lun was confusing, refine it on the
>> basis of Open-channelSSDInterfaceSpecification.
>>
>> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
>> ---
>> drivers/lightnvm/core.c | 9 ++++-----
>> 1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
>> index f659e60..1864b94 100644
>> --- a/drivers/lightnvm/core.c
>> +++ b/drivers/lightnvm/core.c
>> @@ -174,8 +174,8 @@ static int nvm_core_init(struct nvm_dev *dev)
>> dev->nr_chnls = grp->num_ch;
>> dev->luns_per_chnl = grp->num_lun;
>> dev->pgs_per_blk = grp->num_pg;
>> - dev->blks_per_lun = grp->num_blk;
>> dev->nr_planes = grp->num_pln;
>> + dev->blks_per_lun = grp->num_blk * grp->num_pln;
>> dev->sec_size = grp->csecs;
>> dev->oob_size = grp->sos;
>> dev->sec_per_pg = grp->fpg_sz / grp->csecs;
>> @@ -191,13 +191,12 @@ static int nvm_core_init(struct nvm_dev *dev)
>> dev->plane_mode = NVM_PLANE_QUAD;
>>
>> /* calculated values */
>> - dev->sec_per_pl = dev->sec_per_pg * dev->nr_planes;
>> - dev->sec_per_blk = dev->sec_per_pl * dev->pgs_per_blk;
>> + dev->sec_per_blk = dev->sec_per_pg * dev->pgs_per_blk;
>> + dev->sec_per_pl = dev->sec_per_blk * grp->num_blk;
>> dev->sec_per_lun = dev->sec_per_blk * dev->blks_per_lun;
>> dev->nr_luns = dev->luns_per_chnl * dev->nr_chnls;
>>
>> - dev->total_blocks = dev->nr_planes *
>> - dev->blks_per_lun *
>> + dev->total_blocks = dev->blks_per_lun *
>> dev->luns_per_chnl *
>> dev->nr_chnls;
>> dev->total_pages = dev->total_blocks * dev->pgs_per_blk;
>>
>
> The reason I had it as before, was because I wanted to drive the device in
> either single/double/quad read/write/erase plane mode. That way we could get
> away with only managing 1/4 or 1/2 of the block metadata.
>
> What is your use case? It could make sense, but it will require a little
> more work to build up the framework for having the various modes. i.e.
> detect supported plane mode, make a explicit decision about which plane mode
> to always use (or dynamically) and afterwards allocate the appropriate data
> structures.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-23 2:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-22 13:51 [PATCH] lightnvm: calculate device values correctly Wenwei Tao
2015-11-22 14:05 ` Wenwei Tao
2015-11-22 18:34 ` Matias
2015-11-23 2:26 ` Wenwei Tao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox