]> git.baikalelectronics.ru Git - kernel.git/commit
erofs: get correct count for unmapped range in fscache mode
authorJingbo Xu <jefflexu@linux.alibaba.com>
Fri, 4 Nov 2022 05:40:28 +0000 (13:40 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Tue, 8 Nov 2022 06:46:30 +0000 (14:46 +0800)
commit57ac50d4ab2a62e647597b92f39e5b2d00c2742d
treecb957acb4f9ff55a3caea2ab1bc1e79e5c90555c
parenta66fc80ca15e2a9f44245f6a55d14b9516ffe42f
erofs: get correct count for unmapped range in fscache mode

For unmapped range, the returned map.m_llen is zero, and thus the
calculated count is unexpected zero.

Prior to the refactoring introduced by commit 87fc4e3c1311 ("erofs:
clean up .read_folio() and .readahead() in fscache mode"), only the
readahead routine suffers from this. With the refactoring of making
.read_folio() and .readahead() calling one common routine, both
read_folio and readahead have this issue now.

Fix this by calculating count separately in unmapped condition.

Fixes: d526976e286d ("erofs: implement fscache-based data readahead")
Fixes: 87fc4e3c1311 ("erofs: clean up .read_folio() and .readahead() in fscache mode")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20221104054028.52208-3-jefflexu@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/fscache.c