Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp432616rdb; Sat, 19 Aug 2023 07:32:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOLyHj077omrve4xtzxpEMkLVoHsDxu87rHgI7B+/jlExRHn5UH/VNoOwCQwEK/rGiFetS X-Received: by 2002:a05:6a21:6da5:b0:145:3bd9:1389 with SMTP id wl37-20020a056a216da500b001453bd91389mr3163180pzb.6.1692455532456; Sat, 19 Aug 2023 07:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692455532; cv=none; d=google.com; s=arc-20160816; b=sVn2SXb8kxq1cpBmhAG/+Iasg9ylnbkKFmJFf2BuLUwRodMhTOFPlwSx7I293PQNpi aL8IJ9d8WG8T41rPFrSsvMdmsne69k+7IFONB+xQD4VoLgoApXVMcjbcVGCFuxps1U3t jnbS8P2bAuoXdoY4lMdMoYoRpM6T00ejqaJnJ39BTNXVvAzPcloGf+vaJWzg5qdx26e3 /7ze6u4IxQZ5YaTmbFqflpPk6hWParBZxZ+8Mw8qJm13EPqjhsHy4A6Q+XmPcPWYkrbd Max6djO0JetXk1I8VDghIkDOcInhIl3/94m1EoRjQPrCVplFBtvBH92wlGBiy0zxSSWk /XcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=t4/MPa0QhYXJNNyHhVgQ/BS7g817pnqN6jLiM7cLt5M=; fh=hUFgK1jYaGoBbPHNmLEwSQK2zAEiKeYoBqD/5Axe8YQ=; b=xPmRxvgpxOhSElTJ8JY29PKRYgKhf+FyIez/3a5yDkygCzaWXVaxyo/yawMHiU6ZRc 0QeW16C939x9LOgxatF3z6scNKkUxkWU2CdNN434YcCwuO8oC+QcbmAq5DqStynpaDyo 8vJ4fHSRVqZspx17MDi5lWUedWu7tOmOZQffKItjBPGud/dbNUn6+ZNRrDt3O30BB3BR JoKx7ZiQA3gcZIIQX3VyP5frLzt6Vn5xdfaOxe99MiqAIAW9hdn8ayixT6J9D/qt8uf+ EBBITNc0z8lHvsjepMF1IvOU9lXlWJbM+sf8OewOwUS3GDR804qIMdiXFjKN2gcmUEIQ GX5Q== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s10-20020a632c0a000000b00565f8704191si3426339pgs.635.2023.08.19.07.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 07:32:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 770A9C6E67; Sat, 19 Aug 2023 01:44:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358177AbjHRHso (ORCPT + 99 others); Fri, 18 Aug 2023 03:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352585AbjHRHsR (ORCPT ); Fri, 18 Aug 2023 03:48:17 -0400 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E1930FE for ; Fri, 18 Aug 2023 00:48:13 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R771e4;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_---0Vq1nWfF_1692344889; Received: from 30.221.131.34(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Vq1nWfF_1692344889) by smtp.aliyun-inc.com; Fri, 18 Aug 2023 15:48:10 +0800 Message-ID: <671a514f-8597-7693-1323-929e39c56dda@linux.alibaba.com> Date: Fri, 18 Aug 2023 15:48:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 6/8] erofs: get rid of fe->backmost for cache decompression To: Yue Hu Cc: linux-erofs@lists.ozlabs.org, LKML , huyue2@coolpad.com References: <20230817082813.81180-1-hsiangkao@linux.alibaba.com> <20230817082813.81180-6-hsiangkao@linux.alibaba.com> <20230818135156.00005a05.zbestahu@gmail.com> From: Gao Xiang In-Reply-To: <20230818135156.00005a05.zbestahu@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,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 On 2023/8/18 13:51, Yue Hu wrote: > On Thu, 17 Aug 2023 16:28:11 +0800 > Gao Xiang wrote: > >> EROFS_MAP_FULL_MAPPED is more accurate to decide if caching the last >> incomplete pcluster for later read or not. >> >> Signed-off-by: Gao Xiang >> --- >> fs/erofs/zdata.c | 7 ++----- >> 1 file changed, 2 insertions(+), 5 deletions(-) >> >> diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c >> index 4009283944ca..c28945532a02 100644 >> --- a/fs/erofs/zdata.c >> +++ b/fs/erofs/zdata.c >> @@ -528,8 +528,6 @@ struct z_erofs_decompress_frontend { >> z_erofs_next_pcluster_t owned_head; >> enum z_erofs_pclustermode mode; >> >> - /* used for applying cache strategy on the fly */ >> - bool backmost; >> erofs_off_t headoffset; >> >> /* a pointer used to pick up inplace I/O pages */ >> @@ -538,7 +536,7 @@ struct z_erofs_decompress_frontend { >> >> #define DECOMPRESS_FRONTEND_INIT(__i) { \ >> .inode = __i, .owned_head = Z_EROFS_PCLUSTER_TAIL, \ >> - .mode = Z_EROFS_PCLUSTER_FOLLOWED, .backmost = true } >> + .mode = Z_EROFS_PCLUSTER_FOLLOWED } >> >> static bool z_erofs_should_alloc_cache(struct z_erofs_decompress_frontend *fe) >> { >> @@ -547,7 +545,7 @@ static bool z_erofs_should_alloc_cache(struct z_erofs_decompress_frontend *fe) >> if (cachestrategy <= EROFS_ZIP_CACHE_DISABLED) >> return false; >> >> - if (fe->backmost) >> + if (!(fe->map.m_flags & EROFS_MAP_FULL_MAPPED)) > > So, i understand (map.m_flags & EROFS_MAP_FULL_MAPPED) should be false if allocate cache is needed > (fe->backmost is true)? fe->backmost is inaccurate compared with !EROFS_MAP_FULL_MAPPED, if !EROFS_MAP_FULL_MAPPED, it should be cached instead. Thanks, Gao Xiang