Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp540888pxb; Thu, 23 Sep 2021 05:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoqX1V60WrioQvvA3d9yR8rzc7FGHNriUDLL2TehPSCAw4BnsO7VFAl6ljzLHZMzM61Exj X-Received: by 2002:a92:c744:: with SMTP id y4mr3320247ilp.288.1632401530033; Thu, 23 Sep 2021 05:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632401530; cv=none; d=google.com; s=arc-20160816; b=sEkJtHGfCMnOiYPLjg4mWOMIJprADKgabeKKEuavxzJD6cbu3WhcEyGCpRaGbZU1Le Pirb16BGJLfcS6V2LgEnhwbp619e58yetVvnaDGiW/5NfbEYi1E+zt9EazszioNkU35t eFEWknQCNz/aMUrT5s+3Z4yI6C/+kqTxQYkLc9cMTX2MRmVSBDKQCnaoXt1imR2cmPku YtR1LBidhrLxPOalicyizgTuwhnvoOjdQ04zrpkTlFJKrr2u+MX1HEIvdLNngChec55S VmMIEDWO+kHnQ1iYwY5UbVTjgeTbOW2Cf5c6WDF4EyOsjNUdeDYVc0xw8ptH/tq9Qtsd OBNw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=MA6anncPT404+0JP8U+6QBqErtbmvMBOlNOEcO3V478=; b=Z3ztBT46zv9QpgV/lzPLF5jYXidAFyTA1sEysulyzXiWRJ/N938of5eGIZGlQ2AVSU kX/+ZfpBPU4cKjDRItHkVKW7ZZJWRMM4149XyfY6it/U7G+IhqiPIoQkyKanIqlxLZjQ yDSbxccXZOsPWuPJaMKmCe2tLPuHSC8N0OLVHR5ZlXnZOjoTbitIN0El/R0FCMiyfIdm 9rQPjN5J6qAHtSfsTqhBCZezB3TTL1CUMDds6Yf96GnfmNpBiyIUOr3F44haAAtcD+fp lSdLZi9u2dHH+moXj5njvVaOXUqWD4VB7ZnM83Qxbk5w1xxAlfuPOomk4ccXDTAPI6sO QVNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=lVCIawqw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si5939591ilh.150.2021.09.23.05.51.55; Thu, 23 Sep 2021 05:52:10 -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; dkim=pass header.i=@163.com header.s=s110527 header.b=lVCIawqw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241157AbhIWMwi (ORCPT + 99 others); Thu, 23 Sep 2021 08:52:38 -0400 Received: from m12-16.163.com ([220.181.12.16]:55630 "EHLO m12-16.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241054AbhIWMwa (ORCPT ); Thu, 23 Sep 2021 08:52:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=MA6an ncPT404+0JP8U+6QBqErtbmvMBOlNOEcO3V478=; b=lVCIawqwAtSDLrmh7VTG/ zhRQzxQUhWYPJQnSuMW4RR7P17pJVu1fpC6pbWkR8rtlPCiYs4ZthO08RQDr+GiQ gsCha+acC4xqvlcHmS0fe0tgS07FUGzEOe2xezLyy8Ns46XWgZoo00tmcvsMQZv3 Nk+G1iJ7/iUXpJ3XFkHPQ8= Received: from rockpi4b (unknown [112.20.66.231]) by smtp12 (Coremail) with SMTP id EMCowADn9goPeExhiW+xBw--.45S2; Thu, 23 Sep 2021 20:50:34 +0800 (CST) Date: Thu, 23 Sep 2021 20:50:22 +0800 From: Yue Hu To: Gao Xiang 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_2b if compacted_4b_initial > totalidx Message-ID: <20210923205022.76ea5e4f.zbestahu@163.com> In-Reply-To: References: <20210914035915.1190-1-zbestahu@gmail.com> <20210914125748.00003cd2.zbestahu@gmail.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: EMCowADn9goPeExhiW+xBw--.45S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tF1rAF4UWr1rWryxCry8Krg_yoW8trW3p3 yDGF48ta40qryfCF1xtr1rJF1xt397Kr18Xw1YqF10gr90vFn7Jr18tF98uF1UWw13Gr40 va1jgwnxZFWjy3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07Ud-BiUUUUU= X-Originating-IP: [112.20.66.231] X-CM-SenderInfo: p2eh23xdkxqiywtou0bp/1tbitBoXEVSIm+8+MgAAsM Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sep 2021 19:49:42 +0800 Gao Xiang wrote: > On Tue, Sep 14, 2021 at 12:57:48PM +0800, Yue Hu wrote: > > On Tue, 14 Sep 2021 12:37:14 +0800 > > Gao Xiang wrote: > > > > > On Tue, Sep 14, 2021 at 11:59:15AM +0800, Yue Hu wrote: > > > > From: Yue Hu > > > > > > > > Currently, the whole indexes will only be compacted 4B if > > > > compacted_4b_initial > totalidx. So, the calculated compacted_2b > > > > is worthless for that case. It may waste CPU resources. > > > > > > > > No need to update compacted_4b_initial as mkfs since it's used to > > > > fulfill the alignment of the 1st compacted_2b pack and would handle > > > > the case above. > > > > > > > > We also need to clarify compacted_4b_end here. It's used for the > > > > last lclusters which aren't fitted in the previous compacted_2b > > > > packs. > > > > > > > > Some messages are from Xiang. > > > > > > > > Signed-off-by: Yue Hu > > > > > > Looks good to me, > > > Reviewed-by: Gao Xiang > > > > > > (although I think the subject title would be better changed into > > > "clear compacted_2b if compacted_4b_initial > totalidx" > > > > Yeah, 'clear' is much better for this change. > > > > Thanks. > > > > > since 'fix'-likewise words could trigger some AI bot for stable > > > kernel backporting..) > > > > > > Thanks, > > > Gao Xiang > > > > > > > --- > > > > fs/erofs/zmap.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c > > > > index 9fb98d8..aeed404 100644 > > > > --- a/fs/erofs/zmap.c > > > > +++ b/fs/erofs/zmap.c > > > > @@ -369,7 +369,8 @@ 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 ((vi->z_advise & Z_EROFS_ADVISE_COMPACTED_2B) && > > > > + compacted_4b_initial <= totalidx) { > > btw, I've fixed up the build error due to redundant brace '{' when Thanks. > applying... > > Thanks, > Gao Xiang > > > > > compacted_2b = rounddown(totalidx - compacted_4b_initial, 16); > > > > else > > > > compacted_2b = 0; > > > > -- > > > > 1.9.1