[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169813840.1427432.11872191487359495335.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 18:03:44 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, bschubert@....com
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
bernd@...ernd.com, miklos@...redi.hu, joannelkoong@...il.com, neal@...pa.dev
Subject: [PATCH 17/22] libfuse: add upper-level API to invalidate parts of an
iomap block device
From: Darrick J. Wong <djwong@...nel.org>
Wire up the upper-level wrappers to
fuse_lowlevel_iomap_invalidate_device.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
include/fuse.h | 10 ++++++++++
lib/fuse.c | 9 +++++++++
lib/fuse_versionscript | 1 +
3 files changed, 20 insertions(+)
diff --git a/include/fuse.h b/include/fuse.h
index 74b86e8d27fb35..e53e92786cea08 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -1422,6 +1422,16 @@ int fuse_fs_iomap_device_add(int fd, unsigned int flags);
*/
int fuse_fs_iomap_device_remove(int device_id);
+/**
+ * Invalidate any pagecache for the given iomap (block) device.
+ *
+ * @param device_id device index as returned by fuse_lowlevel_iomap_device_add
+ * @param offset starting offset of the range to invalidate
+ * @param length length of the range to invalidate
+ * @return 0 on success, or negative errno on failure
+ */
+int fuse_fs_iomap_device_invalidate(int device_id, off_t offset, off_t length);
+
/**
* Decide if we can enable iomap mode for a particular file for an upper-level
* fuse server.
diff --git a/lib/fuse.c b/lib/fuse.c
index 1fec6371b7bc81..ed2bd3da212743 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -2921,6 +2921,15 @@ int fuse_fs_iomap_device_remove(int device_id)
return fuse_lowlevel_iomap_device_remove(se, device_id);
}
+int fuse_fs_iomap_device_invalidate(int device_id, off_t offset, off_t length)
+{
+ struct fuse_context *ctxt = fuse_get_context();
+ struct fuse_session *se = fuse_get_session(ctxt->fuse);
+
+ return fuse_lowlevel_iomap_device_invalidate(se, device_id, offset,
+ length);
+}
+
static int fuse_fs_iomap_ioend(struct fuse_fs *fs, const char *path,
uint64_t nodeid, uint64_t attr_ino, off_t pos,
size_t written, uint32_t ioendflags, int error,
diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript
index d268471ae5bd38..a275b53c6f9f1a 100644
--- a/lib/fuse_versionscript
+++ b/lib/fuse_versionscript
@@ -235,6 +235,7 @@ FUSE_3.99 {
fuse_lowlevel_discover_iomap;
fuse_reply_iomap_config;
fuse_lowlevel_iomap_device_invalidate;
+ fuse_fs_iomap_device_invalidate;
} FUSE_3.18;
# Local Variables:
Powered by blists - more mailing lists