Re: [PATCH v1] exfat: mark straddling folio RO for 4K block size
From: Yuezhang.Mo@xxxxxxxx
Date: Fri Oct 09 2026 - 03:58:51 EST
> On 10/9/26 10:46 AM, Yuezhang.Mo@xxxxxxxx wrote:
>>>> #include "exfat_raw.h"
>>>> #include "exfat_fs.h"
>>>> @@ -91,6 +92,20 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
>>>> */
>>>> pagecache_isize_extended(inode, oldsize, inode->i_size);
>>>>
>>>> + if (i_blocksize(inode) >= PAGE_SIZE && (oldsize & (PAGE_SIZE - 1))) {
>>>> + struct folio *folio;
>>>> +
>>>> + folio = filemap_lock_folio(inode->i_mapping,
>>>> + oldsize >> PAGE_SHIFT);
>>>> + if (!IS_ERR(folio)) {
>>>> + if (folio_mkclean(folio))
>>>> + folio_mark_dirty(folio);
>>>> +
>>>> + folio_unlock(folio);
>>>> + folio_put(folio);
>>>> + }
>>>> + }
>>>
>>> I think fixing this issue specifically for the block size = 4K case may
>>> not be thorough enough, because pagecache_isize_extended() may also fail
>>> to work when the block size is smaller than 4K.
>>
>> What condition might pagecache_isize_extended() fail to work when the block
>> size is smaller than 4K?
>
> I didn’t explain this clearly. What I meant is that the issue is not the
> block size, but the fact that VDL in exFAT is not block-aligned.
> pagecache_isize_extended is designed to work at block granularity, so it
> won’t work either if oldsize and newsize fall within the same block.
>
> /* Page straddling @from will not have any hole block created? */
> rounded_from = round_up(from, bsize);
> if (to <= rounded_from || !(rounded_from & (PAGE_SIZE - 1)))
> return;
I got it, thank you for the explanation.