Skip to content

Commit 6d0b7f8

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
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>
1 parent afb6ffa commit 6d0b7f8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/exfat/cache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
238238
{
239239
struct super_block *sb = inode->i_sb;
240240
struct exfat_inode_info *ei = EXFAT_I(inode);
241+
struct buffer_head *bh = NULL;
241242
struct exfat_cache_id cid;
242243
unsigned int content, fclus;
243244

@@ -265,7 +266,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
265266
return 0;
266267

267268
while (fclus < cluster) {
268-
if (exfat_ent_get(sb, *dclus, &content, NULL))
269+
if (exfat_ent_get(sb, *dclus, &content, &bh))
269270
return -EIO;
270271

271272
*last_dclus = *dclus;
@@ -279,6 +280,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
279280
cache_init(&cid, fclus, *dclus);
280281
}
281282

283+
brelse(bh);
282284
exfat_cache_add(inode, &cid);
283285
return 0;
284286
}

0 commit comments

Comments
 (0)