From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D454E332919; Wed, 25 Mar 2026 11:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774439749; cv=none; b=KxonWw+RITRpK8uQ57yxtoM4UOHCasxkGff4NSKuY1LN9uwdOTrEQNftac4rfVQb/7n5mw/ELgB1Ty1P4iGrOhhGc85Znn2DcE9WckEe0bdOstEUE5tV4gwEdLo//SmSxr49fMc6Y0O8EX3AZwRX7VmU3bU+g4M20dhBFIcVRn8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774439749; c=relaxed/simple; bh=ys6PuOWdFe0qxokKIbVNj5WZJc8jhMK2HslSsFknON8=; h=Date:From:To:CC:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OQe3DvG6bMp+/Xc0XjoPQvmV2AxUpo6OGqViwux/bjZD9PTLuTWz71jGLjnOE47BORfPkJrp3z8ilm3+rQVm8FAwjUegKtJN6yBMY43Aj6oyqET0QkuNQjr/91JUR2nVs2CgMQ+4xU/sXC/H72pdXAaCRK2OxESAHMjzNg/drUg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4fglhW5P1vzHnGfQ; Wed, 25 Mar 2026 19:55:07 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id 07E6F40587; Wed, 25 Mar 2026 19:55:43 +0800 (CST) Received: from localhost (10.203.177.15) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 25 Mar 2026 11:55:41 +0000 Date: Wed, 25 Mar 2026 11:55:40 +0000 From: Jonathan Cameron To: Ira Weiny CC: John Groves , John Groves , "Miklos Szeredi" , Dan Williams , "Bernd Schubert" , Alison Schofield , John Groves , "Jonathan Corbet" , Shuah Khan , "Vishal Verma" , Dave Jiang , Matthew Wilcox , Jan Kara , "Alexander Viro" , David Hildenbrand , Christian Brauner , "Darrick J . Wong" , Randy Dunlap , Jeff Layton , Amir Goldstein , Stefan Hajnoczi , Joanne Koong , Josef Bacik , Bagas Sanjaya , Chen Linxuan , James Morse , Fuad Tabba , Sean Christopherson , Shivank Garg , Ackerley Tng , Gregory Price , Aravind Ramesh , Ajay Joshi , "venkataravis@micron.com" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "nvdimm@lists.linux.dev" , "linux-cxl@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" Subject: Re: [PATCH V9 1/8] dax: move dax_pgoff_to_phys from [drivers/dax/] device.c to bus.c Message-ID: <20260325115540.000047f2@huawei.com> In-Reply-To: <69c321d5e7195_e9d8d10040@iweiny-mobl.notmuch> References: <0100019d1d463523-617e8165-a084-4d91-aa5e-13778264d5d4-000000@email.amazonses.com> <20260324003743.4973-1-john@jagalactic.com> <0100019d1d46d094-cc0a4b79-3bd2-43e8-a08d-ab8cd21266a6-000000@email.amazonses.com> <20260324141806.000003f7@huawei.com> <69c321d5e7195_e9d8d10040@iweiny-mobl.notmuch> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml500010.china.huawei.com (7.191.174.240) To dubpeml500005.china.huawei.com (7.214.145.207) On Tue, 24 Mar 2026 18:44:21 -0500 Ira Weiny wrote: > Jonathan Cameron wrote: > > On Tue, 24 Mar 2026 00:37:53 +0000 > > John Groves wrote: > > > > > From: John Groves > > > > > > This function will be used by both device.c and fsdev.c, but both are > > > loadable modules. Moving to bus.c puts it in core and makes it available > > > to both. > > > > > > No code changes - just relocated. > > > > > > Reviewed-by: Ira Weiny > > > Reviewed-by: Dave Jiang > > > Signed-off-by: John Groves > > Obviously this is a straight forward code move... But I can't resist > > commenting on what is moving (feel free to ignore! or maybe a follow > > up patch if you agree. > > > > Reviewed-by: Jonathan Cameron > > Added this to the series. LMK if I missed something. LGTM. Reviewed-by: Jonathan Cameron (don't bother adding it unless you are touching the tree for some other reason!) > > Ira > > --- > commit ccc1878ab00178e82108bdd1ece497388a24290b (HEAD -> nvdimm-famfs-dax) > Author: Ira Weiny > Date: Tue Mar 24 12:36:19 2026 -0500 > > dax: Modernize dax_pgoff_to_phys() > > The patch to move dax_pgoff_to_phys() to bus.c revealed that the > function could be improved with more modern style and the newer > in_range() utility function. > > Update it while we are moving it around. > > Link: https://lore.kernel.org/all/20260324141806.000003f7@huawei.com/ > Suggested-by: Jonathan Cameron > Signed-off-by: Ira Weiny > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index e4bd5c9f006c..1b412264bb36 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -1421,16 +1421,12 @@ static const struct device_type dev_dax_type = { > __weak phys_addr_t dax_pgoff_to_phys(struct dev_dax *dev_dax, pgoff_t pgoff, > unsigned long size) > { > - int i; > - > - for (i = 0; i < dev_dax->nr_range; i++) { > + for (int i = 0; i < dev_dax->nr_range; i++) { > struct dev_dax_range *dax_range = &dev_dax->ranges[i]; > struct range *range = &dax_range->range; > - unsigned long long pgoff_end; > phys_addr_t phys; > > - pgoff_end = dax_range->pgoff + PHYS_PFN(range_len(range)) - 1; > - if (pgoff < dax_range->pgoff || pgoff > pgoff_end) > + if (!in_range(pgoff, dax_range->pgoff, PHYS_PFN(range_len(range)))) > continue; > phys = PFN_PHYS(pgoff - dax_range->pgoff) + range->start; > if (phys + size - 1 <= range->end) >