libnvdimm: add dax_dev sync flag
This patch adds 'DAXDEV_SYNC' flag which is set for nd_region doing synchronous flush. This later is used to disable MAP_SYNC functionality for ext4 & xfs filesystem for devices don't support synchronous flush. Signed-off-by: Pankaj Gupta <pagupta@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:

committed by
Dan Williams

orang tua
6e84200c0a
melakukan
fefc1d97fa
@@ -195,6 +195,8 @@ enum dax_device_flags {
|
||||
DAXDEV_ALIVE,
|
||||
/* gate whether dax_flush() calls the low level flush routine */
|
||||
DAXDEV_WRITE_CACHE,
|
||||
/* flag to check if device supports synchronous flush */
|
||||
DAXDEV_SYNC,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -372,6 +374,18 @@ bool dax_write_cache_enabled(struct dax_device *dax_dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dax_write_cache_enabled);
|
||||
|
||||
bool __dax_synchronous(struct dax_device *dax_dev)
|
||||
{
|
||||
return test_bit(DAXDEV_SYNC, &dax_dev->flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__dax_synchronous);
|
||||
|
||||
void __set_dax_synchronous(struct dax_device *dax_dev)
|
||||
{
|
||||
set_bit(DAXDEV_SYNC, &dax_dev->flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__set_dax_synchronous);
|
||||
|
||||
bool dax_alive(struct dax_device *dax_dev)
|
||||
{
|
||||
lockdep_assert_held(&dax_srcu);
|
||||
@@ -526,7 +540,7 @@ static void dax_add_host(struct dax_device *dax_dev, const char *host)
|
||||
}
|
||||
|
||||
struct dax_device *alloc_dax(void *private, const char *__host,
|
||||
const struct dax_operations *ops)
|
||||
const struct dax_operations *ops, unsigned long flags)
|
||||
{
|
||||
struct dax_device *dax_dev;
|
||||
const char *host;
|
||||
@@ -549,6 +563,9 @@ struct dax_device *alloc_dax(void *private, const char *__host,
|
||||
dax_add_host(dax_dev, host);
|
||||
dax_dev->ops = ops;
|
||||
dax_dev->private = private;
|
||||
if (flags & DAXDEV_F_SYNC)
|
||||
set_dax_synchronous(dax_dev);
|
||||
|
||||
return dax_dev;
|
||||
|
||||
err_dev:
|
||||
|
Reference in New Issue
Block a user