Re: [PATCH v4 9/9] ext4: protect WRITE_ZEROES written extents with orphan list

Zhang Yi <[email protected]>
Newsgroups dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-ext4
Message-ID <[email protected]>
On 7/24/2026 12:31 AM, Theodore Tso wrote:
> On Thu, Jul 23, 2026 at 11:29:44AM -0500, Zhang Yi wrote:
>> Therefore, I think the correct approach is to modify
>> ext4_convert_unwritten_extents() so that it returns the actual
>> conversion length, and only returns an error code when no conversion has
>> taken place at all. This way, ext4_alloc_file_blocks() can use the
>> returned conversion length to decide whether to add the orphan list
>> (within the same handle as the conversion operation).
>>
>> What do you think?
> 
> Yes, that makes sense.
> 
> I've checked the challers of ext4_alloc_file_blocks(), and at the
> moment, in the case where there is a partial allocation, we return the
> error, not the number of partially allocated files.  But given that
> the callers are doing fallocate() that seems to be fine.
> 
> I'd suggest we should explicit about documenting how
> ext4_alloc_file_blocks() will handle partial allocations before it
> runs into an problem, so it's helpful for future people who are making
> changes here.
> 

Sure, I'll add this document as well.

Thanks,
Yi.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.