]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
erofs: fix up inplace decompression success rate
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 14 Oct 2022 06:49:15 +0000 (14:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 15:00:27 +0000 (00:00 +0900)
[ Upstream commit e7933278b442f97809b1ea84264586302bd08a03 ]

Partial decompression should be checked after updating length.
It's a new regression when introducing multi-reference pclusters.

Fixes: 2bfab9c0edac ("erofs: record the longest decompressed size in this round")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20221014064915.8103-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/erofs/zdata.c

index 6e663275aeb13bd0718e2723a73f1d835b92657a..c7511b4317763b6d6a2152d48f5827eec16439db 100644 (file)
@@ -765,13 +765,13 @@ retry:
        if (fe->pcl->pageofs_out != (map->m_la & ~PAGE_MASK))
                fe->pcl->multibases = true;
 
-       if ((map->m_flags & EROFS_MAP_FULL_MAPPED) &&
-           fe->pcl->length == map->m_llen)
-               fe->pcl->partial = false;
        if (fe->pcl->length < offset + end - map->m_la) {
                fe->pcl->length = offset + end - map->m_la;
                fe->pcl->pageofs_out = map->m_la & ~PAGE_MASK;
        }
+       if ((map->m_flags & EROFS_MAP_FULL_MAPPED) &&
+            fe->pcl->length == map->m_llen)
+               fe->pcl->partial = false;
 next_part:
        /* shorten the remaining extent to update progress */
        map->m_llen = offset + cur - map->m_la;