[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PUZPR04MB6316A47C9E593BCF7EB550B881DCA@PUZPR04MB6316.apcprd04.prod.outlook.com>
Date: Fri, 28 Nov 2025 11:09:01 +0000
From: "Yuezhang.Mo@...y.com" <Yuezhang.Mo@...y.com>
To: Chi Zhiling <chizhiling@....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
> 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.
> --
> 2.43.0
Powered by blists - more mailing lists