summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChi Zhiling <chizhiling@kylinos.cn>2026-01-14 15:12:40 +0300
committerNamjae Jeon <linkinjeon@kernel.org>2026-02-12 15:21:48 +0300
commit5e205c484b1feb3297f78351f3866cb60afe004b (patch)
tree166dd013571edd86f18397a43178114e009eca0b
parent06805f4c57840c6957b1c2064d3b453e66e943ab (diff)
downloadlinux-5e205c484b1feb3297f78351f3866cb60afe004b.tar.xz
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>
-rw-r--r--fs/exfat/fatent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index f060eab2f2f2..71ee16479c43 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -296,6 +296,7 @@ int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain)
int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
unsigned int *ret_clu)
{
+ struct buffer_head *bh = NULL;
unsigned int clu, next;
unsigned int count = 0;
@@ -308,10 +309,11 @@ int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
do {
count++;
clu = next;
- if (exfat_ent_get(sb, clu, &next, NULL))
+ if (exfat_ent_get(sb, clu, &next, &bh))
return -EIO;
} while (next != EXFAT_EOF_CLUSTER && count <= p_chain->size);
+ brelse(bh);
if (p_chain->size != count) {
exfat_fs_error(sb,
"bogus directory size (clus : ondisk(%d) != counted(%d))",