Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4194838pxb; Wed, 13 Oct 2021 23:50:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr2rkfd+lRm2Z7oi0jNB5MyGtWwTGfu3s7khFm8ics7C9e7jBrINK2gvCKq651OFnYfQpj X-Received: by 2002:a17:902:d2c6:b0:13f:1ecb:aefd with SMTP id n6-20020a170902d2c600b0013f1ecbaefdmr3483736plc.50.1634194248576; Wed, 13 Oct 2021 23:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634194248; cv=none; d=google.com; s=arc-20160816; b=UEeUH/GdSIBBvBbiN/lP3pSWng7cmNVmIDB/jj6c0KyNozIGV0Ykq5OS3hcbdWLnTA pFPJ9F55FV24UTcuQMTabqwedr7KHhwMkkE5UXbRQjz1n51sYnClGitZn6IZEpLs3TSs sTWQJIQy4dSvb8BKbv0ug4SltS8cP8ma7ig4UTPbnuUBQH09/X3SnFCkTKs0Kf9Ry6UV MgLgZDAROM+QMh5KJdwR/ARlIfLuu4L3U1qDk+P7+GNN4l2XlZ+kf9EjkpGCEZkb7PaZ DtokDFC7EQDaXodYVhZwhEwdNq6OZr21eDERXynJDRkS4b/I8xEtihoNgkaIHfY4ktWa NFWA== 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=rxHmLwHTIs5YfVoK0tG+XmVjtk0kfNRco5ZE7qoxNL8=; b=eljyGTjnBmmeAqOjF9XvLSMfDBsDYKbsk58QK1HYM7XBggGdcOUrXX2jBePe+mjHbm WZ5d885Kweoi2oEO19ClXFb+nJmihwoRDTTDGsOF2s2qQLc+2RitIh+ABnhJyo200kjK 8U7jPjC3UV9uNlqGwGAP57TNDkEWpmvHYVEWfli78TnCujjC5j7FAd929x8JHv4Z8Exh a3MxnGjlMrmQPaREGwyAgwWMwybcjIjh3KBqu4aXS4iv20UbPwOgO66wHbUqAHTxNxOR 0Yay/bjT17uUVuJry4FncZLgCiM7kt9uybzktMKCEhimfyOvcGUOIwUleg3UnkxS4q/2 mAxw== 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 a4si2510246pgq.416.2021.10.13.23.50.36; Wed, 13 Oct 2021 23:50:48 -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 S229672AbhJNGvV (ORCPT + 99 others); Thu, 14 Oct 2021 02:51:21 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:51118 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbhJNGvV (ORCPT ); Thu, 14 Oct 2021 02:51:21 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R591e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UrlGJ8P_1634194154; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0UrlGJ8P_1634194154) by smtp.aliyun-inc.com(127.0.0.1); Thu, 14 Oct 2021 14:49:15 +0800 Date: Thu, 14 Oct 2021 14:49:13 +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 v2] erofs: remove the fast path of per-CPU buffer decompression Message-ID: References: <20211014063901.1629-1-zbestahu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211014063901.1629-1-zbestahu@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 02:39:01PM +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 for that case. > > Signed-off-by: Yue Hu Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > v2: just set ret = 0 in else branch and rearrange if statement into one line. > > fs/erofs/decompressor.c | 63 +++++++------------------------------------------ > 1 file changed, 8 insertions(+), 55 deletions(-) > > diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c > index 88e33ad..f8a372e 100644 > --- a/fs/erofs/decompressor.c > +++ b/fs/erofs/decompressor.c > @@ -243,6 +243,8 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out) > if (ret >= 0) > memset(out + ret, 0, rq->outputsize - ret); > ret = -EIO; > + } else { > + ret = 0; > } > > if (maptype == 0) { > @@ -269,33 +271,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) > { > @@ -306,34 +281,12 @@ 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 paths only for non bigpcluster cases yet */ > + if (rq->inputsize <= PAGE_SIZE && nrpages_out == 1 && !rq->inplace_io) { > + 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