[PATCH 09/10] fuse: overlay iomap inode info in struct fuse_inode

Darrick J. Wong
2025-09-16T00:40:45Z

It's not possible for a regular file to use iomap mode and writeback
caching at the same time, so we can save some memory in struct
fuse_inode by overlaying them in the union. This is a separate patch
because C unions are rather unsafe and I prefer any errors to be
bisectable to this patch.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/fuse/fuse_i.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index d42737bac0af88..8238c1cfd9c481 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -197,8 +197,11 @@ struct fuse_inode {

/* waitq for direct-io completion */
wait_queue_head_t direct_io_waitq;
+ };

#ifdef CONFIG_FUSE_IOMAP
+ /* regular file iomap mode */
+ struct {
/* pending io completions */
spinlock_t ioend_lock;
struct work_struct ioend_work;
@@ -206,8 +209,8 @@ struct fuse_inode {

/* cached iomap mappings */
struct fuse_iomap_cache cache;
-#endif
};
+#endif

/* readdir cache (directory only) */
struct {