Skip to content

Commit 30c6828

Browse files
Christoph Hellwigdjbw
authored andcommitted
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 <[email protected]> Reviewed-by: Pankaj Gupta <[email protected]> Reviewed-by: Dan Williams <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent fd1d00e commit 30c6828

File tree

7 files changed

+12
-20
lines changed

7 files changed

+12
-20
lines changed

drivers/dax/bus.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,11 +1324,12 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data)
13241324
* No dax_operations since there is no access to this device outside of
13251325
* mmap of the resulting character device.
13261326
*/
1327-
dax_dev = alloc_dax(dev_dax, NULL, DAXDEV_F_SYNC);
1327+
dax_dev = alloc_dax(dev_dax, NULL);
13281328
if (IS_ERR(dax_dev)) {
13291329
rc = PTR_ERR(dax_dev);
13301330
goto err_alloc_dax;
13311331
}
1332+
set_dax_synchronous(dax_dev);
13321333

13331334
/* a device_dax instance is dead while the driver is not attached */
13341335
kill_dax(dax_dev);

drivers/dax/super.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,7 @@ static struct dax_device *dax_dev_get(dev_t devt)
345345
return dax_dev;
346346
}
347347

348-
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops,
349-
unsigned long flags)
348+
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
350349
{
351350
struct dax_device *dax_dev;
352351
dev_t devt;
@@ -366,9 +365,6 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops,
366365

367366
dax_dev->ops = ops;
368367
dax_dev->private = private;
369-
if (flags & DAXDEV_F_SYNC)
370-
set_dax_synchronous(dax_dev);
371-
372368
return dax_dev;
373369

374370
err_dev:

drivers/md/dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,7 @@ static struct mapped_device *alloc_dev(int minor)
17651765
sprintf(md->disk->disk_name, "dm-%d", minor);
17661766

17671767
if (IS_ENABLED(CONFIG_FS_DAX)) {
1768-
md->dax_dev = alloc_dax(md, &dm_dax_ops, 0);
1768+
md->dax_dev = alloc_dax(md, &dm_dax_ops);
17691769
if (IS_ERR(md->dax_dev)) {
17701770
md->dax_dev = NULL;
17711771
goto bad;

drivers/nvdimm/pmem.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ static int pmem_attach_disk(struct device *dev,
400400
struct gendisk *disk;
401401
void *addr;
402402
int rc;
403-
unsigned long flags = 0UL;
404403

405404
pmem = devm_kzalloc(dev, sizeof(*pmem), GFP_KERNEL);
406405
if (!pmem)
@@ -493,13 +492,13 @@ static int pmem_attach_disk(struct device *dev,
493492
nvdimm_badblocks_populate(nd_region, &pmem->bb, &bb_range);
494493
disk->bb = &pmem->bb;
495494

496-
if (is_nvdimm_sync(nd_region))
497-
flags = DAXDEV_F_SYNC;
498-
dax_dev = alloc_dax(pmem, &pmem_dax_ops, flags);
495+
dax_dev = alloc_dax(pmem, &pmem_dax_ops);
499496
if (IS_ERR(dax_dev)) {
500497
rc = PTR_ERR(dax_dev);
501498
goto out;
502499
}
500+
if (is_nvdimm_sync(nd_region))
501+
set_dax_synchronous(dax_dev);
503502
rc = dax_add_host(dax_dev, disk);
504503
if (rc)
505504
goto out_cleanup_dax;

drivers/s390/block/dcssblk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,13 +686,13 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
686686
if (rc)
687687
goto put_dev;
688688

689-
dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops,
690-
DAXDEV_F_SYNC);
689+
dev_info->dax_dev = alloc_dax(dev_info, &dcssblk_dax_ops);
691690
if (IS_ERR(dev_info->dax_dev)) {
692691
rc = PTR_ERR(dev_info->dax_dev);
693692
dev_info->dax_dev = NULL;
694693
goto put_dev;
695694
}
695+
set_dax_synchronous(dev_info->dax_dev);
696696
rc = dax_add_host(dev_info->dax_dev, dev_info->gd);
697697
if (rc)
698698
goto out_dax;

fs/fuse/virtio_fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs)
850850
dev_dbg(&vdev->dev, "%s: window kaddr 0x%px phys_addr 0x%llx len 0x%llx\n",
851851
__func__, fs->window_kaddr, cache_reg.addr, cache_reg.len);
852852

853-
fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops, 0);
853+
fs->dax_dev = alloc_dax(fs, &virtio_fs_dax_ops);
854854
if (IS_ERR(fs->dax_dev))
855855
return PTR_ERR(fs->dax_dev);
856856

include/linux/dax.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
#include <linux/mm.h>
77
#include <linux/radix-tree.h>
88

9-
/* Flag for synchronous flush */
10-
#define DAXDEV_F_SYNC (1UL << 0)
11-
129
typedef unsigned long dax_entry_t;
1310

1411
struct dax_device;
@@ -42,8 +39,7 @@ struct dax_operations {
4239
};
4340

4441
#if IS_ENABLED(CONFIG_DAX)
45-
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops,
46-
unsigned long flags);
42+
struct dax_device *alloc_dax(void *private, const struct dax_operations *ops);
4743
void put_dax(struct dax_device *dax_dev);
4844
void kill_dax(struct dax_device *dax_dev);
4945
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,
6460
}
6561
#else
6662
static inline struct dax_device *alloc_dax(void *private,
67-
const struct dax_operations *ops, unsigned long flags)
63+
const struct dax_operations *ops)
6864
{
6965
/*
7066
* Callers should check IS_ENABLED(CONFIG_DAX) to know if this

0 commit comments

Comments
 (0)