Skip to content

Commit 936aa70

Browse files
Chunhai Guohsiangkao
authored andcommitted
erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
z_erofs_pcluster_readmore() may take a long time to loop when the page offset is large enough, which is unnecessary should be prevented. For example, when the following case is encountered, it will loop 4691368 times, taking about 27 seconds: - offset = 19217289215 - inode_size = 1442672 Signed-off-by: Chunhai Guo <[email protected]> Fixes: 3862929 ("erofs: introduce readmore decompression strategy") Reviewed-by: Gao Xiang <[email protected]> Reviewed-by: Yue Hu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent c553976 commit 936aa70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/erofs/zdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
18411841
}
18421842

18431843
cur = map->m_la + map->m_llen - 1;
1844-
while (cur >= end) {
1844+
while ((cur >= end) && (cur < i_size_read(inode))) {
18451845
pgoff_t index = cur >> PAGE_SHIFT;
18461846
struct page *page;
18471847

0 commit comments

Comments
 (0)