[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260108075938.360282-1-chizhiling@163.com>
Date: Thu, 8 Jan 2026 15:59:36 +0800
From: Chi Zhiling <chizhiling@....com>
To: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Namjae Jeon <linkinjeon@...nel.org>,
Sungjong Seo <sj1557.seo@...sung.com>,
Yuezhang Mo <yuezhang.mo@...y.com>,
Chi Zhiling <chizhiling@...inos.cn>
Subject: [PATCH v2 11/13] exfat: tweak cluster cache to support zero offset
From: Chi Zhiling <chizhiling@...inos.cn>
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. modify exfat_cache_lookup() to find clusters with offset zero.
2. allow clusters with zero offset to be cached.
Signed-off-by: Chi Zhiling <chizhiling@...inos.cn>
---
fs/exfat/cache.c | 4 ++--
1 file 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)
--
2.43.0
Powered by blists - more mailing lists