[PATCH 20/28] fuse_trace: query filesystem geometry when using iomap

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

Add tracepoints for the previous patch.

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

diff --git a/fs/fuse/fuse_trace.h b/fs/fuse/fuse_trace.h
index e69ad48b14066b..66b564bcd25360 100644
--- a/fs/fuse/fuse_trace.h
+++ b/fs/fuse/fuse_trace.h
@@ -58,6 +58,7 @@
EM( FUSE_SYNCFS, "FUSE_SYNCFS") \
EM( FUSE_TMPFILE, "FUSE_TMPFILE") \
EM( FUSE_STATX, "FUSE_STATX") \
+ EM( FUSE_IOMAP_CONFIG, "FUSE_IOMAP_CONFIG") \
EM( FUSE_IOMAP_BEGIN, "FUSE_IOMAP_BEGIN") \
EM( FUSE_IOMAP_END, "FUSE_IOMAP_END") \
EM( FUSE_IOMAP_IOEND, "FUSE_IOMAP_IOEND") \
@@ -340,6 +341,14 @@ TRACE_DEFINE_ENUM(FUSE_I_IOMAP);
{ IOMAP_IOEND_BOUNDARY, "boundary" }, \
{ IOMAP_IOEND_DIRECT, "direct" }

+#define FUSE_IOMAP_CONFIG_STRINGS \
+ { FUSE_IOMAP_CONFIG_SID, "sid" }, \
+ { FUSE_IOMAP_CONFIG_UUID, "uuid" }, \
+ { FUSE_IOMAP_CONFIG_BLOCKSIZE, "blocksize" }, \
+ { FUSE_IOMAP_CONFIG_MAX_LINKS, "max_links" }, \
+ { FUSE_IOMAP_CONFIG_TIME, "time" }, \
+ { FUSE_IOMAP_CONFIG_MAXBYTES, "maxbytes" }
+
DECLARE_EVENT_CLASS(fuse_iomap_check_class,
TP_PROTO(const char *func, int line, const char *condition),

@@ -968,6 +977,45 @@ TRACE_EVENT(fuse_iomap_fallocate,
__entry->mode,
__entry->newsize)
);
+
+TRACE_EVENT(fuse_iomap_config,
+ TP_PROTO(const struct fuse_mount *fm,
+ const struct fuse_iomap_config_out *outarg),
+ TP_ARGS(fm, outarg),
+
+ TP_STRUCT__entry(
+ __field(dev_t, connection)
+
+ __field(uint32_t, flags)
+ __field(uint32_t, blocksize)
+ __field(uint32_t, max_links)
+ __field(uint32_t, time_gran)
+
+ __field(int64_t, time_min)
+ __field(int64_t, time_max)
+ __field(int64_t, maxbytes)
+ __field(uint8_t, uuid_len)
+ ),
+
+ TP_fast_assign(
+ __entry->connection = fm->fc->dev;
+ __entry->flags = outarg->flags;
+ __entry->blocksize = outarg->s_blocksize;
+ __entry->max_links = outarg->s_max_links;
+ __entry->time_gran = outarg->s_time_gran;
+ __entry->time_min = outarg->s_time_min;
+ __entry->time_max = outarg->s_time_max;
+ __entry->maxbytes = outarg->s_maxbytes;
+ __entry->uuid_len = outarg->s_uuid_len;
+ ),
+
+ TP_printk("connection %u flags (%s) blocksize 0x%x max_links %u time_gran %u time_min %lld time_max %lld maxbytes 0x%llx uuid_len %u",
+ __entry->connection,
+ __print_flags(__entry->flags, "|", FUSE_IOMAP_CONFIG_STRINGS),
+ __entry->blocksize, __entry->max_links, __entry->time_gran,
+ __entry->time_min, __entry->time_max, __entry->maxbytes,
+ __entry->uuid_len)
+);
#endif /* CONFIG_FUSE_IOMAP */

#endif /* _TRACE_FUSE_H */
diff --git a/fs/fuse/file_iomap.c b/fs/fuse/file_iomap.c
index abba22107718d9..2d01828fc532b0 100644
--- a/fs/fuse/file_iomap.c
+++ b/fs/fuse/file_iomap.c
@@ -735,6 +735,8 @@ static int fuse_iomap_process_config(struct fuse_mount *fm, int error,
return error;
}

+ trace_fuse_iomap_config(fm, outarg);
+
if (outarg->flags & ~FUSE_IOMAP_CONFIG_ALL)
return -EINVAL;

@@ -760,6 +762,7 @@ static int fuse_iomap_process_config(struct fuse_mount *fm, int error,
sb->s_blocksize = outarg->s_blocksize;
sb->s_blocksize_bits = blksize_bits(outarg->s_blocksize);
}
+ fm->fc->blkbits = sb->s_blocksize_bits;
}

if (outarg->flags & FUSE_IOMAP_CONFIG_SID)