Re: [PATCH -next v2 03/22] ext4: only order data when partially block truncating down

From: Zhang Yi

Date: Wed Feb 11 2026 - 08:39:10 EST


On 2/11/2026 7:42 PM, Jan Kara wrote:
On Wed 11-02-26 00:11:51, Zhang Yi wrote:
On 2/10/2026 10:07 PM, Jan Kara wrote:
On Tue 10-02-26 20:02:51, Zhang Yi wrote:
On 2/9/2026 4:28 PM, Zhang Yi wrote:
On 2/6/2026 11:35 PM, Jan Kara wrote:
On Fri 06-02-26 19:09:53, Zhang Yi wrote:
On 2/5/2026 11:05 PM, Jan Kara wrote:
So how about the following:

Let me see, please correct me if my understanding is wrong, ana there are
also some points I don't get.

We expand our io_end processing with the
ability to journal i_disksize updates after page writeback completes. Then

While I was extending the end_io path of buffered_head to support updating
i_disksize, I found another problem that requires discussion.

Supporting updates to i_disksize in end_io requires starting a handle, which
conflicts with the data=ordered mode because folios written back through the
journal process cannot initiate any handles; otherwise, this may lead to a
deadlock. This limitation does not affect the iomap path, as it does not use
the data=ordered mode at all. However, in the buffered_head path, online
defragmentation (if this change works, it should be the last user) still uses
the data=ordered mode.

Right and my intention was to use reserved handle for the i_disksize update
similarly as we currently use reserved handle for unwritten extent
conversion after page writeback is done.

IIUC, reserved handle only works for ext4_jbd2_inode_add_wait(). It doesn't
work for ext4_jbd2_inode_add_write() because writebacks triggered by the
journaling process cannot initiate any handles, including reserved handles.

Yes, we cannot start any new handles (reserved or not) from writeback
happening from jbd2 thread. I didn't think about that case so good catch.
So we can either do this once we have delay map and get rid of data=ordered
mode altogether or, as you write below, we have to submit the tail folios
proactively during truncate up / append write - but I don't like this
option too much because workloads appending to file by small chunks (say a
few bytes) will get a large performance hit from this.


Yeah, so let's keep the buffered_head path as it is now, and only modify the iomap path to support the new post-EOF block zeroing solution for truncate up and append write as discussed.

Cheers,
Yi.

So, I guess you're suggesting that within mext_move_extent(), we should
proactively submit the blocks after swapping, and then call
ext4_jbd2_inode_add_wait() to replace the existing
ext4_jbd2_inode_add_write(). Is that correct?

Honza