Re: [PATCH v1 3/9] exfat: reuse cache to improve exfat_get_cluster
From: Yuezhang.Mo@xxxxxxxx
Date: Tue Dec 30 2025 - 04:23:13 EST
> - if (exfat_ent_get(sb, *dclus, &content, NULL))
> - return -EIO;
> + if (exfat_ent_get(sb, *dclus, &content, &bh))
> + goto err;
As you commented, the buffer_head needs release if no error return.
Here, an error was returned, buffer_head had been released.
>
> *last_dclus = *dclus;
> *dclus = content;
> @@ -299,7 +300,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
> exfat_fs_error(sb,
> "invalid cluster chain (i_pos %u, last_clus 0x%08x is EOF)",
> *fclus, (*last_dclus));
> - return -EIO;
> + goto err;
> }
>
> break;
> @@ -309,6 +310,10 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
> cache_init(&cid, *fclus, *dclus);
> }
>
> + brelse(bh);
> exfat_cache_add(inode, &cid);
> return 0;
> +err:
> + brelse(bh);
> + return -EIO;
> }