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

index f060eab2f2f2a129fcb21535f03dd0366012e17c..71ee16479c4315142f1d083d6dc642700396e3b6 100644 (file)
@@ -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))",