Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp192948rwi; Fri, 14 Oct 2022 00:05:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ptITCAaqIxijra8SYTp8upMx6uDUE5n2T/x7sRcUg/gcAjNCRzZ4VDdPemFE/wDAIaEN/ X-Received: by 2002:a17:907:3f8b:b0:782:3668:3d26 with SMTP id hr11-20020a1709073f8b00b0078236683d26mr2489420ejc.85.1665731103010; Fri, 14 Oct 2022 00:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665731103; cv=none; d=google.com; s=arc-20160816; b=cXhuODW9zzI9mAorN5pHt+dqyDOZWBKtzL4WH0O6zlYmZ7A/wp13+FfrSu4LlCeGct aje5Ag2ExkGM7EaxWelhzVVyj0hpaM1vPmJIyy/T88yXXQOsHcZlMoyT4yk095Wcf529 wSBh9zYjJFqoyt7PeXuz98IxshfLeVnlPjazVL3xqrTNCiuXrzFTjmTPbzlKk/K6szsk dLnATR2SEGKuryV1SOjYH3esEgcfUBiXWIU445hCcJgpDPvh5gwnm4Zoc2vJSu1c92EX 5Dg+hbE4tjwBJl43SY0DfaOx6s6oGFPjy7h0w32GetdH6JRNaNwQ0V1+NUp93Ge5NK7t LZdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Y2Q7WNjao8WWZ+AkgsRL13pDruk25cWNBp9PcpW6RmE=; b=j8xOuXD2SfORA77Covq6g/kFx+N+ps3eEl+1l9XMuY7dfzwQymgQVdgC2jPYnDUW1a LVXPxTW1QoWday7TxpSaJIE6Tb7I54KIBjNTPejgFfRQQJIagwVM1ZDouf+rUMEjcgvr ut6YQi1xqLKNiuWV//bCSb6kj5dXZ1Ta6saJZe457IKMWguXoEPeFmEs0BVgPRuvJO3Q XWjHM/ps5RhSxNFnXiw0Ghe6GIe/hA8VMnVxH5aRDCEimo5B7EF6fPOZDA0RMXhMdtJ1 Ol2yZrfFFLlC1cbG9G3RWXYXrm32a7pP8f0DjjZH/CZXryiOi91dQ0u7WEg6We4KkY4A EN9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn4-20020a0564020ca400b0045c4b1f4315si1523710edb.485.2022.10.14.00.04.37; Fri, 14 Oct 2022 00:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbiJNGt3 (ORCPT + 99 others); Fri, 14 Oct 2022 02:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiJNGt1 (ORCPT ); Fri, 14 Oct 2022 02:49:27 -0400 Received: from out199-10.us.a.mail.aliyun.com (out199-10.us.a.mail.aliyun.com [47.90.199.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2762F1849B0 for ; Thu, 13 Oct 2022 23:49:25 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VS6n2Py_1665730157; Received: from e18g06460.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VS6n2Py_1665730157) by smtp.aliyun-inc.com; Fri, 14 Oct 2022 14:49:22 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML , Gao Xiang Subject: [PATCH] erofs: fix up inplace decompression success rate Date: Fri, 14 Oct 2022 14:49:15 +0800 Message-Id: <20221014064915.8103-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.24.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Signed-off-by: Gao Xiang --- fs/erofs/zdata.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index cce56dde135c..2417d7b73622 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -812,15 +812,14 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe, ++spiltted; if (fe->pcl->pageofs_out != (map->m_la & ~PAGE_MASK)) fe->pcl->multibases = true; - - if ((map->m_flags & EROFS_MAP_FULL_MAPPED) && - !(map->m_flags & EROFS_MAP_PARTIAL_REF) && - 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) && + !(map->m_flags & EROFS_MAP_PARTIAL_REF) && + 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; -- 2.24.4