This patchset adds support of per-file DAX for virtiofs, which is inspired by Ira Weiny's work on ext4[1] and xfs[2]. There are three related scenarios: 1. Alloc inode: get per-file DAX flag from fuse_attr.flags. (patch 3) 2. Per-file DAX flag changes when the file has been opened. (patch 3) In this case, the dentry and inode are all marked as DONT_CACHE, and the DAX state won't be updated until the file is closed and reopened later. 3. Users can change the per-file DAX flag inside the guest by chattr(1). (patch 4) 4. Create new files under directories with DAX enabled. When creating new files in ext4/xfs on host, the new created files will inherit the per-file DAX flag from the directory, and thus the new created files in virtiofs will also inherit the per-file DAX flag if the fuse server derives fuse_attr.flags from the underlying ext4/xfs inode's per-file DAX flag. Any comment is welcome. [1] commit 9cb20f94afcd ("fs/ext4: Make DAX mount option a tri-state") [2] commit 02beb2686ff9 ("fs/xfs: Make DAX mount option a tri-state") changes since v1: - add support for changing per-file DAX flags inside guest (patch 4) v1:https://www.spinics.net/lists/linux-virtualization/msg51008.html Jeffle Xu (4): fuse: add fuse_should_enable_dax() helper fuse: Make DAX mount option a tri-state fuse: add per-file DAX flag fuse: support changing per-file DAX flag inside guest fs/fuse/dax.c | 36 ++++++++++++++++++++++++++++++++++-- fs/fuse/file.c | 4 ++-- fs/fuse/fuse_i.h | 16 ++++++++++++---- fs/fuse/inode.c | 7 +++++-- fs/fuse/ioctl.c | 9 ++++++--- fs/fuse/virtio_fs.c | 16 ++++++++++++++-- include/uapi/linux/fuse.h | 5 +++++ 7 files changed, 78 insertions(+), 15 deletions(-) -- 2.27.0