]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
exfat: improve exfat_count_num_clusters
authorChi Zhiling <chizhiling@kylinos.cn>
Wed, 14 Jan 2026 12:12:39 +0000 (20:12 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 12 Feb 2026 12:21:48 +0000 (21:21 +0900)
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>
fs/exfat/fatent.c

index 679688cfea015e37e2bb8998b3c781b3171ccf48..f060eab2f2f2a129fcb21535f03dd0366012e17c 100644 (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;
 
        /*