From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A572CC77B72 for ; Mon, 17 Apr 2023 07:12:46 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Q0JCx1NrSz3cT4 for ; Mon, 17 Apr 2023 17:12:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.113; helo=out30-113.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=) Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Q0JCp2FXgz3cDF for ; Mon, 17 Apr 2023 17:12:37 +1000 (AEST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VgFMACV_1681715551; Received: from 30.97.49.3(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VgFMACV_1681715551) by smtp.aliyun-inc.com; Mon, 17 Apr 2023 15:12:32 +0800 Message-ID: Date: Mon, 17 Apr 2023 15:12:31 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] erofs: remove unneeded icur field from struct z_erofs_decompress_frontend To: Yue Hu References: <20230417064136.5890-1-zbestahu@gmail.com> <26cdf7b0-5d7d-68ba-da76-1ad800708946@linux.alibaba.com> <20230417151506.00006565.zbestahu@gmail.com> From: Gao Xiang In-Reply-To: <20230417151506.00006565.zbestahu@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, zhangwen@coolpad.com, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On 2023/4/17 15:15, Yue Hu wrote: > On Mon, 17 Apr 2023 15:00:25 +0800 > Gao Xiang wrote: > .. >> >> Although please help refine the comment below: >> >> /* scan & fill inplace I/O pages in the reverse order */ > > Ok, will refine it in v2. I rethink this, I don't want to go far in this way, and this makes a O(n) scan into O(n^2) when a single inplace I/O page is added. So sorry, I don't think it's a good way, although I also don't think `icur` is a good name and we might need to find a better name. Thanks, Gao Xiang > >> >> Thanks, >> Gao Xiang >> >>>> +    unsigned int icur = pcl->pclusterpages; >>>> -    while (fe->icur > 0) { >>>> -        if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page, >>>> +    while (icur > 0) { >>>> +        if (!cmpxchg(&pcl->compressed_bvecs[--icur].page, >>>>                    NULL, bvec->page)) { >>>> -            pcl->compressed_bvecs[fe->icur] = *bvec; >>>> +            pcl->compressed_bvecs[icur] = *bvec; >>>>               return true; >>>>           } >>>>       } >>>> @@ -877,8 +876,6 @@ static int z_erofs_collector_begin(struct z_erofs_decompress_frontend *fe) >>>>       } >>>>       z_erofs_bvec_iter_begin(&fe->biter, &fe->pcl->bvset, >>>>                   Z_EROFS_INLINE_BVECS, fe->pcl->vcnt); >>>> -    /* since file-backed online pages are traversed in reverse order */ >>>> -    fe->icur = z_erofs_pclusterpages(fe->pcl); >>>>       return 0; >>>>   }