Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp911734rwl; Wed, 5 Apr 2023 09:14:54 -0700 (PDT) X-Google-Smtp-Source: AKy350a///PNi3wLcrRoqTbuk4UE94V1X9UcXGu8oUzp5D5lgQCb1Nn2YKrUFat81w6s5gCAoYSS X-Received: by 2002:a05:6a20:6d10:b0:db:391a:5eff with SMTP id fv16-20020a056a206d1000b000db391a5effmr5275543pzb.22.1680711294219; Wed, 05 Apr 2023 09:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680711294; cv=none; d=google.com; s=arc-20160816; b=XjX/PcozT5bE21y8BFDHPKqKu+kW31D/EI1ShiMd2ZJd4wlZlRus2Wo6n5m0IZH+lH T1VRyVMOna6CkJRgBoHDTL/y5Wx2MS3gF9zs+Z33AIUryxekmCrQOibdNhDmFccMGw2c SYfbYQm36GPWjzK3jQGFHWNZ5sbyhQW6MB5+t5o5LaSakTomtnvcGyFrSyzYf8ZRwSsV mJQ8VcsR2trwaWKwWftgU5OZAtrOc87mNpgPM4Jl8MzVyB46hMl8Oru3XxEi+s+KDHvZ xXZ0ehU93stteaLY6Mve0dZVDGxcfDbFWBGdL8ueS1DPeK/NkvVLdMZ2b/8mzjynDtbX G80w== 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:dkim-signature; bh=0YGKAhWSIIluAMjfDKpBRI+SxUUkXqNeuXpnbz4DS94=; b=mYO+fAvoN8bje3cFYibOOdIyvkdRDhxrj52PUl6cNju3iyVVRQzd+KfmJeztD++Gw3 GB2DfxMqu2/D+2EAEATr/LaqiBlA5RSEAh/gt+NZdMLxovrH6rVrj8PoBWPIhMhGmks0 SGc52VsdpH0i3CfvG33oRr3I7exBKDQpzfaC7YEKInxfM6aqQRk8ja4g3Wl93Rsd/7G0 Dnhk9T9j8kI/zwBVnJ90GoK/NO3kTbWvy53zdgzOjSjpETeN+DfRDi9mollSMDvPhVUz BoH5IT43rhvr1QlKkdF4WFCslzSNF5pvdVX/pawdgRvjXTkG3R1ATHA/m0S4gc+vR31J k+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MCQhPEA/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a65584b000000b005091105ca8fsi5448896pgr.14.2023.04.05.09.14.34; Wed, 05 Apr 2023 09:14:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MCQhPEA/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbjDEQNq (ORCPT + 99 others); Wed, 5 Apr 2023 12:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbjDEQNp (ORCPT ); Wed, 5 Apr 2023 12:13:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303C872B4 for ; Wed, 5 Apr 2023 09:13:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EC3363F4F for ; Wed, 5 Apr 2023 16:13:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90945C433EF; Wed, 5 Apr 2023 16:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680711192; bh=BgZ2eR1AMfTLT7IXUy09mn13VpKwlChWuOugjbAL2Ew=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MCQhPEA/ROBdA0GMysw8V4w4TC9dPizo+YVsyMAMp2/lEiKL611OTOfrQYtTfCRzb slUv1YM0F+UkaLhyS5vcyZameDhAmRyc/ln3ZwRT0l+t16BRB8z/RN3aViRQP/3C+V ycY+3Me4yyEod6BKC/VoQk6S30yn1QVIke7xFnH6qJAbJo39asjnkxZOfqbgve2y9F kGNnJJosk/68kGz+2VhigiIF8/GVXkAI6huZP9PR98le9IG3fYuT+sAu4KkWZ88iY1 0sCPb9dvVsXrONScmh528MKAltAPeg6ElD3u7s75cpk350FZLZZXYik9yhvtrsemkx 3cGXdhEP/jVxg== Date: Wed, 5 Apr 2023 09:13:10 -0700 From: Jaegeuk Kim To: Chao Yu Cc: Yangtao Li , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] f2fs: merge lz4hc_compress_pages() to lz4_compress_pages() Message-ID: References: <20230330164948.29644-1-frank.li@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/05, Chao Yu wrote: > On 2023/3/31 0:49, Yangtao Li wrote: > > +#ifdef CONFIG_F2FS_FS_LZ4HC > > + unsigned char level = F2FS_I(cc->inode)->i_compress_level; > > if (level) > > len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen, > > cc->clen, level, cc->private); > > else > > [snip] > > > #endif > > [snip] > > > + len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, > > It's weired that whole else xxx; statement is split by #endif. > > What about? > > unsigned char level = 0; > > #if > ... > #endif > if (!level) > len = LZ4_compress_default() I modified like this. --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -266,17 +266,19 @@ static void lz4_destroy_compress_ctx(struct compress_ctx *cc) static int lz4_compress_pages(struct compress_ctx *cc) { - int len; -#ifdef CONFIG_F2FS_FS_LZ4HC + int len = -EINVAL; unsigned char level = F2FS_I(cc->inode)->i_compress_level; - if (level) + if (!level) + len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, + cc->clen, cc->private); +#ifdef CONFIG_F2FS_FS_LZ4HC + else len = LZ4_compress_HC(cc->rbuf, cc->cbuf->cdata, cc->rlen, cc->clen, level, cc->private); - else #endif - len = LZ4_compress_default(cc->rbuf, cc->cbuf->cdata, cc->rlen, - cc->clen, cc->private); + if (len < 0) + return len; if (!len) return -EAGAIN; > > Thanks, > > > cc->clen, cc->private); > > if (!len) > > return -EAGAIN;