[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6f43ef92-a9a4-4c9b-b0e0-0bfa579ad3e4@163.com>
Date: Sat, 29 Nov 2025 09:56:49 +0800
From: Chi Zhiling <chizhiling@....com>
To: "Yuezhang.Mo@...y.com" <Yuezhang.Mo@...y.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Matthew Wilcox <willy@...radead.org>, Namjae Jeon <linkinjeon@...nel.org>,
Sungjong Seo <sj1557.seo@...sung.com>, Chi Zhiling <chizhiling@...inos.cn>
Subject: Re: [RFC PATCH 6/7] exfat: introduce exfat_count_contig_clusters
On 11/28/25 19:09, Yuezhang.Mo@...y.com wrote:
>> From: Chi Zhiling <chizhiling@...inos.cn>
>>
>> This patch introduces exfat_count_contig_clusters to obtain batch entries,
>> which is an infrastructure used to support iomap.
>>
>> Signed-off-by: Chi Zhiling <chizhiling@...inos.cn>
>> ---
>> fs/exfat/exfat_fs.h | 2 ++
>> fs/exfat/fatent.c | 33 +++++++++++++++++++++++++++++++++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
>> index d52893276e9a..421dd7c61cca 100644
>> --- a/fs/exfat/exfat_fs.h
>> +++ b/fs/exfat/exfat_fs.h
>> @@ -449,6 +449,8 @@ int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
>> unsigned int *ret_clu);
>> int exfat_count_num_clusters(struct super_block *sb,
>> struct exfat_chain *p_chain, unsigned int *ret_count);
>> +int exfat_count_contig_clusters(struct super_block *sb,
>> + struct exfat_chain *p_chain, unsigned int *ret_count);
>>
>> /* balloc.c */
>> int exfat_load_bitmap(struct super_block *sb);
>> diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
>> index d980d17176c2..9dcee9524155 100644
>> --- a/fs/exfat/fatent.c
>> +++ b/fs/exfat/fatent.c
>> @@ -524,3 +524,36 @@ int exfat_count_num_clusters(struct super_block *sb,
>>
>> return 0;
>> }
>> +
>> +int exfat_count_contig_clusters(struct super_block *sb,
>> + struct exfat_chain *p_chain, unsigned int *ret_count)
>> +{
>> + struct buffer_head *bh = NULL;
>> + unsigned int clu, next_clu;
>> + unsigned int count;
>> +
>> + if (!p_chain->dir || p_chain->dir == EXFAT_EOF_CLUSTER) {
>> + *ret_count = 0;
>> + return 0;
>> + }
>> +
>> + if (p_chain->flags == ALLOC_NO_FAT_CHAIN) {
>> + *ret_count = p_chain->size;
>> + return 0;
>> + }
>> +
>> + clu = p_chain->dir;
>> + for (count = 1; count < p_chain->size; count++) {
>> + if (exfat_ent_get(sb, clu, &next_clu, &bh))
>> + return -EIO;
>> + if (++clu != next_clu)
>> + break;
>> + }
>> +
>> + /* TODO: Update p_claim to help caller read ahead the next block */
>> +
>> + brelse(bh);
>> + *ret_count = count;
>> +
>> + return 0;
>> +}
>
> Hi Chi,
>
> The clusters traversed in exfat_get_cluster() are cached to
> ->cache_lru, but the clusters traversed in this function are
> not.
>
> I think we can implement this functionality in exfat_get_cluster()
> and cache the clusters.
Agreed, I will implement it in the next version.
Thanks,
>
>> --
>> 2.43.0
Powered by blists - more mailing lists