[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240306102846.1020868-4-lizhijian@fujitsu.com>
Date: Wed, 6 Mar 2024 18:28:42 +0800
From: Li Zhijian <lizhijian@...itsu.com>
To: linux-kernel@...r.kernel.org
Cc: y-goto@...itsu.com,
Alison Schofield <alison.schofield@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Baoquan He <bhe@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Dave Jiang <dave.jiang@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
hpa@...or.com,
Ingo Molnar <mingo@...hat.com>,
Ira Weiny <ira.weiny@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vishal Verma <vishal.l.verma@...el.com>,
linux-cxl@...r.kernel.org,
linux-mm@...ck.org,
nvdimm@...ts.linux.dev,
x86@...nel.org,
kexec@...ts.infradead.org,
Li Zhijian <lizhijian@...itsu.com>
Subject: [PATCH v3 3/7] nvdimm: pmem: assign a parent resource for vmemmap region for the fsdax
When the pmem is configured as fsdax, set the vmemmap region as a child
of the namespace region so that it can be registered as a separate
resource later.
CC: Dan Williams <dan.j.williams@...el.com>
CC: Vishal Verma <vishal.l.verma@...el.com>
CC: Dave Jiang <dave.jiang@...el.com>
CC: Ira Weiny <ira.weiny@...el.com>
CC: Baoquan He <bhe@...hat.com>
CC: nvdimm@...ts.linux.dev
Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
---
drivers/nvdimm/pmem.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 4e8fdcb3f1c8..b2640a3fb693 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -452,7 +452,7 @@ static int pmem_attach_disk(struct device *dev,
struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
struct nd_region *nd_region = to_nd_region(dev->parent);
int nid = dev_to_node(dev), fua;
- struct resource *res = &nsio->res;
+ struct resource *res = &nsio->res, *parent;
struct range bb_range;
struct nd_pfn *nd_pfn = NULL;
struct dax_device *dax_dev;
@@ -491,12 +491,15 @@ static int pmem_attach_disk(struct device *dev,
fua = 0;
}
- if (!devm_request_mem_region(dev, res->start, resource_size(res),
- dev_name(&ndns->dev))) {
+ parent = devm_request_mem_region(dev, res->start, resource_size(res),
+ dev_name(&ndns->dev));
+ if (!res) {
dev_warn(dev, "could not reserve region %pR\n", res);
return -EBUSY;
}
+ pgmap_parent_resource(&pmem->pgmap, parent);
+
disk = blk_alloc_disk(nid);
if (!disk)
return -ENOMEM;
--
2.29.2
Powered by blists - more mailing lists