summaryrefslogtreecommitdiffstats
path: root/fs/fuse/dax.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2020-08-19 18:19:53 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2020-09-10 11:39:23 +0200
commit9483e7d5809ab41890298a6a1f5d23c4e10a2cfd (patch)
tree5e6d598459a117362ed704debbe77ecdd4e1d1f3 /fs/fuse/dax.c
parent2a9a609a0c4a3b0a6892fbe360b8c419839e6da7 (diff)
downloadlinux-stable-9483e7d5809ab41890298a6a1f5d23c4e10a2cfd.tar.gz
linux-stable-9483e7d5809ab41890298a6a1f5d23c4e10a2cfd.tar.bz2
linux-stable-9483e7d5809ab41890298a6a1f5d23c4e10a2cfd.zip
virtiofs: define dax address space operations
This is done along the lines of ext4 and xfs. I primarily wanted ->writepages hook at this time so that I could call into dax_writeback_mapping_range(). This in turn will decide which pfns need to be written back. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/dax.c')
-rw-r--r--fs/fuse/dax.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index b8ec7d64aa68..c21305409191 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -575,6 +575,16 @@ out:
return ret;
}
+static int fuse_dax_writepages(struct address_space *mapping,
+ struct writeback_control *wbc)
+{
+
+ struct inode *inode = mapping->host;
+ struct fuse_conn *fc = get_fuse_conn(inode);
+
+ return dax_writeback_mapping_range(mapping, fc->dax->dev, wbc);
+}
+
static vm_fault_t __fuse_dax_fault(struct vm_fault *vmf,
enum page_entry_size pe_size, bool write)
{
@@ -741,6 +751,13 @@ bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi)
return true;
}
+static const struct address_space_operations fuse_dax_file_aops = {
+ .writepages = fuse_dax_writepages,
+ .direct_IO = noop_direct_IO,
+ .set_page_dirty = noop_set_page_dirty,
+ .invalidatepage = noop_invalidatepage,
+};
+
void fuse_dax_inode_init(struct inode *inode)
{
struct fuse_conn *fc = get_fuse_conn(inode);
@@ -749,6 +766,7 @@ void fuse_dax_inode_init(struct inode *inode)
return;
inode->i_flags |= S_DAX;
+ inode->i_data.a_ops = &fuse_dax_file_aops;
}
bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment)