Re: [PATCH v2 4/6] iomap: correct the dirty length in page mkwrite

From: Zhang Yi
Date: Thu Aug 15 2024 - 22:19:44 EST


On 2024/8/15 13:59, Christoph Hellwig wrote:
> On Wed, Aug 14, 2024 at 03:49:41PM +0800, Zhang Yi wrote:
>> Sorry, this makes me confused. How does this could prevent setting
>> redundant dirty bits?
>>
>> Suppose we have a 3K regular file on a filesystem with 1K block size.
>> In iomap_page_mkwrite(), the iter.len is 3K, if the folio size is 4K,
>> folio_mark_dirty() will also mark all 4 bits of ifs dirty. And then,
>> if we expand this file size to 4K, and this will still lead to a hole
>> with dirty bit set but without any block allocated/reserved. Am I
>> missing something?
>
> No, we still need the ifs manipulation in the loop indeed. But
> the filemap_dirty_folio (and the not uptodate warning) can still
> move outside the iterator.
>
Yes, right, I misunderstood.

Thanks,
Yi.