Skip to content

Commit 06805f4

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
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>
1 parent 5cf0288 commit 06805f4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/exfat/fatent.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ int exfat_count_num_clusters(struct super_block *sb,
484484
unsigned int i, count;
485485
unsigned int clu;
486486
struct exfat_sb_info *sbi = EXFAT_SB(sb);
487+
struct buffer_head *bh = NULL;
487488

488489
if (!p_chain->dir || p_chain->dir == EXFAT_EOF_CLUSTER) {
489490
*ret_count = 0;
@@ -499,12 +500,13 @@ int exfat_count_num_clusters(struct super_block *sb,
499500
count = 0;
500501
for (i = EXFAT_FIRST_CLUSTER; i < sbi->num_clusters; i++) {
501502
count++;
502-
if (exfat_ent_get(sb, clu, &clu, NULL))
503+
if (exfat_ent_get(sb, clu, &clu, &bh))
503504
return -EIO;
504505
if (clu == EXFAT_EOF_CLUSTER)
505506
break;
506507
}
507508

509+
brelse(bh);
508510
*ret_count = count;
509511

510512
/*

0 commit comments

Comments
 (0)