From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757048AbcEEJy1 (ORCPT ); Thu, 5 May 2016 05:54:27 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:34899 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756467AbcEEJy0 (ORCPT ); Thu, 5 May 2016 05:54:26 -0400 Subject: Re: [PATCH 4/4] lightnvm: Precalculate max/min sectors per req. To: =?UTF-8?Q?Javier_Gonz=c3=a1lez?= References: <1462375892-26533-1-git-send-email-javier@cnexlabs.com> <1462375892-26533-4-git-send-email-javier@cnexlabs.com> Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, =?UTF-8?Q?Javier_Gonz=c3=a1lez?= From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: <572B184F.3080602@lightnvm.io> Date: Thu, 5 May 2016 11:54:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1462375892-26533-4-git-send-email-javier@cnexlabs.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/04/2016 05:31 PM, Javier González wrote: > 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 > --- > 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 */ > I think this is best kept within pblk for now. The min_sec_w_rq is not enough to describe the pages to be written. It must also follow a specific order, which is not communicated only with minimum page writes.