From: Chi Zhiling <chizhiling@163.com>
To: "Yuezhang.Mo@sony.com" <Yuezhang.Mo@sony.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linkinjeon@kernel.org" <linkinjeon@kernel.org>,
"sj1557.seo@samsung.com" <sj1557.seo@samsung.com>,
"dxdt@dev.snart.me" <dxdt@dev.snart.me>,
"exfat@lists.linux.dev" <exfat@lists.linux.dev>
Subject: Re: [PATCH v1] exfat: mark straddling folio RO for 4K block size
Date: Fri, 9 Oct 2026 14:12:35 +0800 [thread overview]
Message-ID: <c4cecbd4-9f4b-4b07-94fe-20e4abfdaf0b@163.com> (raw)
In-Reply-To: <PUZPR04MB6316DF5C2179DCD7B4200A6A81922@PUZPR04MB6316.apcprd04.prod.outlook.com>
On 10/9/26 10:46 AM, Yuezhang.Mo@sony.com 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;
>
>>
>> We should set the folio containing valid_size to RO whenever valid_size
>> != i_size and valid_size is not page-aligned, regardless of the block size.
>
> We should set the folio containing oldsize to RO, rather than valid_size.
> This is because, when the folio containing oldsize was first set to RW, oldsize
> constrained valid_size, after the file size is subsequently expanded, that
> constraint changes, necessitating a re-setting of valid_size.
Yes, using oldsize is better.
next prev parent reply other threads:[~2026-10-09 6:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 10:43 Yuezhang Mo
2026-10-01 5:05 ` Chi Zhiling
2026-10-09 2:46 ` Yuezhang.Mo
2026-10-09 6:12 ` Chi Zhiling [this message]
2026-10-09 7:57 ` Yuezhang.Mo
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=c4cecbd4-9f4b-4b07-94fe-20e4abfdaf0b@163.com \
--to=chizhiling@163.com \
--cc=Yuezhang.Mo@sony.com \
--cc=dxdt@dev.snart.me \
--cc=exfat@lists.linux.dev \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.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
all inboxes | Powered by JetHome®