]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
exfat: reuse cache to improve exfat_get_cluster
authorChi Zhiling <chizhiling@kylinos.cn>
Wed, 14 Jan 2026 12:12:44 +0000 (20:12 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 12 Feb 2026 12:21:50 +0000 (21:21 +0900)
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>
fs/exfat/cache.c

index b806e7f5b00f61623a54a72401346522b19ea5a0..025b39b7a9acc0ecbef4f15f43041ed35d4c05af 100644 (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;
 }