dax: remove the DAXDEV_F_SYNC flag

Remove the DAXDEV_F_SYNC flag and thus the flags argument to alloc_dax and
just let the drivers call set_dax_synchronous directly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/20211215084508.435401-4-hch@lst.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Christoph Hellwig 2021-12-15 09:45:07 +01:00 committed by Dan Williams
parent fd1d00ec92
commit 30c6828a17
7 changed files with 12 additions and 20 deletions

View File

@ -1324,11 +1324,12 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)
* No dax_operations since there is no access to this device outside of * No dax_operations since there is no access to this device outside of
* mmap of the resulting character device. * mmap of the resulting character device.
*/ */
dax_dev = alloc_dax(dev_dax, NULL, DAXDEV_F_SYNC); dax_dev = alloc_dax(dev_dax, NULL);
if (IS_ERR(dax_dev)) { if (IS_ERR(dax_dev)) {
rc = PTR_ERR(dax_dev); rc = PTR_ERR(dax_dev);
goto err_alloc_dax; goto err_alloc_dax;
} }
set_dax_synchronous(dax_dev);
/* a device_dax instance is dead while the driver is not attached */ /* a device_dax instance is dead while the driver is not attached */
kill_dax(dax_dev); kill_dax(dax_dev);

View File

@ -345,8 +345,7 @@ static struct dax_device *dax_dev_get(dev_t devt)
return dax_dev; return dax_dev;
} }
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops, struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
unsigned long flags)
{ {
struct dax_device *dax_dev; struct dax_device *dax_dev;
dev_t devt; dev_t devt;
@ -366,9 +365,6 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops,
dax_dev->ops = ops; dax_dev->ops = ops;
dax_dev->private = private; dax_dev->private = private;
if (flags & DAXDEV_F_SYNC)
set_dax_synchronous(dax_dev);
return dax_dev; return dax_dev;
err_dev: err_dev:

View File

@ -1765,7 +1765,7 @@ static struct mapped_device *alloc_dev(int minor)
sprintf(md->disk->disk_name, "dm-%d", minor); sprintf(md->disk->disk_name, "dm-%d", minor);
if (IS_ENABLED(CONFIG_FS_DAX)) { if (IS_ENABLED(CONFIG_FS_DAX)) {
md->dax_dev = alloc_dax(md, &dm_dax_ops, 0); md->dax_dev = alloc_dax(md, &dm_dax_ops);
if (IS_ERR(md->dax_dev)) { if (IS_ERR(md->dax_dev)) {
md->dax_dev = NULL; md->dax_dev = NULL;
goto bad; goto bad;

View File

@ -400,7 +400,6 @@ static int pmem_attach_disk(struct device *dev,
struct gendisk *disk; struct gendisk *disk;
void *addr; void *addr;
int rc; int rc;
unsigned long flags = 0UL;
pmem = devm_kzalloc(dev, sizeof(*pmem), GFP_KERNEL); pmem = devm_kzalloc(dev, sizeof(*pmem), GFP_KERNEL);
if (!pmem) if (!pmem)
@ -493,13 +492,13 @@ static int pmem_attach_disk(struct device *dev,
nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range); nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range);
disk->bb = &pmem->bb; disk->bb = &pmem->bb;
if (is_nvdimm_sync(nd_region)) dax_dev = alloc_dax(pmem, &pmem_dax_ops);
flags = DAXDEV_F_SYNC;
dax_dev = alloc_dax(pmem, &pmem_dax_ops, flags);
if (IS_ERR(dax_dev)) { if (IS_ERR(dax_dev)) {
rc = PTR_ERR(dax_dev); rc = PTR_ERR(dax_dev);
goto out; goto out;
} }
if (is_nvdimm_sync(nd_region))
set_dax_synchronous(dax_dev);
rc = dax_add_host(dax_dev, disk); rc = dax_add_host(dax_dev, disk);
if (rc) if (rc)
goto out_cleanup_dax; goto out_cleanup_dax;

View File

@ -686,13 +686,13 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
if (rc) if (rc)
goto put_dev; goto put_dev;
dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops, dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops);
DAXDEV_F_SYNC);
if (IS_ERR(dev_info->dax_dev)) { if (IS_ERR(dev_info->dax_dev)) {
rc = PTR_ERR(dev_info->dax_dev); rc = PTR_ERR(dev_info->dax_dev);
dev_info->dax_dev = NULL; dev_info->dax_dev = NULL;
goto put_dev; goto put_dev;
} }
set_dax_synchronous(dev_info->dax_dev);
rc = dax_add_host(dev_info->dax_dev, dev_info->gd); rc = dax_add_host(dev_info->dax_dev, dev_info->gd);
if (rc) if (rc)
goto out_dax; goto out_dax;

View File

@ -850,7 +850,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs)
dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n", dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n",
__func__, fs->window_kaddr, cache_reg.addr, cache_reg.len); __func__, fs->window_kaddr, cache_reg.addr, cache_reg.len);
fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops, 0); fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops);
if (IS_ERR(fs->dax_dev)) if (IS_ERR(fs->dax_dev))
return PTR_ERR(fs->dax_dev); return PTR_ERR(fs->dax_dev);

View File

@ -6,9 +6,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
/* Flag for synchronous flush */
#define DAXDEV_F_SYNC (1UL << 0)
typedef unsigned long dax_entry_t; typedef unsigned long dax_entry_t;
struct dax_device; struct dax_device;
@ -42,8 +39,7 @@ struct dax_operations {
}; };
#if IS_ENABLED(CONFIG_DAX) #if IS_ENABLED(CONFIG_DAX)
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops, struct dax_device *alloc_dax(void *private, const struct dax_operations *ops);
unsigned long flags);
void put_dax(struct dax_device *dax_dev); void put_dax(struct dax_device *dax_dev);
void kill_dax(struct dax_device *dax_dev); void kill_dax(struct dax_device *dax_dev);
void dax_write_cache(struct dax_device *dax_dev, bool wc); void dax_write_cache(struct dax_device *dax_dev, bool wc);
@ -64,7 +60,7 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
} }
#else #else
static inline struct dax_device *alloc_dax(void *private, static inline struct dax_device *alloc_dax(void *private,
const struct dax_operations *ops, unsigned long flags) const struct dax_operations *ops)
{ {
/* /*
* Callers should check IS_ENABLED(CONFIG_DAX) to know if this * Callers should check IS_ENABLED(CONFIG_DAX) to know if this