Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4176022pxb; Wed, 13 Oct 2021 23:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNRZW6Ck7GtkAsA4Y7T//EN/e9FSIifVbpVF6zPQ9PbGTzLlu+I9mxis/uaZUM4399SdvT X-Received: by 2002:a17:902:ecc6:b0:13f:60d1:9360 with SMTP id a6-20020a170902ecc600b0013f60d19360mr3390627plh.9.1634192284515; Wed, 13 Oct 2021 23:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634192284; cv=none; d=google.com; s=arc-20160816; b=Ue9nPYdgY3IxRJT6XOytflYYeJsDCuGEl68xmLRHPCTfNuzlVv1aSgz0P+Be4zDSKL KnlGSxQZ3JWEFG2bzA4noiO3SZGmXwVPlEw7VZR6wLxoQqsdDm7H2w45AIKZjppW51Ur 7nbbPe01u/ciJuuvJZHZPkzSoeIPcuWkWyZV6DK8lsH+P4NQaqASciAq270TfFEZGz28 E54eXwXG4Z7Sn5p9qI8QhbV6Z96bWcbtn7ilxvPER3j6Ev2jgndlwRjYNmFlB9aheQ0O vF2CdLh2/eGfpmhrglFJ2jL2UG8h+/izvhLsDoOW+Cd66YO2I9QS3RqlnP8wnHyvbdyj XCkw== 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=A49HZqh3nALb1XIKESobN5t/uHnAJfvBytFSIUcp5PA=; b=C7PUM7KiDujjrl8iTrO7z1edLHAj9DvcsqactN1K3wGar9N8UYFy1BMSUe2tpFEnb1 i2JO+zqZJhZm2r+Rm4ug4XpaThLw9lxDoSr+hryY2WXpq5GJj/omoDHdEgC0BeVIyHmi GUxmqXxPTYI5QaQ+AeWsAORhF+n5NWUw41ETjnQ2Klklyxr0IaLq1dKEjZ5+Y3lPxnf9 M/KL/vPc1yKEXsx/iOIiyzd2JG0JHccsH9dRdwcilRmqktK+n/qLd87ugIRRY3OMqgoK RyPfmFBT+XuUPnP6b+bPud2NwP/sTezVnoNHxC7jlWrTpNsysKbscxjukFGgMSDMdxiD vIlw== 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 a15si2396030plm.320.2021.10.13.23.17.50; Wed, 13 Oct 2021 23:18:04 -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 S229541AbhJNGS5 (ORCPT + 99 others); Thu, 14 Oct 2021 02:18:57 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:46636 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbhJNGS4 (ORCPT ); Thu, 14 Oct 2021 02:18:56 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UrleTSs_1634192208; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UrleTSs_1634192208) by smtp.aliyun-inc.com(127.0.0.1); Thu, 14 Oct 2021 14:16:50 +0800 Date: Thu, 14 Oct 2021 14:16:48 +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, zbestahu@163.com, zhangwen@yulong.com Subject: Re: [PATCH] erofs: remove the fast path of per-CPU buffer decompression Message-ID: References: <20211014055756.1549-1-zbestahu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211014055756.1549-1-zbestahu@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 01:57:56PM +0800, Yue Hu wrote: > From: Yue Hu > > As Xiang mentioned, such path has no real impact to our current > decompression strategy, remove it directly. Also, update the return > value of z_erofs_lz4_decompress() to 0 if success to keep consistent > with LZMA which will return 0 as well for that case. > > Signed-off-by: Yue Hu > --- > fs/erofs/decompressor.c | 64 +++++++------------------------------------------ > 1 file changed, 8 insertions(+), 56 deletions(-) > > diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c > index a5bc4b1..9905551 100644 > --- a/fs/erofs/decompressor.c > +++ b/fs/erofs/decompressor.c > @@ -254,7 +254,7 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out) > DBG_BUGON(1); > return -EFAULT; > } > - return ret; > + return ret > 0 ? 0 : ret; How about just updating the else branch of "if (ret != rq->outputsize)"? > } > > static struct z_erofs_decompressor decompressors[] = { > @@ -268,33 +268,6 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out) > }, > }; > > -static void copy_from_pcpubuf(struct page **out, const char *dst, > - unsigned short pageofs_out, > - unsigned int outputsize) > -{ > - const char *end = dst + outputsize; > - const unsigned int righthalf = PAGE_SIZE - pageofs_out; > - const char *cur = dst - pageofs_out; > - > - while (cur < end) { > - struct page *const page = *out++; > - > - if (page) { > - char *buf = kmap_atomic(page); > - > - if (cur >= dst) { > - memcpy(buf, cur, min_t(uint, PAGE_SIZE, > - end - cur)); > - } else { > - memcpy(buf + pageofs_out, cur + pageofs_out, > - min_t(uint, righthalf, end - cur)); > - } > - kunmap_atomic(buf); > - } > - cur += PAGE_SIZE; > - } > -} > - > static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq, > struct list_head *pagepool) > { > @@ -305,34 +278,13 @@ static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq, > void *dst; > int ret; > > - /* two optimized fast paths only for non bigpcluster cases yet */ > - if (rq->inputsize <= PAGE_SIZE) { > - if (nrpages_out == 1 && !rq->inplace_io) { > - DBG_BUGON(!*rq->out); > - dst = kmap_atomic(*rq->out); > - dst_maptype = 0; > - goto dstmap_out; > - } > - > - /* > - * For the case of small output size (especially much less > - * than PAGE_SIZE), memcpy the decompressed data rather than > - * compressed data is preferred. > - */ > - if (rq->outputsize <= PAGE_SIZE * 7 / 8) { > - dst = erofs_get_pcpubuf(1); > - if (IS_ERR(dst)) > - return PTR_ERR(dst); > - > - rq->inplace_io = false; > - ret = alg->decompress(rq, dst); > - if (!ret) > - copy_from_pcpubuf(rq->out, dst, rq->pageofs_out, > - rq->outputsize); > - > - erofs_put_pcpubuf(dst); > - return ret; > - } > + /* one optimized fast path only for non bigpcluster cases yet */ > + if (rq->inputsize <= PAGE_SIZE && > + nrpages_out == 1 && !rq->inplace_io) { How about rearrange these into one line? (it seems just 80 char). Otherwise looks good to me. Thanks, Gao Xiang > + DBG_BUGON(!*rq->out); > + dst = kmap_atomic(*rq->out); > + dst_maptype = 0; > + goto dstmap_out; > } > > /* general decoding path which can be used for all cases */ > -- > 1.9.1