From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967055AbcA0Tqe (ORCPT ); Wed, 27 Jan 2016 14:46:34 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:33741 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965107AbcA0Tqa (ORCPT ); Wed, 27 Jan 2016 14:46:30 -0500 Subject: Re: [PATCH v2 1/2] lightnvm: specify target's logical address area To: Wenwei Tao References: <1453811633-3721-1-git-send-email-ww.tao0320@gmail.com> <56A7882A.50108@lightnvm.io> <56A85B20.4030809@lightnvm.io> <56A88FB9.4020106@lightnvm.io> <56A8C586.7070805@lightnvm.io> Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: <56A91E92.6000409@lightnvm.io> Date: Wed, 27 Jan 2016 20:46:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/27/2016 03:58 PM, Wenwei Tao wrote: > static int nvm_core_init(struct nvm_dev *dev) > { > > ... > dev->sec_per_pg = grp->fpg_sz / grp->csecs; > ... > /* 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_lun = dev->sec_per_blk * dev->blks_per_lun; > ... > > } > > static int rrpc_luns_init(struct rrpc *rrpc, int lun_begin, int lun_end) > { > ... > for (i = 0; i < rrpc->nr_luns; i++) { > ... > rrpc->nr_pages += dev->sec_per_lun; > ... > } > ... > } > > I prefer rrpc->nr_pages to be the number of pages allocated to rrpc, > but the code above indeed make me confuse about the sec and page > thing. > Hope I'm not misunderstand the code. > ps: I'm not an expert on flash, if the confusion is caused by lack of > knowledge about flash, pleas let me know. rrpc->nr_pages should properly be rrpc->nr_sects, as it is indeed confusing that it is called a page, when we actually use it for number of sectors. Pages refers to 4-64KB units, of which we have 1-16 sectors inside. I have pushed an update to for-next that renames rrpc->nr_pages to rrpc->nr_sects. That should hopefully help future readers. I also updated dev->total_pages to total_secs. Thanks