]> git.ipfire.org Git - thirdparty/linux.git/commit
exfat: return the start of next cache in exfat_cache_lookup
authorChi Zhiling <chizhiling@kylinos.cn>
Wed, 14 Jan 2026 12:17:58 +0000 (20:17 +0800)
committerNamjae Jeon <linkinjeon@kernel.org>
Thu, 12 Feb 2026 12:21:51 +0000 (21:21 +0900)
commit9fb696a10a6735a15a0d2b4370419702e99818d0
tree5adba4a4673a00368b00e5c3e4f2e43b561805e7
parent8c6bdce0e91425ca5e84f52819b7cf0e024fb129
exfat: return the start of next cache in exfat_cache_lookup

Change exfat_cache_lookup to return the cluster number of the last
cluster before the next cache (i.e., the end of the current cache range)
or the given 'end' if there is no next cache. This allows the caller to
know whether the next cluster after the current cache is cached.

The function signature is changed to accept an 'end' parameter, which
is the upper bound of the search range. The function now stops early
if it finds a cache that starts within the current cache's tail, meaning
caches are contiguous. The return value is the cluster number at which
the next cache starts (minus one) or the original 'end' if no next cache
is found.

The new behavior is illustrated as follows:

cache:  [ccccccc-------ccccccccc]
search: [..................]
return:               ^

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/cache.c