Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752167AbbKVSeK (ORCPT ); Sun, 22 Nov 2015 13:34:10 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:35975 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751978AbbKVSeH (ORCPT ); Sun, 22 Nov 2015 13:34:07 -0500 Message-ID: <56520A9C.2030502@lightnvm.io> Date: Sun, 22 Nov 2015 19:34:04 +0100 From: Matias User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Wenwei Tao CC: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [PATCH] lightnvm: calculate device values correctly References: <1448200278-10272-1-git-send-email-ww.tao0320@gmail.com> In-Reply-To: <1448200278-10272-1-git-send-email-ww.tao0320@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2427 Lines: 57 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 > --- > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/