summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChi Zhiling <chizhiling@kylinos.cn>2026-01-14 15:17:47 +0300
committerNamjae Jeon <linkinjeon@kernel.org>2026-02-12 15:21:50 +0300
commit8c6bdce0e91425ca5e84f52819b7cf0e024fb129 (patch)
tree86a36b10e4dfd4ba0c88c5a05f537fb85ed1628f
parent256694b22d017edcc8a0ce82a8e40742b074d509 (diff)
downloadlinux-8c6bdce0e91425ca5e84f52819b7cf0e024fb129.tar.xz
exfat: tweak cluster cache to support zero offset
The current cache mechanism does not support reading clusters starting from a file offset of zero. This patch enables that feature in preparation for subsequent reads of contiguous clusters from offset zero. 1. support finding clusters with zero offset. 2. allow clusters with zero offset to be cached. Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-rw-r--r--fs/exfat/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/exfat/cache.c b/fs/exfat/cache.c
index 025b39b7a9ac..73147e153c2c 100644
--- a/fs/exfat/cache.c
+++ b/fs/exfat/cache.c
@@ -92,7 +92,7 @@ static unsigned int exfat_cache_lookup(struct inode *inode,
spin_lock(&ei->cache_lru_lock);
list_for_each_entry(p, &ei->cache_lru, cache_list) {
/* Find the cache of "fclus" or nearest cache. */
- if (p->fcluster <= fclus && hit->fcluster < p->fcluster) {
+ if (p->fcluster <= fclus && hit->fcluster <= p->fcluster) {
hit = p;
if (hit->fcluster + hit->nr_contig < fclus) {
offset = hit->nr_contig;
@@ -259,7 +259,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
if (cluster == 0 || *dclus == EXFAT_EOF_CLUSTER)
return 0;
- cache_init(&cid, EXFAT_EOF_CLUSTER, EXFAT_EOF_CLUSTER);
+ cache_init(&cid, fclus, *dclus);
exfat_cache_lookup(inode, cluster, &cid, &fclus, dclus);
if (fclus == cluster)