Skip to content

Commit 5e205c4

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
exfat: improve exfat_find_last_cluster
Since exfat_ent_get support cache buffer head, let's apply it to exfat_find_last_cluster. 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 06805f4 commit 5e205c4

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
@@ -296,6 +296,7 @@ int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain)
296296
int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
297297
unsigned int *ret_clu)
298298
{
299+
struct buffer_head *bh = NULL;
299300
unsigned int clu, next;
300301
unsigned int count = 0;
301302

@@ -308,10 +309,11 @@ int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
308309
do {
309310
count++;
310311
clu = next;
311-
if (exfat_ent_get(sb, clu, &next, NULL))
312+
if (exfat_ent_get(sb, clu, &next, &bh))
312313
return -EIO;
313314
} while (next != EXFAT_EOF_CLUSTER && count <= p_chain->size);
314315

316+
brelse(bh);
315317
if (p_chain->size != count) {
316318
exfat_fs_error(sb,
317319
"bogus directory size (clus : ondisk(%d) != counted(%d))",

0 commit comments

Comments
 (0)