[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176169810895.1424854.5739312981313566754.stgit@frogsfrogsfrogs>
Date: Tue, 28 Oct 2025 17:51:28 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: djwong@...nel.org, miklos@...redi.hu
Cc: joannelkoong@...il.com, bernd@...ernd.com, neal@...pa.dev,
linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 25/31] fuse_trace: implement inline data file IO via iomap
From: Darrick J. Wong <djwong@...nel.org>
Add tracepoints for the previous patch.
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
fs/fuse/fuse_trace.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
fs/fuse/file_iomap.c | 7 +++++++
2 files changed, 52 insertions(+)
diff --git a/fs/fuse/fuse_trace.h b/fs/fuse/fuse_trace.h
index 67b9bd8ea52b79..9852a78eda26d3 100644
--- a/fs/fuse/fuse_trace.h
+++ b/fs/fuse/fuse_trace.h
@@ -227,6 +227,7 @@ DEFINE_FUSE_BACKING_EVENT(fuse_backing_close);
#if IS_ENABLED(CONFIG_FUSE_IOMAP)
struct iomap_writepage_ctx;
struct iomap_ioend;
+struct iomap;
/* tracepoint boilerplate so we don't have to keep doing this */
#define FUSE_IOMAP_OPFLAGS_FIELD \
@@ -1044,6 +1045,50 @@ TRACE_EVENT(fuse_iomap_dev_inval,
__entry->offset,
__entry->length)
);
+
+DECLARE_EVENT_CLASS(fuse_iomap_inline_class,
+ TP_PROTO(const struct inode *inode, loff_t pos, uint64_t count,
+ const struct iomap *map),
+ TP_ARGS(inode, pos, count, map),
+
+ TP_STRUCT__entry(
+ FUSE_IO_RANGE_FIELDS()
+ FUSE_IOMAP_MAP_FIELDS(map)
+ __field(bool, has_buf)
+ __field(uint64_t, validity_cookie)
+ ),
+
+ TP_fast_assign(
+ FUSE_INODE_ASSIGN(inode, fi, fm);
+ __entry->offset = pos;
+ __entry->length = count;
+
+ __entry->mapdev = FUSE_IOMAP_DEV_NULL;
+ __entry->mapaddr = map->addr;
+ __entry->mapoffset = map->offset;
+ __entry->maplength = map->length;
+ __entry->maptype = map->type;
+ __entry->mapflags = map->flags;
+
+ __entry->has_buf = map->inline_data != NULL;
+ __entry->validity_cookie= map->validity_cookie;
+ ),
+
+ TP_printk(FUSE_IO_RANGE_FMT() FUSE_IOMAP_MAP_FMT() " has_buf? %d cookie 0x%llx",
+ FUSE_IO_RANGE_PRINTK_ARGS(),
+ FUSE_IOMAP_MAP_PRINTK_ARGS(map),
+ __entry->has_buf,
+ __entry->validity_cookie)
+);
+#define DEFINE_FUSE_IOMAP_INLINE_EVENT(name) \
+DEFINE_EVENT(fuse_iomap_inline_class, name, \
+ TP_PROTO(const struct inode *inode, loff_t pos, uint64_t count, \
+ const struct iomap *map), \
+ TP_ARGS(inode, pos, count, map))
+DEFINE_FUSE_IOMAP_INLINE_EVENT(fuse_iomap_inline_read);
+DEFINE_FUSE_IOMAP_INLINE_EVENT(fuse_iomap_inline_write);
+DEFINE_FUSE_IOMAP_INLINE_EVENT(fuse_iomap_set_inline_iomap);
+DEFINE_FUSE_IOMAP_INLINE_EVENT(fuse_iomap_set_inline_srcmap);
#endif /* CONFIG_FUSE_IOMAP */
#endif /* _TRACE_FUSE_H */
diff --git a/fs/fuse/file_iomap.c b/fs/fuse/file_iomap.c
index c921d4db7a7f92..06d1834e43f698 100644
--- a/fs/fuse/file_iomap.c
+++ b/fs/fuse/file_iomap.c
@@ -452,6 +452,8 @@ static int fuse_iomap_inline_read(struct inode *inode, loff_t pos,
if (BAD_DATA(!iomap_inline_data_valid(iomap)))
return -EFSCORRUPTED;
+ trace_fuse_iomap_inline_read(inode, pos, count, iomap);
+
args.opcode = FUSE_READ;
args.nodeid = fi->nodeid;
args.in_numargs = 1;
@@ -497,6 +499,8 @@ static int fuse_iomap_inline_write(struct inode *inode, loff_t pos,
if (BAD_DATA(!iomap_inline_data_valid(iomap)))
return -EFSCORRUPTED;
+ trace_fuse_iomap_inline_write(inode, pos, count, iomap);
+
args.opcode = FUSE_WRITE;
args.nodeid = fi->nodeid;
args.in_numargs = 2;
@@ -558,6 +562,9 @@ static int fuse_iomap_set_inline(struct inode *inode, unsigned opflags,
return err;
}
+ trace_fuse_iomap_set_inline_iomap(inode, pos, count, iomap);
+ trace_fuse_iomap_set_inline_srcmap(inode, pos, count, srcmap);
+
return 0;
}
Powered by blists - more mailing lists