From: Chi Zhiling <chizhiling@163.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: exfat@lists.linux.dev, linux-kernel@vger.kernel.org,
Sungjong Seo <sj1557.seo@samsung.com>,
Yuezhang Mo <yuezhang.mo@sony.com>,
Chi Zhiling <chizhiling@kylinos.cn>
Subject: Re: [RFC PATCH v1 6/6] exfat: take s_lock in read mode for iomap mapping paths
Date: Thu, 27 Aug 2026 10:21:59 +0800 [thread overview]
Message-ID: <de355170-d57d-4247-93ba-521080ca30eb@163.com> (raw)
In-Reply-To: <CAKYAXd_MxctBGgP6_daddk1q9Dwr0ZMAQchXqvEZME_Yo6xSuA@mail.gmail.com>
On 8/27/26 9:08 AM, Namjae Jeon wrote:
>> @@ -68,7 +68,7 @@ static int __exfat_iomap_begin(struct inode *inode, loff_t offset, loff_t length
>> num_clusters = exfat_bytes_to_cluster_round_up(sbi,
>> offset + length) - exfat_bytes_to_cluster(sbi, offset);
>>
>> - down_write(&sbi->s_lock);
>> + down_read(&sbi->s_lock);
> If may_alloc is true, Should we use down_write() ?
IMO, there is no need for down_write(); the block mapping of an inode is
protected by the inode lock, not s_lock. see exfat_fallocate(), where we
don't hold s_lock.
If may_alloc is true, we need to allocate clusters and append them to
the file's FAT chain. The allocation is protected by bitmap_lock, while
the FAT chain is protected by the inode lock, since we hold the inode
write lock in exfat_file_write_iter(), exfat_fallocate() and
exfat_truncate(), there is no race when modifying the FAT chain.
Besides, I'm trying to remove s_lock in the next version and am
considering adding a per-inode lock to exfat_inode_info, since the inode
lock has a relatively large scope.
Thanks,
>
>> iomap->bdev = inode->i_sb->s_bdev;
>> iomap->offset = offset;
>>
>> @@ -135,7 +135,7 @@ static int __exfat_iomap_begin(struct inode *inode, loff_t offset, loff_t length
>>
>> iomap->flags |= IOMAP_F_MERGED;
>> out:
>> - up_write(&sbi->s_lock);
>> + up_read(&sbi->s_lock);
>> return err;
>> }
next prev parent reply other threads:[~2026-08-27 2:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:05 [RFC PATCH 0/6] " Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 1/6] exfat: remove dead hint_bmap updates in I/O and truncate paths Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 2/6] exfat: take bitmap_lock at the start of exfat_alloc_cluster() Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 3/6] exfat: use atomic bit ops for volume dirty flag Chi Zhiling
2026-08-27 1:03 ` Namjae Jeon
2026-08-27 2:08 ` Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 4/6] exfat: lock FAT2 buffer while copying mirrored FAT entries Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 5/6] exfat: convert s_lock mutex to rw_semaphore using write lock Chi Zhiling
2026-08-21 10:05 ` [RFC PATCH v1 6/6] exfat: take s_lock in read mode for iomap mapping paths Chi Zhiling
2026-08-27 1:08 ` Namjae Jeon
2026-08-27 2:21 ` Chi Zhiling [this message]
2026-08-27 6:54 ` Namjae Jeon
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=de355170-d57d-4247-93ba-521080ca30eb@163.com \
--to=chizhiling@163.com \
--cc=chizhiling@kylinos.cn \
--cc=exfat@lists.linux.dev \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sj1557.seo@samsung.com \
--cc=yuezhang.mo@sony.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®