libnvdimm, pmem, pfn: make pmem_rw_bytes generic and refactor pfn setup
In preparation for providing an alternative (to block device) access mechanism to persistent memory, convert pmem_rw_bytes() to nsio_rw_bytes(). This allows ->rw_bytes() functionality without requiring a 'struct pmem_device' to be instantiated. In other words, when ->rw_bytes() is in use i/o is driven through 'struct nd_namespace_io', otherwise it is driven through 'struct pmem_device' and the block layer. This consolidates the disjoint calls to devm_exit_badblocks() and devm_memunmap() into a common devm_nsio_disable() and cleans up the init path to use a unified pmem_attach_disk() implementation. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -7,6 +7,7 @@ ldflags-y += --wrap=ioremap_nocache
|
||||
ldflags-y += --wrap=iounmap
|
||||
ldflags-y += --wrap=memunmap
|
||||
ldflags-y += --wrap=__devm_request_region
|
||||
ldflags-y += --wrap=__devm_release_region
|
||||
ldflags-y += --wrap=__request_region
|
||||
ldflags-y += --wrap=__release_region
|
||||
ldflags-y += --wrap=devm_memremap_pages
|
||||
|
@@ -239,13 +239,11 @@ struct resource *__wrap___devm_request_region(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL(__wrap___devm_request_region);
|
||||
|
||||
void __wrap___release_region(struct resource *parent, resource_size_t start,
|
||||
resource_size_t n)
|
||||
static bool nfit_test_release_region(struct resource *parent,
|
||||
resource_size_t start, resource_size_t n)
|
||||
{
|
||||
struct nfit_test_resource *nfit_res;
|
||||
|
||||
if (parent == &iomem_resource) {
|
||||
nfit_res = get_nfit_res(start);
|
||||
struct nfit_test_resource *nfit_res = get_nfit_res(start);
|
||||
if (nfit_res) {
|
||||
struct resource *res = nfit_res->res + 1;
|
||||
|
||||
@@ -254,11 +252,26 @@ void __wrap___release_region(struct resource *parent, resource_size_t start,
|
||||
__func__, start, n, res);
|
||||
else
|
||||
memset(res, 0, sizeof(*res));
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
__release_region(parent, start, n);
|
||||
return false;
|
||||
}
|
||||
|
||||
void __wrap___release_region(struct resource *parent, resource_size_t start,
|
||||
resource_size_t n)
|
||||
{
|
||||
if (!nfit_test_release_region(parent, start, n))
|
||||
__release_region(parent, start, n);
|
||||
}
|
||||
EXPORT_SYMBOL(__wrap___release_region);
|
||||
|
||||
void __wrap___devm_release_region(struct device *dev, struct resource *parent,
|
||||
resource_size_t start, resource_size_t n)
|
||||
{
|
||||
if (!nfit_test_release_region(parent, start, n))
|
||||
__devm_release_region(dev, parent, start, n);
|
||||
}
|
||||
EXPORT_SYMBOL(__wrap___devm_release_region);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
Reference in New Issue
Block a user