exfat: reuse cache to improve exfat_get_cluster

Since exfat_ent_get supports cache buffer head, we can use this option to
reduce sb_bread calls when fetching consecutive entries.

Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Chi Zhiling 2026-01-14 20:12:44 +08:00 committed by Namjae Jeon
parent afb6ffa33d
commit 6d0b7f873b

View file

@ -238,6 +238,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
{
struct super_block *sb = inode->i_sb;
struct exfat_inode_info *ei = EXFAT_I(inode);
struct buffer_head *bh = NULL;
struct exfat_cache_id cid;
unsigned int content, fclus;
@ -265,7 +266,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
return 0;
while (fclus < cluster) {
if (exfat_ent_get(sb, *dclus, &content, NULL))
if (exfat_ent_get(sb, *dclus, &content, &bh))
return -EIO;
*last_dclus = *dclus;
@ -279,6 +280,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
cache_init(&cid, fclus, *dclus);
}
brelse(bh);
exfat_cache_add(inode, &cid);
return 0;
}