Skip to content

Commit 54943ab

Browse files
zhangyi089brauner
authored andcommitted
iomap: add pos and dirty_len into trace_iomap_writepage_map
Since commit fd07e0a ("iomap: map multiple blocks at a time"), we could map multi-blocks once a time, and the dirty_len indicates the expected map length, map_len won't large than it. The pos and dirty_len means the dirty range that should be mapped to write, add them into trace_iomap_writepage_map() could be more useful for debug. Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Link: https://lore.kernel.org/r/20240220115759.3445025-1-yi.zhang@huaweicloud.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 19871b5 commit 54943ab

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

fs/iomap/buffered-io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int iomap_writepage_map_blocks(struct iomap_writepage_ctx *wpc,
17761776
error = wpc->ops->map_blocks(wpc, inode, pos, dirty_len);
17771777
if (error)
17781778
break;
1779-
trace_iomap_writepage_map(inode, &wpc->iomap);
1779+
trace_iomap_writepage_map(inode, pos, dirty_len, &wpc->iomap);
17801780

17811781
map_len = min_t(u64, dirty_len,
17821782
wpc->iomap.offset + wpc->iomap.length - pos);

fs/iomap/trace.h

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,48 @@ DEFINE_EVENT(iomap_class, name, \
154154
TP_ARGS(inode, iomap))
155155
DEFINE_IOMAP_EVENT(iomap_iter_dstmap);
156156
DEFINE_IOMAP_EVENT(iomap_iter_srcmap);
157-
DEFINE_IOMAP_EVENT(iomap_writepage_map);
157+
158+
TRACE_EVENT(iomap_writepage_map,
159+
TP_PROTO(struct inode *inode, u64 pos, unsigned int dirty_len,
160+
struct iomap *iomap),
161+
TP_ARGS(inode, pos, dirty_len, iomap),
162+
TP_STRUCT__entry(
163+
__field(dev_t, dev)
164+
__field(u64, ino)
165+
__field(u64, pos)
166+
__field(u64, dirty_len)
167+
__field(u64, addr)
168+
__field(loff_t, offset)
169+
__field(u64, length)
170+
__field(u16, type)
171+
__field(u16, flags)
172+
__field(dev_t, bdev)
173+
),
174+
TP_fast_assign(
175+
__entry->dev = inode->i_sb->s_dev;
176+
__entry->ino = inode->i_ino;
177+
__entry->pos = pos;
178+
__entry->dirty_len = dirty_len;
179+
__entry->addr = iomap->addr;
180+
__entry->offset = iomap->offset;
181+
__entry->length = iomap->length;
182+
__entry->type = iomap->type;
183+
__entry->flags = iomap->flags;
184+
__entry->bdev = iomap->bdev ? iomap->bdev->bd_dev : 0;
185+
),
186+
TP_printk("dev %d:%d ino 0x%llx bdev %d:%d pos 0x%llx dirty len 0x%llx "
187+
"addr 0x%llx offset 0x%llx length 0x%llx type %s flags %s",
188+
MAJOR(__entry->dev), MINOR(__entry->dev),
189+
__entry->ino,
190+
MAJOR(__entry->bdev), MINOR(__entry->bdev),
191+
__entry->pos,
192+
__entry->dirty_len,
193+
__entry->addr,
194+
__entry->offset,
195+
__entry->length,
196+
__print_symbolic(__entry->type, IOMAP_TYPE_STRINGS),
197+
__print_flags(__entry->flags, "|", IOMAP_F_FLAGS_STRINGS))
198+
);
158199

159200
TRACE_EVENT(iomap_iter,
160201
TP_PROTO(struct iomap_iter *iter, const void *ops,

0 commit comments

Comments
 (0)