From: "Darrick J. Wong" <djwong@kernel.org>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu,
linux-xfs@vger.kernel.org, bernd@bsbernd.com, John@groves.net
Subject: Re: [PATCH 03/11] fuse: implement the basic iomap mechanisms
Date: Mon, 2 Jun 2025 17:13:41 -0700 [thread overview]
Message-ID: <20250603001341.GN8328@frogsfrogsfrogs> (raw)
In-Reply-To: <CAJnrk1YDxn0ZMk0BrTnNStkXErjY_LSGYHgdsRjiiZ2dTpftAA@mail.gmail.com>
On Thu, May 29, 2025 at 04:15:57PM -0700, Joanne Koong wrote:
> On Thu, May 29, 2025 at 3:15 PM Joanne Koong <joannelkoong@gmail.com> wrote:
> >
> > On Wed, May 21, 2025 at 5:03 PM Darrick J. Wong <djwong@kernel.org> wrote:
> > >
> > > From: Darrick J. Wong <djwong@kernel.org>
> > >
> > > Implement functions to enable upcalling of iomap_begin and iomap_end to
> > > userspace fuse servers.
> > >
> > > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > > ---
> > > fs/fuse/fuse_i.h | 38 ++++++
> > > fs/fuse/fuse_trace.h | 258 +++++++++++++++++++++++++++++++++++++++++
> > > include/uapi/linux/fuse.h | 87 ++++++++++++++
> > > fs/fuse/Kconfig | 23 ++++
> > > fs/fuse/Makefile | 1
> > > fs/fuse/file_iomap.c | 280 +++++++++++++++++++++++++++++++++++++++++++++
> > > fs/fuse/inode.c | 5 +
> > > 7 files changed, 691 insertions(+), 1 deletion(-)
> > > create mode 100644 fs/fuse/file_iomap.c
> > >
> > >
> > > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> > > index d56d4fd956db99..aa51f25856697d 100644
> > > --- a/fs/fuse/fuse_i.h
> > > +++ b/fs/fuse/fuse_i.h
> > > @@ -895,6 +895,9 @@ struct fuse_conn {
> > > /* Is link not implemented by fs? */
> > > unsigned int no_link:1;
> > >
> > > + /* Use fs/iomap for FIEMAP and SEEK_{DATA,HOLE} file operations */
> > > + unsigned int iomap:1;
> > > +
> > > /* Use io_uring for communication */
> > > unsigned int io_uring;
> > >
> > > @@ -1017,6 +1020,11 @@ static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb)
> > > return sb->s_fs_info;
> > > }
> > >
> > > +static inline const struct fuse_mount *get_fuse_mount_super_c(const struct super_block *sb)
> > > +{
> > > + return sb->s_fs_info;
> > > +}
> > > +
> >
> > Instead of adding this new helper (and the ones below), what about
> > modifying the existing (non-const) versions of these helpers to take
> > in const * input args, eg
> >
> > -static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb)
> > +static inline struct fuse_mount *get_fuse_mount_super(const struct
> > super_block *sb)
> > {
> > return sb->s_fs_info;
> > }
> >
> > Then, doing something like "const struct fuse_mount *mt =
> > get_fuse_mount(inode);" would enforce the same guarantees as "const
> > struct fuse_mount *mt = get_fuse_mount_c(inode);" and we wouldn't need
> > 2 sets of helpers that pretty much do the same thing.
> >
> > > static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
> > > {
> > > return get_fuse_mount_super(sb)->fc;
> > > @@ -1027,16 +1035,31 @@ static inline struct fuse_mount *get_fuse_mount(struct inode *inode)
> > > return get_fuse_mount_super(inode->i_sb);
> > > }
> > >
> > > +static inline const struct fuse_mount *get_fuse_mount_c(const struct inode *inode)
> > > +{
> > > + return get_fuse_mount_super_c(inode->i_sb);
> > > +}
> > > +
> > > static inline struct fuse_conn *get_fuse_conn(struct inode *inode)
> > > {
> > > return get_fuse_mount_super(inode->i_sb)->fc;
> > > }
> > >
> > > +static inline const struct fuse_conn *get_fuse_conn_c(const struct inode *inode)
> > > +{
> > > + return get_fuse_mount_super_c(inode->i_sb)->fc;
> > > +}
> > > +
> > > static inline struct fuse_inode *get_fuse_inode(struct inode *inode)
> > > {
> > > return container_of(inode, struct fuse_inode, inode);
> > > }
> > >
> > > +static inline const struct fuse_inode *get_fuse_inode_c(const struct inode *inode)
> > > +{
> > > + return container_of(inode, struct fuse_inode, inode);
> > > +}
> > > +
> > > static inline u64 get_node_id(struct inode *inode)
> > > {
> > > return get_fuse_inode(inode)->nodeid;
> > > @@ -1577,4 +1600,19 @@ extern void fuse_sysctl_unregister(void);
> > > #define fuse_sysctl_unregister() do { } while (0)
> > > #endif /* CONFIG_SYSCTL */
> > >
> > > +#if IS_ENABLED(CONFIG_FUSE_IOMAP)
> > > +# include <linux/fiemap.h>
> > > +# include <linux/iomap.h>
> > > +
> > > +bool fuse_iomap_enabled(void);
> > > +
> > > +static inline bool fuse_has_iomap(const struct inode *inode)
> > > +{
> > > + return get_fuse_conn_c(inode)->iomap;
> > > +}
> > > +#else
> > > +# define fuse_iomap_enabled(...) (false)
> > > +# define fuse_has_iomap(...) (false)
> > > +#endif
> > > +
> > > #endif /* _FS_FUSE_I_H */
> > > diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig
> > > index ca215a3cba3e31..fc7c5bf1cef52d 100644
> > > --- a/fs/fuse/Kconfig
> > > +++ b/fs/fuse/Kconfig
> > > @@ -64,6 +64,29 @@ config FUSE_PASSTHROUGH
> > >
> > > If you want to allow passthrough operations, answer Y.
> > >
> > > +config FUSE_IOMAP
> > > + bool "FUSE file IO over iomap"
> > > + default y
> > > + depends on FUSE_FS
> > > + select FS_IOMAP
> > > + help
> > > + For supported fuseblk servers, this allows the file IO path to run
> > > + through the kernel.
> >
> > I have config FUSE_FS select FS_IOMAP in my patchset (not yet
> > submitted) that changes fuse buffered writes / writeback handling to
> > use iomap. Could we just have config FUSE_FS automatically opt into
> > FS_IOMAP here or do you see a reason that this needs to be a separate
> > config?
>
> Thinking about it some more, the iomap stuff you're adding also
> requires a "depends on BLOCK", so this will need to be a separate
> config anyways regardless of whether the FUSE_FS will always "select
> FS_IOMAP"
I'll add that, thanks. I forgot that FS_IOMAP no longer selects BLOCK
all the time. :)
--D
>
> Thanks,
> Joanne
>
> >
> >
> > Thanks,
> > Joanne
> > > +
> > > +config FUSE_IOMAP_BY_DEFAULT
> > > + bool "FUSE file I/O over iomap by default"
> > > + default n
> > > + depends on FUSE_IOMAP
> > > + help
> > > + Enable sending FUSE file I/O over iomap by default.
> > > +
> > > +config FUSE_IOMAP_DEBUG
> > > + bool "Debug FUSE file IO over iomap"
> > > + default n
> > > + depends on FUSE_IOMAP
> > > + help
> > > + Enable debugging assertions for the fuse iomap code paths.
> > > +
> > > config FUSE_IO_URING
> > > bool "FUSE communication over io-uring"
> > > default y
next prev parent reply other threads:[~2025-06-03 0:13 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 23:58 [RFC[RAP]] fuse: use fs-iomap for better performance so we can containerize ext4 Darrick J. Wong
2025-05-22 0:01 ` [PATCHSET RFC[RAP]] fuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-05-22 0:02 ` [PATCH 01/11] fuse: fix livelock in synchronous file put from fuseblk workers Darrick J. Wong
2025-05-29 11:08 ` Miklos Szeredi
2025-05-31 1:08 ` Darrick J. Wong
2025-06-06 13:54 ` Miklos Szeredi
2025-06-09 18:13 ` Darrick J. Wong
2025-06-09 20:29 ` Darrick J. Wong
2025-05-22 0:02 ` [PATCH 02/11] iomap: exit early when iomap_iter is called with zero length Darrick J. Wong
2025-05-22 0:03 ` [PATCH 03/11] fuse: implement the basic iomap mechanisms Darrick J. Wong
2025-05-29 22:15 ` Joanne Koong
2025-05-29 23:15 ` Joanne Koong
2025-06-03 0:13 ` Darrick J. Wong [this message]
2025-05-22 0:03 ` [PATCH 04/11] fuse: add a notification to add new iomap devices Darrick J. Wong
2025-05-22 16:46 ` Amir Goldstein
2025-05-22 17:11 ` Darrick J. Wong
2025-05-22 0:03 ` [PATCH 05/11] fuse: send FUSE_DESTROY to userspace when tearing down an iomap connection Darrick J. Wong
2025-05-22 0:04 ` [PATCH 06/11] fuse: implement basic iomap reporting such as FIEMAP and SEEK_{DATA,HOLE} Darrick J. Wong
2025-05-22 0:04 ` [PATCH 07/11] fuse: implement direct IO with iomap Darrick J. Wong
2025-05-22 0:04 ` [PATCH 08/11] fuse: implement buffered " Darrick J. Wong
2025-05-22 0:04 ` [PATCH 09/11] fuse: implement large folios for iomap pagecache files Darrick J. Wong
2025-05-22 0:05 ` [PATCH 10/11] fuse: use an unrestricted backing device with iomap pagecache io Darrick J. Wong
2025-05-22 0:05 ` [PATCH 11/11] fuse: advertise support for iomap Darrick J. Wong
2025-05-22 0:01 ` [PATCHSET RFC[RAP]] libfuse: allow servers to use iomap for better file IO performance Darrick J. Wong
2025-05-22 0:05 ` [PATCH 1/8] libfuse: add kernel gates for FUSE_IOMAP and bump libfuse api version Darrick J. Wong
2025-05-22 0:05 ` [PATCH 2/8] libfuse: add fuse commands for iomap_begin and end Darrick J. Wong
2025-05-22 0:06 ` [PATCH 3/8] libfuse: add upper level iomap commands Darrick J. Wong
2025-05-22 0:06 ` [PATCH 4/8] libfuse: add a notification to add a new device to iomap Darrick J. Wong
2025-05-22 0:06 ` [PATCH 5/8] libfuse: add iomap ioend low level handler Darrick J. Wong
2025-05-22 0:06 ` [PATCH 6/8] libfuse: add upper level iomap ioend commands Darrick J. Wong
2025-05-22 0:07 ` [PATCH 7/8] libfuse: add FUSE_IOMAP_PAGECACHE Darrick J. Wong
2025-05-22 0:07 ` [PATCH 8/8] libfuse: allow discovery of the kernel's iomap capabilities Darrick J. Wong
2025-05-22 0:02 ` [PATCHSET RFC[RAP] 2/3] libext2fs: refactoring for fuse2fs iomap support Darrick J. Wong
2025-05-22 0:08 ` [PATCH 01/10] libext2fs: always fsync the device when flushing the cache Darrick J. Wong
2025-05-22 0:08 ` [PATCH 02/10] libext2fs: always fsync the device when closing the unix IO manager Darrick J. Wong
2025-05-22 0:09 ` [PATCH 03/10] libext2fs: only fsync the unix fd if we wrote to the device Darrick J. Wong
2025-05-22 0:09 ` [PATCH 04/10] libext2fs: invalidate cached blocks when freeing them Darrick J. Wong
2025-05-22 0:09 ` [PATCH 05/10] libext2fs: add tagged block IO for better caching Darrick J. Wong
2025-05-22 0:09 ` [PATCH 06/10] libext2fs: add tagged block IO caching to the unix IO manager Darrick J. Wong
2025-05-22 0:10 ` [PATCH 07/10] libext2fs: only flush affected blocks in unix_write_byte Darrick J. Wong
2025-05-22 0:10 ` [PATCH 08/10] libext2fs: allow unix_write_byte when the write would be aligned Darrick J. Wong
2025-05-22 0:10 ` [PATCH 09/10] libext2fs: allow clients to ask to write full superblocks Darrick J. Wong
2025-05-22 0:10 ` [PATCH 10/10] libext2fs: allow callers to disallow I/O to file data blocks Darrick J. Wong
2025-05-22 0:02 ` [PATCHSET RFC[RAP] 3/3] fuse2fs: use fuse iomap data paths for better file I/O performance Darrick J. Wong
2025-05-22 0:11 ` [PATCH 01/16] fuse2fs: implement bare minimum iomap for file mapping reporting Darrick J. Wong
2025-05-22 0:11 ` [PATCH 02/16] fuse2fs: register block devices for use with iomap Darrick J. Wong
2025-05-22 0:11 ` [PATCH 03/16] fuse2fs: always use directio disk reads with fuse2fs Darrick J. Wong
2025-05-22 0:11 ` [PATCH 04/16] fuse2fs: implement directio file reads Darrick J. Wong
2025-05-22 0:12 ` [PATCH 05/16] fuse2fs: use tagged block IO for zeroing sub-block regions Darrick J. Wong
2025-05-22 0:12 ` [PATCH 06/16] fuse2fs: only flush the cache for the file under directio read Darrick J. Wong
2025-05-22 0:12 ` [PATCH 07/16] fuse2fs: add extent dump function for debugging Darrick J. Wong
2025-05-22 0:12 ` [PATCH 08/16] fuse2fs: implement direct write support Darrick J. Wong
2025-05-22 0:13 ` [PATCH 09/16] fuse2fs: turn on iomap for pagecache IO Darrick J. Wong
2025-05-22 0:13 ` [PATCH 10/16] fuse2fs: flush and invalidate the buffer cache on trim Darrick J. Wong
2025-05-22 0:13 ` [PATCH 11/16] fuse2fs: improve tracing for fallocate Darrick J. Wong
2025-05-22 0:13 ` [PATCH 12/16] fuse2fs: don't zero bytes in punch hole Darrick J. Wong
2025-05-22 0:14 ` [PATCH 13/16] fuse2fs: don't do file data block IO when iomap is enabled Darrick J. Wong
2025-05-22 0:14 ` [PATCH 14/16] fuse2fs: disable most io channel flush/invalidate in iomap pagecache mode Darrick J. Wong
2025-05-22 0:14 ` [PATCH 15/16] fuse2fs: re-enable the block device pagecache for metadata IO Darrick J. Wong
2025-05-22 0:15 ` [PATCH 16/16] fuse2fs: avoid fuseblk mode if fuse-iomap support is likely Darrick J. Wong
2025-05-22 16:24 ` [RFC[RAP]] fuse: use fs-iomap for better performance so we can containerize ext4 Amir Goldstein
2025-05-29 16:45 ` Darrick J. Wong
2025-05-29 19:41 ` Amir Goldstein
2025-06-09 22:31 ` Darrick J. Wong
2025-06-10 10:59 ` Amir Goldstein
2025-06-10 19:00 ` Darrick J. Wong
2025-06-10 19:51 ` Amir Goldstein
2025-06-11 6:00 ` Darrick J. Wong
2025-06-11 8:54 ` Amir Goldstein
2025-06-12 5:54 ` Miklos Szeredi
2025-06-13 17:44 ` Darrick J. Wong
2025-06-11 11:56 ` Theodore Ts'o
2025-06-12 3:20 ` Darrick J. Wong
2025-06-12 6:10 ` Amir Goldstein
2025-06-20 8:58 ` Allison Karlitskaya
2025-06-20 11:50 ` Bernd Schubert
2025-07-01 6:02 ` Darrick J. Wong
2025-07-01 5:58 ` Darrick J. Wong
2025-07-12 10:57 ` Amir Goldstein
2025-06-13 17:37 ` [RFC[RAP] V2] " Darrick J. Wong
2025-06-23 13:16 ` Miklos Szeredi
2025-07-01 6:05 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250603001341.GN8328@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=John@groves.net \
--cc=bernd@bsbernd.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).