Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp252997rwl; Thu, 6 Apr 2023 18:35:26 -0700 (PDT) X-Google-Smtp-Source: AKy350ZxHqtJiV0aoWFKo1B5YEppE2F4ZujbQ4+zQVKMkFOhXNUaRjoRcu/lmxg+CTsQDbQv2v8f X-Received: by 2002:a17:90b:388e:b0:23f:5a17:ac74 with SMTP id mu14-20020a17090b388e00b0023f5a17ac74mr749250pjb.0.1680831326251; Thu, 06 Apr 2023 18:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680831326; cv=none; d=google.com; s=arc-20160816; b=WnaSlmB4Ms6jRcGKZtgTb7txRv+sXE01A2O/oDPWYBdZ/HATPOXtvnl0XvVVs1/RyV GaRGL13K8sdcXAYrUwaGXCrUQrlb5KlDNLQdA6QPUBFbGq2T3NZ1zdb+4h15c79IqT1q QcmEqDb+EUnLMld6q2zGHTvvhuqNGjcANoc5uMJw66GoXXbrE6IfZwvB0t/Q+2AXgUrJ 7zVAghLOk5pJFU83yLijUB5rzBQXWyuSV01mXyblvn5oi/uAY0u9UoUU66K9fmJYlRSk 4El8jlceuRSZ0Np32WsaXMZn0AGSRU4M88elhuSs1Cddm+8fsWwGG04+dKSyElXxrRSI dNRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vIPOZeXRovcQVkHP2ECMQz007LBeK4nvWFfQ+MgN4bw=; b=d5VtdzapAV3WoUUs1YsLGKz/WM+CUXWzAInjSTZU06iAiVMHlNG70cfd89iFSvch8R ELR1PqLakB3foVP41p0kPKXoaVHJuavgWeGBsx1mww5V3iYHEfGtG4PBTfd40uXjch98 Clk950tDajVCuARJLJ3u6IdfNSpOQb/vXfRyRv3FhFFUfjK4FPitINAQuACE7YQd5I1N Hng8XKt8XV/QFQC84liPKI5QciQdMqU0atOeVdNVEer/f1z81lEXQ8c9sRFTxQQ+Sd8L ArQWhv80Zq/Mh+IwNn6vVXQcL19RgDy3RlqG2zJt0D211q/H82NadYCpAHAAWikqJTAK 2YGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KhBSoofF; 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 t10-20020a63444a000000b00513162c2241si2401440pgk.188.2023.04.06.18.35.13; Thu, 06 Apr 2023 18:35:26 -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=KhBSoofF; 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 S233589AbjDGBW2 (ORCPT + 99 others); Thu, 6 Apr 2023 21:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbjDGBW1 (ORCPT ); Thu, 6 Apr 2023 21:22:27 -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 4B20B49FF for ; Thu, 6 Apr 2023 18:22:26 -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 DB6ED64052 for ; Fri, 7 Apr 2023 01:22:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54CCCC433D2; Fri, 7 Apr 2023 01:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680830545; bh=YAEuWYm9lK18MqiZgFjU2fpTN2+518FfqL/Eo+yVUY4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=KhBSoofFLD9bp1DKr+0j3g2IeG+Z+0XB++sZioLL6m6Wj2BZ6eXDflwG5O2gJZXIa 25GGvf4+APi8azyL5B46z3itwHtxi6F1tAeoMD5MvRtbrfAuPRDydycA1McQJ/Lg37 zmfUnZJwoIzSGbJHEGXugUBzFD5Fivy8OJkaaBdpqn8kRKazjGHBpyRfD9o3HXUh6b 1DaZTAkkAaS3tf5VoVbPWZIx/kyi6VpKGVATE0l4FeOilcIamFV1CYEvIJqGqOVohS YGTFw7bA1WaUfiSQWDGMfUWqlUb7DBsm2rZ3t+zERql+CVusz+l0Gf7hrUG0524Vcn alaVaOWPPodQA== Message-ID: Date: Fri, 7 Apr 2023 09:22:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v2] f2fs: merge lz4hc_compress_pages() to lz4_compress_pages() Content-Language: en-US To: Jaegeuk Kim Cc: Yangtao Li , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20230330164948.29644-1-frank.li@vivo.com> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 2023/4/6 0:13, Jaegeuk Kim wrote: > 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; > Better. Reviewed-by: Chao Yu Thanks,