Skip to content

Commit 3acbdbf

Browse files
committed
Merge tag 'libnvdimm-for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull dax and libnvdimm updates from Dan Williams: "The bulk of this is a rework of the dax_operations API after discovering the obstacles it posed to the work-in-progress DAX+reflink support for XFS and other copy-on-write filesystem mechanics. Primarily the need to plumb a block_device through the API to handle partition offsets was a sticking point and Christoph untangled that dependency in addition to other cleanups to make landing the DAX+reflink support easier. The DAX_PMEM_COMPAT option has been around for 4 years and not only are distributions shipping userspace that understand the current configuration API, but some are not even bothering to turn this option on anymore, so it seems a good time to remove it per the deprecation schedule. Recall that this was added after the device-dax subsystem moved from /sys/class/dax to /sys/bus/dax for its sysfs organization. All recent functionality depends on /sys/bus/dax. Some other miscellaneous cleanups and reflink prep patches are included as well. Summary: - Simplify the dax_operations API: - Eliminate bdev_dax_pgoff() in favor of the filesystem maintaining and applying a partition offset to all its DAX iomap operations. - Remove wrappers and device-mapper stacked callbacks for ->copy_from_iter() and ->copy_to_iter() in favor of moving block_device relative offset responsibility to the dax_direct_access() caller. - Remove the need for an @bdev in filesystem-DAX infrastructure - Remove unused uio helpers copy_from_iter_flushcache() and copy_mc_to_iter() as only the non-check_copy_size() versions are used for DAX. - Prepare XFS for the pending (next merge window) DAX+reflink support - Remove deprecated DEV_DAX_PMEM_COMPAT support - Cleanup a straggling misuse of the GUID api" * tag 'libnvdimm-for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (38 commits) iomap: Fix error handling in iomap_zero_iter() ACPI: NFIT: Import GUID before use dax: remove the copy_from_iter and copy_to_iter methods dax: remove the DAXDEV_F_SYNC flag dax: simplify dax_synchronous and set_dax_synchronous uio: remove copy_from_iter_flushcache() and copy_mc_to_iter() iomap: turn the byte variable in iomap_zero_iter into a ssize_t memremap: remove support for external pgmap refcounts fsdax: don't require CONFIG_BLOCK iomap: build the block based code conditionally dax: fix up some of the block device related ifdefs fsdax: shift partition offset handling into the file systems dax: return the partition offset from fs_dax_get_by_bdev iomap: add a IOMAP_DAX flag xfs: pass the mapping flags to xfs_bmbt_to_iomap xfs: use xfs_direct_write_iomap_ops for DAX zeroing xfs: move dax device handling into xfs_{alloc,free}_buftarg ext4: cleanup the dax handling in ext4_fill_super ext2: cleanup the dax handling in ext2_fill_super fsdax: decouple zeroing from the iomap buffered I/O code ...
2 parents 8834147 + 9e05e95 commit 3acbdbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+554
-1173
lines changed

Documentation/ABI/obsolete/sysfs-class-dax

Lines changed: 0 additions & 22 deletions
This file was deleted.

drivers/acpi/nfit/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,12 @@ static const char *spa_type_name(u16 type)
678678

679679
int nfit_spa_type(struct acpi_nfit_system_address *spa)
680680
{
681+
guid_t guid;
681682
int i;
682683

684+
import_guid(&guid, spa->range_guid);
683685
for (i = 0; i < NFIT_UUID_MAX; i++)
684-
if (guid_equal(to_nfit_uuid(i), (guid_t *)&spa->range_guid))
686+
if (guid_equal(to_nfit_uuid(i), &guid))
685687
return i;
686688
return -1;
687689
}

drivers/dax/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
config DAX_DRIVER
3-
select DAX
4-
bool
5-
62
menuconfig DAX
73
tristate "DAX: direct access to differentiated memory"
84
select SRCU
@@ -70,13 +66,4 @@ config DEV_DAX_KMEM
7066

7167
Say N if unsure.
7268

73-
config DEV_DAX_PMEM_COMPAT
74-
tristate "PMEM DAX: support the deprecated /sys/class/dax interface"
75-
depends on m && DEV_DAX_PMEM=m
76-
default DEV_DAX_PMEM
77-
help
78-
Older versions of the libdaxctl library expect to find all
79-
device-dax instances under /sys/class/dax. If libdaxctl in
80-
your distribution is older than v58 say M, otherwise say N.
81-
8269
endif

drivers/dax/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
obj-$(CONFIG_DAX) += dax.o
33
obj-$(CONFIG_DEV_DAX) += device_dax.o
44
obj-$(CONFIG_DEV_DAX_KMEM) += kmem.o
5+
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
56

67
dax-y := super.o
78
dax-y += bus.o
89
device_dax-y := device.o
10+
dax_pmem-y := pmem.o
911

10-
obj-y += pmem/
1112
obj-y += hmem/

drivers/dax/bus.c

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#include "dax-private.h"
1111
#include "bus.h"
1212

13-
static struct class *dax_class;
14-
1513
static DEFINE_MUTEX(dax_bus_lock);
1614

1715
#define DAX_NAME_LEN 30
@@ -1323,14 +1321,17 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)
13231321
}
13241322

13251323
/*
1326-
* No 'host' or dax_operations since there is no access to this
1327-
* device outside of mmap of the resulting character device.
1324+
* No dax_operations since there is no access to this device outside of
1325+
* mmap of the resulting character device.
13281326
*/
1329-
dax_dev = alloc_dax(dev_dax, NULL, NULL, DAXDEV_F_SYNC);
1327+
dax_dev = alloc_dax(dev_dax, NULL);
13301328
if (IS_ERR(dax_dev)) {
13311329
rc = PTR_ERR(dax_dev);
13321330
goto err_alloc_dax;
13331331
}
1332+
set_dax_synchronous(dax_dev);
1333+
set_dax_nocache(dax_dev);
1334+
set_dax_nomc(dax_dev);
13341335

13351336
/* a device_dax instance is dead while the driver is not attached */
13361337
kill_dax(dax_dev);
@@ -1343,10 +1344,7 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)
13431344

13441345
inode = dax_inode(dax_dev);
13451346
dev->devt = inode->i_rdev;
1346-
if (data->subsys == DEV_DAX_BUS)
1347-
dev->bus = &dax_bus_type;
1348-
else
1349-
dev->class = dax_class;
1347+
dev->bus = &dax_bus_type;
13501348
dev->parent = parent;
13511349
dev->type = &dev_dax_type;
13521350

@@ -1445,22 +1443,10 @@ EXPORT_SYMBOL_GPL(dax_driver_unregister);
14451443

14461444
int __init dax_bus_init(void)
14471445
{
1448-
int rc;
1449-
1450-
if (IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)) {
1451-
dax_class = class_create(THIS_MODULE, "dax");
1452-
if (IS_ERR(dax_class))
1453-
return PTR_ERR(dax_class);
1454-
}
1455-
1456-
rc = bus_register(&dax_bus_type);
1457-
if (rc)
1458-
class_destroy(dax_class);
1459-
return rc;
1446+
return bus_register(&dax_bus_type);
14601447
}
14611448

14621449
void __exit dax_bus_exit(void)
14631450
{
14641451
bus_unregister(&dax_bus_type);
1465-
class_destroy(dax_class);
14661452
}

drivers/dax/bus.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,15 @@ struct dax_region *alloc_dax_region(struct device *parent, int region_id,
1616
struct range *range, int target_node, unsigned int align,
1717
unsigned long flags);
1818

19-
enum dev_dax_subsys {
20-
DEV_DAX_BUS = 0, /* zeroed dev_dax_data picks this by default */
21-
DEV_DAX_CLASS,
22-
};
23-
2419
struct dev_dax_data {
2520
struct dax_region *dax_region;
2621
struct dev_pagemap *pgmap;
27-
enum dev_dax_subsys subsys;
2822
resource_size_t size;
2923
int id;
3024
};
3125

3226
struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data);
3327

34-
/* to be deleted when DEV_DAX_CLASS is removed */
35-
struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys);
36-
3728
struct dax_device_driver {
3829
struct device_driver drv;
3930
struct list_head ids;
@@ -49,10 +40,6 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
4940
void dax_driver_unregister(struct dax_device_driver *dax_drv);
5041
void kill_dev_dax(struct dev_dax *dev_dax);
5142

52-
#if IS_ENABLED(CONFIG_DEV_DAX_PMEM_COMPAT)
53-
int dev_dax_probe(struct dev_dax *dev_dax);
54-
#endif
55-
5643
/*
5744
* While run_dax() is potentially a generic operation that could be
5845
* defined in include/linux/dax.h we don't want to grow any users

drivers/dax/device.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,7 @@ int dev_dax_probe(struct dev_dax *dev_dax)
433433
inode = dax_inode(dax_dev);
434434
cdev = inode->i_cdev;
435435
cdev_init(cdev, &dax_fops);
436-
if (dev->class) {
437-
/* for the CONFIG_DEV_DAX_PMEM_COMPAT case */
438-
cdev->owner = dev->parent->driver->owner;
439-
} else
440-
cdev->owner = dev->driver->owner;
436+
cdev->owner = dev->driver->owner;
441437
cdev_set_parent(cdev, &dev->kobj);
442438
rc = cdev_add(cdev, dev->devt, 1);
443439
if (rc)

drivers/dax/pmem/core.c renamed to drivers/dax/pmem.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
#include <linux/memremap.h>
44
#include <linux/module.h>
55
#include <linux/pfn_t.h>
6-
#include "../../nvdimm/pfn.h"
7-
#include "../../nvdimm/nd.h"
8-
#include "../bus.h"
6+
#include "../nvdimm/pfn.h"
7+
#include "../nvdimm/nd.h"
8+
#include "bus.h"
99

10-
struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
10+
static struct dev_dax *__dax_pmem_probe(struct device *dev)
1111
{
1212
struct range range;
1313
int rc, id, region_id;
@@ -63,7 +63,6 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
6363
.dax_region = dax_region,
6464
.id = id,
6565
.pgmap = &pgmap,
66-
.subsys = subsys,
6766
.size = range_len(&range),
6867
};
6968
dev_dax = devm_create_dev_dax(&data);
@@ -73,7 +72,32 @@ struct dev_dax *__dax_pmem_probe(struct device *dev, enum dev_dax_subsys subsys)
7372

7473
return dev_dax;
7574
}
76-
EXPORT_SYMBOL_GPL(__dax_pmem_probe);
75+
76+
static int dax_pmem_probe(struct device *dev)
77+
{
78+
return PTR_ERR_OR_ZERO(__dax_pmem_probe(dev));
79+
}
80+
81+
static struct nd_device_driver dax_pmem_driver = {
82+
.probe = dax_pmem_probe,
83+
.drv = {
84+
.name = "dax_pmem",
85+
},
86+
.type = ND_DRIVER_DAX_PMEM,
87+
};
88+
89+
static int __init dax_pmem_init(void)
90+
{
91+
return nd_driver_register(&dax_pmem_driver);
92+
}
93+
module_init(dax_pmem_init);
94+
95+
static void __exit dax_pmem_exit(void)
96+
{
97+
driver_unregister(&dax_pmem_driver.drv);
98+
}
99+
module_exit(dax_pmem_exit);
77100

78101
MODULE_LICENSE("GPL v2");
79102
MODULE_AUTHOR("Intel Corporation");
103+
MODULE_ALIAS_ND_DEVICE(ND_DEVICE_DAX_PMEM);

drivers/dax/pmem/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem.o
33
obj-$(CONFIG_DEV_DAX_PMEM) += dax_pmem_core.o
4-
obj-$(CONFIG_DEV_DAX_PMEM_COMPAT) += dax_pmem_compat.o
54

65
dax_pmem-y := pmem.o
76
dax_pmem_core-y := core.o

drivers/dax/pmem/compat.c

Lines changed: 0 additions & 72 deletions
This file was deleted.

0 commit comments

Comments
 (0)