Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756546AbcCaJLd (ORCPT ); Thu, 31 Mar 2016 05:11:33 -0400 Received: from mail-qg0-f54.google.com ([209.85.192.54]:35621 "EHLO mail-qg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755781AbcCaJL3 (ORCPT ); Thu, 31 Mar 2016 05:11:29 -0400 Subject: Re: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update To: Wenwei Tao References: <1459348115-6072-1-git-send-email-ww.tao0320@gmail.com> <1459348115-6072-2-git-send-email-ww.tao0320@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: <56FCE9BE.20309@lightnvm.io> Date: Thu, 31 Mar 2016 11:11:26 +0200 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: <1459348115-6072-2-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: 1377 Lines: 40 On 03/30/2016 04:28 PM, Wenwei Tao wrote: > Since every target now has their own logical address area, > we should deal trans_map and rev_trans_map with relative > logical address instead of the global one. > > Signed-off-by: Wenwei Tao > --- > drivers/lightnvm/rrpc.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c > index 516a045..2279bd7 100644 > --- a/drivers/lightnvm/rrpc.c > +++ b/drivers/lightnvm/rrpc.c > @@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 *entries, void *private) > { > struct rrpc *rrpc = (struct rrpc *)private; > struct nvm_dev *dev = rrpc->dev; > - struct rrpc_addr *addr = rrpc->trans_map + slba; > - struct rrpc_rev_addr *raddr = rrpc->rev_trans_map; > - u64 elba = slba + nlb; > - u64 i; > + struct rrpc_addr *addr; > + struct rrpc_rev_addr *raddr; > + u64 elba, i; > + > + slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9); > + addr = rrpc->trans_map + slba; > + raddr = rrpc->rev_trans_map; > + elba = slba + nlb; > > if (unlikely(elba > dev->total_secs)) { > pr_err("nvm: L2P data from device is out of bounds!\n"); > Hi Wenwei, How about storing the value of "rrpc->soffset >> (ilog2(dev->sec_size) - 9)" in rrpc->soffset. That let us only do the shifting for get/put area calls.