Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp2050872pxb; Mon, 13 Sep 2021 10:51:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJuMWWfU1XrMjtSlrbbpuona63cdb/F8Kn4bhatUtB7LZvZ2boioa+1nSknVbZHIKgLKFW X-Received: by 2002:a17:906:2bdb:: with SMTP id n27mr14163928ejg.86.1631555494206; Mon, 13 Sep 2021 10:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631555494; cv=none; d=google.com; s=arc-20160816; b=zdjkJAt/jpuSGt7tMfTKnbwBqTNhYdo8wal4c/LTDL60TdYDZupk4jRA1vVXFUYPbu BthF/gety29lbgz725fhopKSSGXMkxJ0RBkwqyRSP3lBWYF8LBICP+YbPv7r0wjSgqfs X4pQERD6NgDjfKktvB2088T68DmF/rElcwEbAvD4+jZayUVfszOZEBQsq8VDT5Mw1Sjr 6Os+/wot7PtpZxHYensnZ6EtFcE+3pDDxivDMVOKPQI/sg+z3rGhISlCSYpicRuutlI+ 5cHUPWC7nFCmVJKtPzQZR8gvFc57Ea6d0HCnY5xq5/w8WI8wkdveBsJqgmoBkOjBzYUi waeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oavaxOYfR43jYt+XTN6jTGb1Ow6B4DMyn2QtZg3kIm8=; b=ZLRknvvjTDZl0nAGUNMzcrFxbliyXPPoy/IFJKsljAbfuwfFlBzbpW1+aieMh3r4Cl Ex19FIVlhF4/jaXdxlIPB1opO/SMY7GvkfM+CRG5ZveVbuuzJgTKMIj9/iChrK1DLm0+ GoMu1S0C4v4ElWewp7x327utzmSE99X1RFg/7bmwPSnzIFXc4q0r23/GuMurs0G2o8XQ tsTAC/S+aeh1mLm/d6WbhgsPm3gc49Xubj53p7lKhM9MlcKEezachLk1YYzB/iRqi786 mO8kaKN9RflKECvJ0iz6genXl5EcAR1uD3R3jK/YxZA7H77I9C4ausdwE5xbrGrR8phk 4WTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si7546739ejd.404.2021.09.13.10.51.09; Mon, 13 Sep 2021 10:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239486AbhIMLUg (ORCPT + 99 others); Mon, 13 Sep 2021 07:20:36 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:46743 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239485AbhIMLUf (ORCPT ); Mon, 13 Sep 2021 07:20:35 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UoCWglD_1631531956; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UoCWglD_1631531956) by smtp.aliyun-inc.com(127.0.0.1); Mon, 13 Sep 2021 19:19:18 +0800 Date: Mon, 13 Sep 2021 19:19:16 +0800 From: Gao Xiang To: Yue Hu Cc: Yue Hu , xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, huyue2@yulong.com, zhangwen@yulong.com Subject: Re: [PATCH] erofs: fix compacted_{4b_initial, 2b} when compacted_4b_initial > totalidx Message-ID: References: <20210913072405.1128-1-zbestahu@gmail.com> <20210913170016.00007580.zbestahu@gmail.com> <20210913185836.088e7059.zbestahu@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210913185836.088e7059.zbestahu@163.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yue, On Mon, Sep 13, 2021 at 06:58:36PM +0800, Yue Hu wrote: > Hi Xiang, > > On Mon, 13 Sep 2021 17:11:24 +0800 > Gao Xiang wrote: > > > On Mon, Sep 13, 2021 at 05:00:16PM +0800, Yue Hu wrote: > > > On Mon, 13 Sep 2021 16:48:45 +0800 > > > Gao Xiang wrote: > > > > > > > Hi Yue, > > > > > > > > On Mon, Sep 13, 2021 at 03:24:05PM +0800, Yue Hu wrote: > > > > > From: Yue Hu > > > > > > > > > > mkfs.erofs will treat compacted_4b_initial & compacted_2b as 0 if > > > > > compacted_4b_initial > totalidx, kernel should be aligned with it > > > > > accordingly. > > > > > > > > There is no difference between compacted_4b_initial or compacted_4b_end > > > > for compacted 4B. Since in this way totalidx for compact 2B won't larger > > > > than 16 (number of lclusters in a compacted 2B pack.) > > > > > > However, we can see compacted_2b is a big number for this case. It should > > > be pointless. > > > > Does it has some real impact? > > No real impact to correct result. > > > > > compacted_4b_initial is only used for the alignment use for the > > first compacted_2b so that each compacted_2b pack won't cross > > the block (page) boundary. And compacted_4b_end is for the last > > lclusters aren't fitted in any compacted_2b pack. > > > > If compacted_4b_initial > totalidx, I think the whole indexes > > would be compacted 4B and handled in > > > > if (lcn < compacted_4b_initial) { > > amortizedshift = 2; > > goto out; > > } > > Yes, it is. > > My point is why we need compacted_2b here for this case. If it's > not helpful/used for next code logic, we should remove/avoid it. > I think that may cause some misunderstanding and consume unneeded > CPU resources. Okay, make sense. If the number of compacted_2b misleads, how about just if ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && compacted_4b_initial <= totalidx) { compacted_2b = ...; } else { compacted_2b = 0; } , and refine the commit message to point out the following facts for other folks: - compacted_4b_initial is used contain the very first lclusters in order to fulfill the alignment of the first compacted_2b pack; - compacted_4b_end is used for the last lclusters which aren't fitted in the previous compacted_2b packs; - if compacted_4b_initial > totalidx, the whole indexes will be compacted 4B and handled with compacted_4b_initial. Thanks, Gao Xiang > > Thanks.