exfat: improve exfat_count_num_clusters

Since exfat_ent_get support cache buffer head, let's apply it to
exfat_count_num_clusters.

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Chi Zhiling 2026-01-14 20:12:39 +08:00 committed by Namjae Jeon
parent 5cf0288f0d
commit 06805f4c57

View File

@ -484,6 +484,7 @@ int exfat_count_num_clusters(struct super_block *sb,
unsigned int i, count;
unsigned int clu;
struct exfat_sb_info *sbi = EXFAT_SB(sb);
struct buffer_head *bh = NULL;
if (!p_chain->dir || p_chain->dir == EXFAT_EOF_CLUSTER) {
*ret_count = 0;
@ -499,12 +500,13 @@ int exfat_count_num_clusters(struct super_block *sb,
count = 0;
for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters; i++) {
count++;
if (exfat_ent_get(sb, clu, &clu, NULL))
if (exfat_ent_get(sb, clu, &clu, &bh))
return -EIO;
if (clu == EXFAT_EOF_CLUSTER)
break;
}
brelse(bh);
*ret_count = count;
/*