Skip to content

Commit 9483e7d

Browse files
rhvgoyalMiklos Szeredi
authored andcommitted
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>
1 parent 2a9a609 commit 9483e7d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

fs/fuse/dax.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,16 @@ ssize_t fuse_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
575575
return ret;
576576
}
577577

578+
static int fuse_dax_writepages(struct address_space *mapping,
579+
struct writeback_control *wbc)
580+
{
581+
582+
struct inode *inode = mapping->host;
583+
struct fuse_conn *fc = get_fuse_conn(inode);
584+
585+
return dax_writeback_mapping_range(mapping, fc->dax->dev, wbc);
586+
}
587+
578588
static vm_fault_t __fuse_dax_fault(struct vm_fault *vmf,
579589
enum page_entry_size pe_size, bool write)
580590
{
@@ -741,6 +751,13 @@ bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi)
741751
return true;
742752
}
743753

754+
static const struct address_space_operations fuse_dax_file_aops = {
755+
.writepages = fuse_dax_writepages,
756+
.direct_IO = noop_direct_IO,
757+
.set_page_dirty = noop_set_page_dirty,
758+
.invalidatepage = noop_invalidatepage,
759+
};
760+
744761
void fuse_dax_inode_init(struct inode *inode)
745762
{
746763
struct fuse_conn *fc = get_fuse_conn(inode);
@@ -749,6 +766,7 @@ void fuse_dax_inode_init(struct inode *inode)
749766
return;
750767

751768
inode->i_flags |= S_DAX;
769+
inode->i_data.a_ops = &fuse_dax_file_aops;
752770
}
753771

754772
bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment)

0 commit comments

Comments
 (0)