On Fri, Jul 18, 2025 at 1:32 AM Darrick J. Wong <djwong@xxxxxxxxxx> wrote: > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Implement pagecache IO with iomap, complete with hooks into truncate and > fallocate so that the fuse server needn't implement disk block zeroing > of post-EOF and unaligned punch/zero regions. > > Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> > --- > fs/fuse/fuse_i.h | 46 +++ > fs/fuse/fuse_trace.h | 391 ++++++++++++++++++++++++ > include/uapi/linux/fuse.h | 5 > fs/fuse/dir.c | 23 + > fs/fuse/file.c | 90 +++++- > fs/fuse/file_iomap.c | 723 +++++++++++++++++++++++++++++++++++++++++++++ > fs/fuse/inode.c | 14 + > 7 files changed, 1268 insertions(+), 24 deletions(-) > > > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h > index 67e428da4391aa..f33b348d296d5e 100644 > --- a/fs/fuse/fuse_i.h > +++ b/fs/fuse/fuse_i.h > @@ -161,6 +161,13 @@ struct fuse_inode { > > /* waitq for direct-io completion */ > wait_queue_head_t direct_io_waitq; > + > +#ifdef CONFIG_FUSE_IOMAP > + /* pending io completions */ > + spinlock_t ioend_lock; > + struct work_struct ioend_work; > + struct list_head ioend_list; > +#endif > }; This union member you are changing is declared for /* read/write io cache (regular file only) */ but actually it is also for parallel dio and passthrough mode IIUC, there should be zero intersection between these io modes and /* iomap cached fileio (regular file only) */ Right? So it can use its own union member without increasing fuse_inode size. Just need to be carefull in fuse_init_file_inode(), fuse_evict_inode() and fuse_file_io_release() which do not assume a specific inode io mode. Was it your intention to allow filesystems to configure some inodes to be in file_iomap mode and other inodes to be in regular cached/direct/passthrough io modes? I can't say that I see a big benefit in allowing such setups. It certainly adds a lot of complication to the test matrix if we allow that. My instinct is for initial version, either allow only opening files in FILE_IOMAP or DIRECT_IOMAP to inodes for a filesystem that supports those modes. Perhaps later we can allow (and maybe fallback to) FOPEN_DIRECT_IO (without parallel dio) if a server does not configure IOMAP to some inode to allow a server to provide the data for a specific inode directly. fuse_file_io_open/release() can help you manage those restrictions and set ff->iomode = IOM_FILE_IOMAP when a file is opened for file iomap. I did not look closely enough to see if file_iomap code ends up setting ff->iomode = IOM_CACHED/UNCACHED or always remains IOM_NONE. Thanks, Amir.