Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1690305pxb; Mon, 13 Sep 2021 03:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ClJt/SNVpXBGUOm3F5Gc0gPWSe0EMEXyYUJzeQPay/bvbk5yaHQo+90nEBOJ7woidOOH X-Received: by 2002:a17:906:3486:: with SMTP id g6mr12324709ejb.71.1631528553657; Mon, 13 Sep 2021 03:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631528553; cv=none; d=google.com; s=arc-20160816; b=E4TwQg8ztI0ys8A1vZ2oCjMQbkAeWldy4VJpeGgCzT/wTk5q3t550fkWrob64+C8lJ 1YPMwf9o/WWHEtj+LohooBvIHwNfGWUBYZuwHGzLrYqVq2crr+Pe9g2iD6Ned5xCLKm7 pQ5jxPuSxWLES3N3UkEJNT6wd5W7dh53fJ6A+luL3f19r0QFk9FBgUvEn6E8OcKXl3v4 AkQibEtp4YNU10xjdo9I7mOIW6SnBJkMw0hO8vxWEpFHk7vnLRXuHH2uJj+HSp3StIGn iJ3NqTY9Nd68ZQ4vyq53Bq9i0U7CYPeitimc8B4wkztAzBmbIjvN7QFKH+xZceh6mp+B LefA== 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=vFLh0r81z357HKh/EiL4c9NlmipA9h17daLjP5MwhhM=; b=WbOJdLXZLxuPtzZWWdn/qWdyXolWegupzSAE5+fLHdI9EgtSF6XK4Xvj+cA54Ww0L2 RR/HKI5unGhCxPfNuE1eIySwqnmXT34gyCuI139EHOOSKqksYyhCU48H3J1kD8ZqzNta t967H+I5BcjhPNAhFJJGEtIJbEgszDeOMrsmtc/pp9yjqXa5W8Npjni9z57yOkXRZM9/ NirDcChNTGrgyVcMqvhCiAqo9j7ONtEEEh0AJvb5crcNWn5yejQD3Tu+ftN1A6rheU80 aGYRSqrzXfh8cXMGyRudOnj8Vygy16FkbFMGZVm+qXeXPyeup/LhB8XU6437TieVBBwG CyMA== 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 y20si6137796edt.1.2021.09.13.03.22.07; Mon, 13 Sep 2021 03:22:33 -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 S238382AbhIMJMn (ORCPT + 99 others); Mon, 13 Sep 2021 05:12:43 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:35918 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236022AbhIMJMn (ORCPT ); Mon, 13 Sep 2021 05:12:43 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UoCWMY7_1631524284; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UoCWMY7_1631524284) by smtp.aliyun-inc.com(127.0.0.1); Mon, 13 Sep 2021 17:11:25 +0800 Date: Mon, 13 Sep 2021 17:11:24 +0800 From: Gao Xiang To: Yue Hu Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, huyue2@yulong.com, zhangwen@yulong.com, zbestahu@163.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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210913170016.00007580.zbestahu@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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; } Thanks, Gao Xiang > > Thanks. > > > > > So it can be handled in either compacted_4b_initial or compacted_4b_end > > cases, because there are all compacted 4B. > > > > Thanks, > > Gao Xiang > > > > > > > > Signed-off-by: Yue Hu > > > --- > > > fs/erofs/zmap.c | 5 ++++- > > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > > index 9fb98d8..4f941b6 100644 > > > --- a/fs/erofs/zmap.c > > > +++ b/fs/erofs/zmap.c > > > @@ -369,7 +369,10 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, > > > if (compacted_4b_initial == 32 / 4) > > > compacted_4b_initial = 0; > > > > > > - if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > > + if (compacted_4b_initial > totalidx) { > > > + compacted_4b_initial = 0; > > > + compacted_2b = 0; > > > + } else if (vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) > > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > > else > > > compacted_2b = 0; > > > -- > > > 1.9.1