Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp585231imm; Wed, 29 Aug 2018 07:17:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaFx4FYk+cSGu0obkIf2V3bsiG3hsEkODgyE3tA/NYoKOOLj2mY9RaDbGnQ8+NBaLM143Ru X-Received: by 2002:a62:f0d:: with SMTP id x13-v6mr6204047pfi.221.1535552271812; Wed, 29 Aug 2018 07:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535552271; cv=none; d=google.com; s=arc-20160816; b=Yz3NXVW1FGUc/yMcCsGxD89jeXILL1eqIaObkXOjZyoDCaIwOGAOYpXKsDbl0xdL/1 qitpI01vjJutz8i3SbpgxbC8jY8TZkQ6xkenT1wSHCbUIux/xPEk1sNf3Xl/5ptkcCVS 3S8/o+4+ZU18bG8yD7hUUkTaqjP5S4bSxJgkYJlVR31Wal8yCeogUjMPICgMSwRYPvvv krYPUuDRWhLcx+MhBCGR0jZpnSmUnSJFmGjVJqiImNGNOFJJeK5HN3jK3wCzeIvFfixU Seab761Mz+ZkNFLJAJS6ld5xwA8hyy1lPgGafcVsfCVMU6tY61Ie2TkF61wlkEO1R2Jj rWEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=l2woWWn9mTd09WCed6KZ4JHOMWuOe3bmM0XJNKOmEgY=; b=R++hQdTlSM6Us+SvJVVlA+3MB7dk8G78TNdK/JPVEE8F9MWM1uOIVK+XvJIgMDJ3QJ aGrzYn8k851SRuV8hS6KukjbKqDf9isMC5KQZ4yFElOkB5CiNLz43+xt7qsngTh3ESrK DIlCMRwZzMGl2GhJi3V08ZYF/rcDmuenYmVaKeKlADEKmeBUw8+6gCHEoBj67Op51hJX G1PXJh3Mcq80WrPvRIR0m/2BuWICG/SXSquhPOsC9K8gOPgQD5E5MggT+BSmdanCTYEj r+khqNJIM4AePTR6Lh/A3jbQdXSG8uEqa0VrtnM8hWGsdH69NCstH40rD2mCCEVcOHIA 8yjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=ui7cU7vR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13-v6si3835767pgg.346.2018.08.29.07.17.36; Wed, 29 Aug 2018 07:17:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=ui7cU7vR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728555AbeH2SNf (ORCPT + 99 others); Wed, 29 Aug 2018 14:13:35 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38480 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727444AbeH2SNf (ORCPT ); Wed, 29 Aug 2018 14:13:35 -0400 Received: by mail-pf1-f194.google.com with SMTP id x17-v6so2343237pfh.5 for ; Wed, 29 Aug 2018 07:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l2woWWn9mTd09WCed6KZ4JHOMWuOe3bmM0XJNKOmEgY=; b=ui7cU7vRU6b1dEaFELXOFLWW5lnaFBXCH0/d3ncZ+g9KzPx36k48ieQV8bwZbopf8k bKbAxXE/VElEqk2U1FGln+TUmWXXCTBpbimHWIzgm4ZgCEfgZ82eRbW/f5S3hlUhBDPZ +x8gw+dTcJU7s0oqHG7VtQU7Ju1sfZLcWP2m/wJnYVjGkXJ4UDuDDe13OsFS0CKsR4mX g/Ztqjr96BPAcUCT0xXZe8WfEELjlFWJZOO4P7x2x7uXp7CpGYY8DcaOJYe+JzqLrgJ9 YNIfRu92gqkQIVlD5hS6He4YPS1diRGRkGdJLIHlvWiir5WLbxoanrTfuqgExw74MD2J nBbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l2woWWn9mTd09WCed6KZ4JHOMWuOe3bmM0XJNKOmEgY=; b=AHHOCLWZ88DH+reOfUv5YBp2wAV/6znyVDKwZSmDHU4lgSOTztvLlKZCwSMBPakUC6 bMeIoeDddZAlr81OWZdzimurVIxjZQtn1mS6Q88IwyitDsF6zHupHtVcNBdgrXKCycKv cA/F5k7CsVk9oB/Nj6NU8aJVsE1C87Fibgn6pbK34OC5S5cHu7rCAqm0pl8LBYOVst7o FK0DUdDYsDZKvySwMBlE9IRDHHNrVnXyXCS9SCJnqmxTGUWymqbgRH4ho4EGWctyKhU3 BHQ0nijCwk1Y+N0WMpgQo2uhThGmyCEc17X3ISvf9sNobjYeIRXPKpanTFfcEOpFvRFG k4EA== X-Gm-Message-State: APzg51C3KfKNSMPBsckxXOoydXp1oawPg7O88VhbH5Pdul8FMDcNTM+x AV13btuvOJYFlw8PZgaxFVchyiMjNtIPWg== X-Received: by 2002:a62:63c2:: with SMTP id x185-v6mr6202724pfb.13.1535552185254; Wed, 29 Aug 2018 07:16:25 -0700 (PDT) Received: from [10.86.62.45] (rap-us.hgst.com. [199.255.44.250]) by smtp.googlemail.com with ESMTPSA id o62-v6sm5697753pfb.0.2018.08.29.07.16.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Aug 2018 07:16:24 -0700 (PDT) Subject: Re: [V2 PATCH] lightnvm: pblk: add helpers for chunk addresses To: javier@javigon.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com References: <1535548379-11125-1-git-send-email-javier@cnexlabs.com> From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Wed, 29 Aug 2018 16:16:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1535548379-11125-1-git-send-email-javier@cnexlabs.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/29/2018 03:12 PM, Javier González wrote: > # Changes since V1: > - Move 1.2 / 2.0 specific code to core (form Matias) > > Implement helpers to go from ppas to a chunk within a line and an > address within a chunk. > > These helpers will be used on the patches adding trace support in pblk, > which will be sent in this window. > > Signed-off-by: Javier González > --- > drivers/lightnvm/pblk.h | 19 +++++++++++++++++++ > include/linux/lightnvm.h | 19 +++++++++++++++++++ > 2 files changed, 38 insertions(+) > > diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h > index be67bbfa3d0a..f95fe75fef6e 100644 > --- a/drivers/lightnvm/pblk.h > +++ b/drivers/lightnvm/pblk.h > @@ -1034,6 +1034,25 @@ static inline struct ppa_addr addr_to_gen_ppa(struct pblk *pblk, u64 paddr, > return ppa; > } > > +static inline struct nvm_chk_meta *pblk_dev_ppa_to_chunk(struct pblk *pblk, > + struct ppa_addr p) > +{ > + struct nvm_tgt_dev *dev = pblk->dev; > + struct nvm_geo *geo = &dev->geo; > + struct pblk_line *line = &pblk->lines[pblk_ppa_to_line(p)]; > + int pos = pblk_ppa_to_pos(geo, p); > + > + return &line->chks[pos]; > +} > + > +static inline u64 pblk_dev_ppa_to_chunk_addr(struct pblk *pblk, > + struct ppa_addr p) > +{ > + struct nvm_tgt_dev *dev = pblk->dev; > + > + return dev_to_chunk_addr(dev->parent, &pblk->addrf, p); > +} > + > static inline u64 pblk_dev_ppa_to_line_addr(struct pblk *pblk, > struct ppa_addr p) > { > diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h > index 0106984400bc..77743a02ec0d 100644 > --- a/include/linux/lightnvm.h > +++ b/include/linux/lightnvm.h > @@ -487,6 +487,25 @@ static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev, > return l; > } > > +static inline u64 dev_to_chunk_addr(struct nvm_dev *dev, void *addrf, > + struct ppa_addr p) > +{ > + struct nvm_geo *geo = &dev->geo; > + u64 caddr; > + > + if (geo->version == NVM_OCSSD_SPEC_12) { > + struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)addrf; > + > + caddr = (u64)p.g.pg << ppaf->pg_offset; > + caddr |= (u64)p.g.pl << ppaf->pln_offset; > + caddr |= (u64)p.g.sec << ppaf->sec_offset; > + } else { > + caddr = p.m.sec; > + } > + > + return caddr; > +} > + > typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *); > typedef sector_t (nvm_tgt_capacity_fn)(void *); > typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *, > Thanks. Applied for 4.20.