* FUSE_DAX_FMAP flag in INIT request/reply * fuse_conn->famfs_iomap (enable famfs-mapped files) to denote a famfs-enabled connection
Signed-off-by: John Groves <j...@groves.net> --- fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 14 ++++++++++++++ include/uapi/linux/fuse.h | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 9d87ac48d724..a592c1002861 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -873,6 +873,9 @@ struct fuse_conn { /* Use io_uring for communication */ unsigned int io_uring; + /* dev_dax_iomap support for famfs */ + unsigned int famfs_iomap:1; + /** Maximum stack depth for passthrough backing files */ int max_stack_depth; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 29147657a99f..e48e11c3f9f3 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1392,6 +1392,18 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args, } if (flags & FUSE_OVER_IO_URING && fuse_uring_enabled()) fc->io_uring = 1; + if (IS_ENABLED(CONFIG_FUSE_FAMFS_DAX) && + flags & FUSE_DAX_FMAP) { + /* XXX: Should also check that fuse server + * has CAP_SYS_RAWIO and/or CAP_SYS_ADMIN, + * since it is directing the kernel to access + * dax memory directly - but this function + * appears not to be called in fuse server + * process context (b/c even if it drops + * those capabilities, they are held here). + */ + fc->famfs_iomap = 1; + } } else { ra_pages = fc->max_read / PAGE_SIZE; fc->no_lock = 1; @@ -1450,6 +1462,8 @@ void fuse_send_init(struct fuse_mount *fm) flags |= FUSE_SUBMOUNTS; if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) flags |= FUSE_PASSTHROUGH; + if (IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)) + flags |= FUSE_DAX_FMAP; /* * This is just an information flag for fuse server. No need to check diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 5e0eb41d967e..6c384640c79b 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -229,6 +229,8 @@ * - FUSE_URING_IN_OUT_HEADER_SZ * - FUSE_URING_OP_IN_OUT_SZ * - enum fuse_uring_cmd + * 7.43 + * - Add FUSE_DAX_FMAP capability - ability to handle in-kernel fsdax maps */ #ifndef _LINUX_FUSE_H @@ -435,6 +437,7 @@ struct fuse_file_lock { * of the request ID indicates resend requests * FUSE_ALLOW_IDMAP: allow creation of idmapped mounts * FUSE_OVER_IO_URING: Indicate that client supports io-uring + * FUSE_DAX_FMAP: kernel supports dev_dax_iomap (aka famfs) fmaps */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) @@ -482,6 +485,7 @@ struct fuse_file_lock { #define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP #define FUSE_ALLOW_IDMAP (1ULL << 40) #define FUSE_OVER_IO_URING (1ULL << 41) +#define FUSE_DAX_FMAP (1ULL << 42) /** * CUSE INIT request/reply flags -- 2.49.0