From: Zhang Yi <yi.zhang@huaweicloud.com>
To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, libaokun@linux.alibaba.com,
jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com,
djwong@kernel.org, hch@infradead.org, yi.zhang@huawei.com,
yi.zhang@huaweicloud.com, yizhang089@gmail.com,
chengzhihao1@huawei.com, yangerkun@huawei.com,
wangkefeng.wang@huawei.com, yukuai@fnnas.com
Subject: [PATCH v6 29/31] ext4: add tracepoints for EOF block zeroing and disksize-grow I/O
Date: Thu, 3 Sep 2026 20:40:15 +0800 [thread overview]
Message-ID: <20260903124017.2325538-1-yi.zhang@huaweicloud.com> (raw)
In-Reply-To: <20260903123543.2302999-1-yi.zhang@huaweicloud.com>
From: Zhang Yi <yi.zhang@huawei.com>
Add tracepoints to track the disksize-grow-pending lifecycle in the
writeback path and the block-zero-EOF entry point:
- ext4_iomap_wb_disksize_pending_submit: ioend is marked as
DISKSIZE_GROW_IO in ext4_iomap_writeback_submit().
- ext4_iomap_wb_disksize_pending_complete: ioend of type
DISKSIZE_GROW_IO completes in ext4_iomap_finish_ioend().
- ext4_iomap_wb_disksize_pending_wait: ioend worker waits for the
pending zeroed EOF block to complete.
- ext4_iomap_wb_update_disksize: i_disksize is advanced in
ext4_iomap_wb_update_disksize, including the new value and
whether the update is a disksize-grow completion.
- ext4_block_zero_eof: ext4_block_zero_eof is called with the range
and zeroing outcome, capturing the producer-side entry point.
Together with the previous mark/clear/wait tracepoints, these cover the
full lifetime of the disksize-grow-pending state.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
fs/ext4/inode.c | 3 +
fs/ext4/page-io.c | 11 ++-
include/trace/events/ext4.h | 129 ++++++++++++++++++++++++++++++++++++
3 files changed, 142 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d53de72624bb..7454867ac8bd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4406,6 +4406,8 @@ static int ext4_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
round_down(ioend->io_offset, blocksize) <= pstart &&
round_up(ioend->io_offset + ioend->io_size, blocksize) >=
pstart + plen) {
+ trace_ext4_iomap_wb_disksize_pending_submit(inode,
+ ioend->io_offset, ioend->io_size);
ioend->io_bio.bi_end_io = ext4_iomap_end_bio;
ioend->io_private = (void *)EXT4_IOMAP_IOEND_DISKSIZE_GROW_IO;
}
@@ -5011,6 +5013,7 @@ int ext4_block_zero_eof(struct inode *inode, loff_t from, loff_t end)
return err;
}
+ trace_ext4_block_zero_eof(inode, from, length, did_zero, zero_written);
return 0;
}
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 4f1176b9332f..734d856a6d47 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -31,6 +31,8 @@
#include "xattr.h"
#include "acl.h"
+#include <trace/events/ext4.h>
+
static struct kmem_cache *io_end_cachep;
static struct kmem_cache *io_end_vec_cachep;
@@ -574,6 +576,7 @@ static void ext4_iomap_wb_disksize_pending_wait(struct inode *inode,
if (!plen || pos < pstart + plen)
return;
+ trace_ext4_iomap_wb_disksize_pending_wait(inode, pos, size);
ext4_iomap_wait_disksize_pending(inode);
}
@@ -617,8 +620,11 @@ static int ext4_iomap_wb_update_disksize(handle_t *handle, struct inode *inode,
* after the data has been persisted.
*/
new_disksize = is_disksize_grow ? i_size : min(end, i_size);
- if (new_disksize > ei->i_disksize)
+ if (new_disksize > ei->i_disksize) {
+ trace_ext4_iomap_wb_update_disksize(inode, end, i_size,
+ ei->i_disksize, new_disksize, is_disksize_grow);
WRITE_ONCE(ei->i_disksize, new_disksize);
+ }
up_write(&ei->i_data_sem);
ret = ext4_mark_inode_dirty(handle, inode);
if (ret)
@@ -641,6 +647,9 @@ static void ext4_iomap_finish_ioend(struct iomap_ioend *ioend)
int ret, err;
ret = blk_status_to_errno(ioend->io_bio.bi_status);
+ if (is_disksize_grow)
+ trace_ext4_iomap_wb_disksize_pending_complete(ioend->io_inode,
+ ioend->io_offset, ioend->io_size, ret);
if (unlikely(ret)) {
if (test_opt(sb, DATA_ERR_ABORT) && !ext4_emergency_state(sb))
jbd2_journal_abort(EXT4_SB(sb)->s_journal, ret);
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6bd0849c2f09..74d09a2a58cc 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -3235,6 +3235,135 @@ DEFINE_EVENT(ext4_iomap_disksize_pending, ext4_iomap_wait_disksize_pending,
TP_ARGS(inode)
);
+/* disksize pending I/O tracepoints for iomap Buffered I/O path */
+DECLARE_EVENT_CLASS(ext4_iomap_wb_disksize_pending,
+ TP_PROTO(struct inode *inode, loff_t io_offset, size_t io_size),
+ TP_ARGS(inode, io_offset, io_size),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, ino)
+ __field(loff_t, io_offset)
+ __field(size_t, io_size)
+ __field(loff_t, i_size)
+ __field(loff_t, i_disksize)
+ ),
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->io_offset = io_offset;
+ __entry->io_size = io_size;
+ __entry->i_size = i_size_read(inode);
+ __entry->i_disksize = READ_ONCE(EXT4_I(inode)->i_disksize);
+ ),
+ TP_printk("dev %d:%d ino %llu io_offset %lld io_size %zu i_size %lld i_disksize %lld",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->ino, __entry->io_offset, __entry->io_size,
+ __entry->i_size, __entry->i_disksize)
+);
+
+DEFINE_EVENT(ext4_iomap_wb_disksize_pending,
+ ext4_iomap_wb_disksize_pending_submit,
+ TP_PROTO(struct inode *inode, loff_t io_offset, size_t io_size),
+ TP_ARGS(inode, io_offset, io_size)
+);
+
+DEFINE_EVENT(ext4_iomap_wb_disksize_pending,
+ ext4_iomap_wb_disksize_pending_wait,
+ TP_PROTO(struct inode *inode, loff_t io_offset, size_t io_size),
+ TP_ARGS(inode, io_offset, io_size)
+);
+
+TRACE_EVENT(ext4_iomap_wb_disksize_pending_complete,
+ TP_PROTO(struct inode *inode, loff_t io_offset, size_t io_size,
+ int ret),
+ TP_ARGS(inode, io_offset, io_size, ret),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, ino)
+ __field(loff_t, io_offset)
+ __field(size_t, io_size)
+ __field(loff_t, i_size)
+ __field(loff_t, i_disksize)
+ __field(int, ret)
+ ),
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->io_offset = io_offset;
+ __entry->io_size = io_size;
+ __entry->i_size = i_size_read(inode);
+ __entry->i_disksize = READ_ONCE(EXT4_I(inode)->i_disksize);
+ __entry->ret = ret;
+ ),
+ TP_printk("dev %d:%d ino %llu io_offset %lld io_size %zu ret %d i_size %lld i_disksize %lld",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->ino, __entry->io_offset, __entry->io_size,
+ __entry->ret, __entry->i_size, __entry->i_disksize)
+);
+
+/* i_disksize update tracepoint */
+TRACE_EVENT(ext4_iomap_wb_update_disksize,
+ TP_PROTO(struct inode *inode, loff_t end, loff_t i_size,
+ loff_t i_disksize, loff_t new_disksize,
+ bool is_disksize_grow),
+ TP_ARGS(inode, end, i_size, i_disksize, new_disksize,
+ is_disksize_grow),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, ino)
+ __field(loff_t, end)
+ __field(loff_t, i_size)
+ __field(loff_t, i_disksize)
+ __field(loff_t, new_disksize)
+ __field(bool, is_disksize_grow)
+ ),
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->end = end;
+ __entry->i_size = i_size;
+ __entry->i_disksize = i_disksize;
+ __entry->new_disksize = new_disksize;
+ __entry->is_disksize_grow = is_disksize_grow;
+ ),
+ TP_printk("dev %d:%d ino %llu end %lld i_size %lld i_disksize %lld new_disksize %lld is_disksize_grow %d",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ __entry->ino, __entry->end, __entry->i_size,
+ __entry->i_disksize, __entry->new_disksize,
+ __entry->is_disksize_grow)
+);
+
+/* Block zero EOF tracepoint */
+TRACE_EVENT(ext4_block_zero_eof,
+ TP_PROTO(struct inode *inode, loff_t from, loff_t length,
+ bool did_zero, bool zero_written),
+ TP_ARGS(inode, from, length, did_zero, zero_written),
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u64, ino)
+ __field(loff_t, from)
+ __field(loff_t, length)
+ __field(loff_t, i_size)
+ __field(loff_t, i_disksize)
+ __field(bool, did_zero)
+ __field(bool, zero_written)
+ ),
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->from = from;
+ __entry->length = length;
+ __entry->i_size = inode->i_size;
+ __entry->i_disksize = READ_ONCE(EXT4_I(inode)->i_disksize);
+ __entry->did_zero = did_zero;
+ __entry->zero_written = zero_written;
+ ),
+ TP_printk("dev %d:%d ino %llu zero EOF from %lld length %lld i_size %lld i_disksize %lld did_zero %d zero_written %d",
+ MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
+ __entry->from, __entry->length, __entry->i_size,
+ __entry->i_disksize, __entry->did_zero, __entry->zero_written)
+);
+
#endif /* _TRACE_EXT4_H */
/* This part must be outside protection */
--
2.52.0
next prev parent reply other threads:[~2026-09-03 12:47 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 12:35 [PATCH v6 00/31] ext4: use iomap for regular file's buffered I/O path Zhang Yi
2026-09-03 12:35 ` [PATCH v6 01/31] ext4: simplify size updating in ext4_setattr() Zhang Yi
2026-09-03 12:56 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 02/31] ext4: factor out ext4_truncate_[up|down]() Zhang Yi
2026-09-03 13:09 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 03/31] ext4: skip ordered I/O wait when zeroing beyond i_disksize block Zhang Yi
2026-09-03 13:14 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 04/31] ext4: set EXT4_MAP_NEW flag for delayed allocated blocks Zhang Yi
2026-09-03 12:54 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 05/31] ext4: recheck extent status tree before block allocation Zhang Yi
2026-09-03 13:02 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 06/31] ext4: fix orig_mlen initialization in ext4_map_blocks() Zhang Yi
2026-09-03 12:55 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 07/31] ext4: allow ext4_map_blocks() to start its own transaction handle Zhang Yi
2026-09-03 13:02 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 08/31] ext4: avoid unnecessary transaction in ext4_map_blocks() for unwritten extents Zhang Yi
2026-09-03 13:06 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 09/31] ext4: skip block allocation for holes in the data submission path Zhang Yi
2026-09-03 13:46 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 10/31] ext4: add iomap address space operations for buffered I/O Zhang Yi
2026-09-03 12:57 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 11/31] ext4: implement buffered read path using iomap Zhang Yi
2026-09-03 13:12 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 12/31] ext4: pass out extent seq counter when mapping da blocks Zhang Yi
2026-09-03 13:05 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 13/31] ext4: do not use data=ordered mode for inodes using buffered iomap path Zhang Yi
2026-09-03 13:13 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 14/31] ext4: implement buffered write path using iomap Zhang Yi
2026-09-03 13:23 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 15/31] ext4: implement writeback " Zhang Yi
2026-09-03 13:36 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 16/31] ext4: implement mmap " Zhang Yi
2026-09-03 13:29 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 17/31] ext4: implement partial block zero range " Zhang Yi
2026-09-03 13:29 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 18/31] ext4: drain writeback before removing extents on the iomap path Zhang Yi
2026-09-03 13:19 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 19/31] ext4: add block mapping tracepoints for iomap buffered I/O path Zhang Yi
2026-09-03 13:19 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 20/31] ext4: disable online defrag when inode using " Zhang Yi
2026-09-03 13:25 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 21/31] ext4: add EXT4_STATE_DISKSIZE_GROW_PENDING state bit and helpers Zhang Yi
2026-09-03 13:19 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 22/31] ext4: submit and wait for pending disksize-grow I/O on writeback Zhang Yi
2026-09-03 13:40 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 23/31] ext4: advance i_disksize to i_size upon disksize-grow I/O completion Zhang Yi
2026-09-03 13:31 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 24/31] ext4: defer i_disksize update while DISKSIZE_GROW_PENDING is set Zhang Yi
2026-09-03 13:38 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 25/31] ext4: submit and wait for disksize-grow I/O in fallocate paths Zhang Yi
2026-09-03 13:42 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 26/31] ext4: clear DISKSIZE_GROW_PENDING on truncate or error Zhang Yi
2026-09-03 13:46 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 27/31] ext4: set DISKSIZE_GROW_PENDING after zeroing unaligned EOF block Zhang Yi
2026-09-03 13:36 ` sashiko-bot
2026-09-03 12:35 ` [PATCH v6 28/31] ext4: add tracepoints for DISKSIZE_GROW_PENDING set, clear, and wait Zhang Yi
2026-09-03 13:34 ` sashiko-bot
2026-09-03 12:40 ` Zhang Yi [this message]
2026-09-03 13:32 ` [PATCH v6 29/31] ext4: add tracepoints for EOF block zeroing and disksize-grow I/O sashiko-bot
2026-09-03 12:40 ` [PATCH v6 30/31] ext4: partially enable iomap for the buffered I/O path of regular files Zhang Yi
2026-09-03 14:04 ` sashiko-bot
2026-09-03 12:40 ` [PATCH v6 31/31] ext4: introduce a mount option for iomap buffered I/O path Zhang Yi
2026-09-03 13:46 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903124017.2325538-1-yi.zhang@huaweicloud.com \
--to=yi.zhang@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=chengzhihao1@huawei.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=libaokun@linux.alibaba.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=tytso@mit.edu \
--cc=wangkefeng.wang@huawei.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yizhang089@gmail.com \
--cc=yukuai@fnnas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox