Commit 06805f4c authored by Chi Zhiling's avatar Chi Zhiling Committed by Namjae Jeon
Browse files

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: default avatarChi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: default avatarYuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
parent 5cf0288f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;

	/*