@@ -10,6 +10,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
+#include <linux/mapdirect.h>
#include <linux/pagemap.h>
#include <linux/module.h>
#include <linux/device.h>
@@ -430,6 +431,7 @@ static int dev_dax_fault(struct vm_fault *vmf)
static const struct vm_operations_struct dax_vm_ops = {
.fault = dev_dax_fault,
.huge_fault = dev_dax_huge_fault,
+ .lease_direct = map_direct_lease,
};
static int dax_mmap(struct file *filp, struct vm_area_struct *vma)
@@ -540,8 +542,10 @@ static void kill_dev_dax(struct dev_dax *dev_dax)
{
struct dax_device *dax_dev = dev_dax->dax_dev;
struct inode *inode = dax_inode(dax_dev);
+ const bool wait = true;
kill_dax(dax_dev);
+ break_layout(inode, wait);
unmap_mapping_range(inode->i_mapping, 0, 0, 1);
}
@@ -58,6 +58,10 @@ config FS_DAX_PMD
depends on ZONE_DEVICE
depends on TRANSPARENT_HUGEPAGE
+config DAX_MAP_DIRECT
+ bool
+ default FS_DAX || DEV_DAX
+
endif # BLOCK
# Posix ACL utility routines
@@ -29,7 +29,8 @@ obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
obj-$(CONFIG_USERFAULTFD) += userfaultfd.o
obj-$(CONFIG_AIO) += aio.o
-obj-$(CONFIG_FS_DAX) += dax.o mapdirect.o
+obj-$(CONFIG_FS_DAX) += dax.o
+obj-$(CONFIG_DAX_MAP_DIRECT) += mapdirect.o
obj-$(CONFIG_FS_ENCRYPTION) += crypto/
obj-$(CONFIG_FILE_LOCKING) += locks.o
obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o
@@ -26,7 +26,7 @@ struct lease_direct {
struct lease_direct_state *lds;
};
-#if IS_ENABLED(CONFIG_FS_DAX)
+#if IS_ENABLED(CONFIG_DAX_MAP_DIRECT)
struct map_direct_state *map_direct_register(int fd, struct vm_area_struct *vma);
int put_map_direct_vma(struct map_direct_state *mds);
void get_map_direct_vma(struct map_direct_state *mds);
The only event that will break a lease_direct lease in the device-dax case is the device shutdown path where the physical pages might get assigned to another device. Cc: Jan Kara <jack@suse.cz> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/dax/device.c | 4 ++++ fs/Kconfig | 4 ++++ fs/Makefile | 3 ++- include/linux/mapdirect.h | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html