[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175279461563.716336.4159682025419490591.stgit@frogsfrogsfrogs>
Date: Thu, 17 Jul 2025 16:45:23 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: joannelkoong@...il.com, miklos@...redi.hu, John@...ves.net,
linux-fsdevel@...r.kernel.org, bernd@...ernd.com, linux-ext4@...r.kernel.org,
neal@...pa.dev
Subject: [PATCH 1/1] fuse2fs: enable caching of iomaps
From: Darrick J. Wong <djwong@...nel.org>
Cache the iomaps we generate in the kernel for better performance.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index d0478af036a25e..f863042a4db074 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -5505,6 +5505,7 @@ static int op_iomap_begin(const char *path, uint64_t nodeid, uint64_t attr_ino,
{
struct fuse_context *ctxt = fuse_get_context();
struct fuse2fs *ff = (struct fuse2fs *)ctxt->private_data;
+ struct fuse_session *se = fuse_get_session(ctxt->fuse);
struct ext2_inode_large inode;
ext2_filsys fs;
errcode_t err;
@@ -5560,6 +5561,24 @@ static int op_iomap_begin(const char *path, uint64_t nodeid, uint64_t attr_ino,
}
}
+ /*
+ * Cache the mapping in the kernel so that we can reuse them for
+ * subsequent IO. Note that we have to return NULL mappings to the
+ * kernel to prompt it to re-try the cache.
+ */
+ write_iomap->type = FUSE_IOMAP_TYPE_NULL;
+ err = fuse_lowlevel_notify_iomap_upsert(se, nodeid, attr_ino,
+ read_iomap, write_iomap);
+ if (err) {
+ ret = translate_error(fs, attr_ino, err);
+ goto out_unlock;
+ }
+
+ /* Null out the read mapping to encourage a retry. */
+ read_iomap->type = FUSE_IOMAP_TYPE_NULL;
+ read_iomap->dev = FUSE_IOMAP_DEV_NULL;
+ read_iomap->addr = FUSE_IOMAP_NULL_ADDR;
+
out_unlock:
fuse2fs_finish(ff, ret);
return ret;
Powered by blists - more mailing lists