From: Pankaj Raghav <pankaj.raghav@linux.dev>
To: Zhang Yi <yi.zhang@huaweicloud.com>, Christoph Hellwig <hch@lst.de>
Cc: Pankaj Raghav <p.raghav@samsung.com>,
zlang@redhat.com, fstests@vger.kernel.org, djwong@kernel.org,
yi.zhang@huawei.com, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] generic/795: add unaligned boundary test cases for WRITE_ZEROES
Date: Wed, 8 Jul 2026 15:21:06 +0200 [thread overview]
Message-ID: <aafea4b8-8e52-421f-92d6-e15bd7767168@linux.dev> (raw)
In-Reply-To: <e52af771-da66-48e3-a6a0-b0c31dc8b3a9@huaweicloud.com>
On 7/7/26 08:38, Zhang Yi wrote:
> On 7/7/2026 1:10 PM, Christoph Hellwig wrote:
>> On Tue, Jul 07, 2026 at 11:08:39AM +0800, Zhang Yi wrote:
>>>> +# WRITE_ZEROES must leave the whole requested range backed by *written*
>>>> +# (zeroed) extents while preserving the out-of-range bytes of the partial
>>>> +# boundary units. The possible scenarios are: written_edges, hole_edges,
>>>> +# unwritten_edges and delalloc_edges.
>>>
>>> unwritten_edges needs to distinguish between dirty and clean scenarios.
>>> The expected result for clean should be tmp.zero, while the expected
>>> result for dirty should be tmp.pattern.
>>
>> Does it? I'd expect everything in the range to be zeroed, and everything
>> outside to be left alone, as the dirty state is just an imlementation
>> detail not visible to the user.
>
> Yes, although this detail is not perceptible to the user, the final
> results of these two scenarios are different.
>
> For clean unwritten extents, the portion beyond the range up to the
> aligned block boundary should be zeroed; otherwise, stale data may be
> exposed after unwritten-to-written conversion. So the result should
> be tmp.zero.
>
> For dirty unwritten extents, all data outside the inode boundary
> should be left untouched, so the result should be tmp.pattern.
>
>> Similar to other falloc operations,
>> I'd expect the file system to write back any boundary block first
>> to make the dirty state difference moot.
>>
>
> In fact, in ext4, for dirty extents (including both dirty delalloc and
> dirty unwritten extents), they are not written back first. Instead, the
> unaligned boundary blocks are zeroed out directly, followed by a
> synchronous write-back before the syscall returns, ensuring the extents
> are converted to the written state. This point differs from the behavior
> of XFS.
>
I had a similar question as Christoph. But I will include dirty unwritten
test case as well, as ext4 impl may slightly differ.
Thanks for the point about the FIEMAP. I will change it to use filefrag.
I will send the patches soon.
Btw, I tested ext4 and it failed the test. I assume there is a fix on the way for ext4? And did you
also test this for bigalloc configuration? I ran into some issues with bigrtalloc (alloc size >
block size). I am wondering if you hit a similar issue in ext4 for biglloc configs.
--
Pankaj
next prev parent reply other threads:[~2026-07-08 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 12:54 [PATCH] generic/795: add unaligned boundary test cases for WRITE_ZEROES Pankaj Raghav
2026-07-07 3:08 ` Zhang Yi
2026-07-07 5:10 ` Christoph Hellwig
2026-07-07 6:38 ` Zhang Yi
2026-07-08 13:21 ` Pankaj Raghav [this message]
2026-07-09 2:32 ` Zhang Yi
2026-07-09 7:55 ` Pankaj Raghav
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=aafea4b8-8e52-421f-92d6-e15bd7767168@linux.dev \
--to=pankaj.raghav@linux.dev \
--cc=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
--cc=p.raghav@samsung.com \
--cc=yi.zhang@huawei.com \
--cc=yi.zhang@huaweicloud.com \
--cc=zlang@redhat.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