mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chi Zhiling <chizhiling@163.com>
To: "Yuezhang.Mo@sony.com" <Yuezhang.Mo@sony.com>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Matthew Wilcox <willy@infradead.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	Chi Zhiling <chizhiling@kylinos.cn>
Subject: Re: [RFC PATCH 6/7] exfat: introduce exfat_count_contig_clusters
Date: Sat, 29 Nov 2025 09:56:49 +0800	[thread overview]
Message-ID: <6f43ef92-a9a4-4c9b-b0e0-0bfa579ad3e4@163.com> (raw)
In-Reply-To: <PUZPR04MB6316A47C9E593BCF7EB550B881DCA@PUZPR04MB6316.apcprd04.prod.outlook.com>

On 11/28/25 19:09, Yuezhang.Mo@sony.com wrote:
>> From: Chi Zhiling <chizhiling@kylinos.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@kylinos.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


  reply	other threads:[~2025-11-29  2:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18  8:22 [RFC PATCH 0/7] Enable exfat_get_block to support obtaining multiple clusters Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 1/7] exfat: add cache option for __exfat_ent_get Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 2/7] exfat: support reuse buffer head for exfat_ent_get Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 3/7] exfat: reuse cache to improve exfat_get_cluster Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 4/7] exfat: improve exfat_count_num_clusters Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 5/7] exfat: improve exfat_find_last_cluster Chi Zhiling
2025-11-18  8:22 ` [RFC PATCH 6/7] exfat: introduce exfat_count_contig_clusters Chi Zhiling
2025-11-28 11:09   ` Yuezhang.Mo
2025-11-29  1:56     ` Chi Zhiling [this message]
2025-11-18  8:22 ` [RFC PATCH 7/7] exfat: get mutil-clusters in exfat_get_block Chi Zhiling
2025-11-28  2:48   ` Sungjong Seo
2025-11-28  6:18     ` Chi Zhiling
2025-12-04 12:18       ` Sungjong Seo
2025-12-05 11:36         ` Chi Zhiling
2025-11-21  1:17 ` [RFC PATCH 0/7] Enable exfat_get_block to support obtaining multiple clusters Namjae Jeon
2025-11-21  5:51   ` Chi Zhiling

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=6f43ef92-a9a4-4c9b-b0e0-0bfa579ad3e4@163.com \
    --to=chizhiling@163.com \
    --cc=Yuezhang.Mo@sony.com \
    --cc=brauner@kernel.org \
    --cc=chizhiling@kylinos.cn \
    --cc=jack@suse.cz \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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®