Skip to content

Commit 8c6bdce

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
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>
1 parent 256694b commit 8c6bdce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/exfat/cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static unsigned int exfat_cache_lookup(struct inode *inode,
9292
spin_lock(&ei->cache_lru_lock);
9393
list_for_each_entry(p, &ei->cache_lru, cache_list) {
9494
/* Find the cache of "fclus" or nearest cache. */
95-
if (p->fcluster <= fclus && hit->fcluster < p->fcluster) {
95+
if (p->fcluster <= fclus && hit->fcluster <= p->fcluster) {
9696
hit = p;
9797
if (hit->fcluster + hit->nr_contig < fclus) {
9898
offset = hit->nr_contig;
@@ -259,7 +259,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int cluster,
259259
if (cluster == 0 || *dclus == EXFAT_EOF_CLUSTER)
260260
return 0;
261261

262-
cache_init(&cid, EXFAT_EOF_CLUSTER, EXFAT_EOF_CLUSTER);
262+
cache_init(&cid, fclus, *dclus);
263263
exfat_cache_lookup(inode, cluster, &cid, &fclus, dclus);
264264

265265
if (fclus == cluster)

0 commit comments

Comments
 (0)