[PATCH 23/28] fuse_trace: invalidate ranges of block devices being used for iomap

Darrick J. Wong
2025-09-16T00:33:58Z

Add tracepoints for the previous patch.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
fs/fuse/fuse_trace.h | 26 ++++++++++++++++++++++++++
fs/fuse/file_iomap.c | 2 ++
2 files changed, 28 insertions(+)

diff --git a/fs/fuse/fuse_trace.h b/fs/fuse/fuse_trace.h
index 66b564bcd25360..1cff42bc5907bf 100644
--- a/fs/fuse/fuse_trace.h
+++ b/fs/fuse/fuse_trace.h
@@ -1016,6 +1016,32 @@ TRACE_EVENT(fuse_iomap_config,
__entry->time_min, __entry->time_max, __entry->maxbytes,
__entry->uuid_len)
);
+
+TRACE_EVENT(fuse_iomap_dev_inval,
+ TP_PROTO(const struct fuse_conn *fc,
+ const struct fuse_iomap_dev_inval_out *arg),
+ TP_ARGS(fc, arg),
+
+ TP_STRUCT__entry(
+ __field(dev_t, connection)
+ __field(int, dev)
+ __field(unsigned long long, offset)
+ __field(unsigned long long, length)
+ ),
+
+ TP_fast_assign(
+ __entry->connection = fc->dev;
+ __entry->dev = arg->dev;
+ __entry->offset = arg->offset;
+ __entry->length = arg->length;
+ ),
+
+ TP_printk("connection %u dev %d offset 0x%llx length 0x%llx",
+ __entry->connection,
+ __entry->dev,
+ __entry->offset,
+ __entry->length)
+);
#endif /* CONFIG_FUSE_IOMAP */

#endif /* _TRACE_FUSE_H */
diff --git a/fs/fuse/file_iomap.c b/fs/fuse/file_iomap.c
index 9c798435e45633..d2945f8071a296 100644
--- a/fs/fuse/file_iomap.c
+++ b/fs/fuse/file_iomap.c
@@ -1885,6 +1885,8 @@ int fuse_iomap_dev_inval(struct fuse_conn *fc,
loff_t end;
int ret = 0;

+ trace_fuse_iomap_dev_inval(fc, arg);
+
if (!fc->iomap || arg->dev == FUSE_IOMAP_DEV_NULL)
return -EINVAL;