Commit 6d0b7f87 authored by Chi Zhiling's avatar Chi Zhiling Committed by Namjae Jeon
Browse files

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: 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 afb6ffa3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
}