Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9420481rwl; Wed, 11 Jan 2023 05:36:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXt0GULI6Kqc8melhNVDOS07KvlI2FCmrhyUMZxvN3SBpMsNyHrxDJZb+Q5FfMeR1TU+67VS X-Received: by 2002:a05:6a20:bf23:b0:a5:798c:f929 with SMTP id gc35-20020a056a20bf2300b000a5798cf929mr79079442pzb.10.1673444210165; Wed, 11 Jan 2023 05:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673444210; cv=none; d=google.com; s=arc-20160816; b=E2jB5OaxI4796W7CRpg3eurqfAQWPgBM+jmTSaZW8aYtK0a7pB22q6J7s2dgH8VMxT EDaJz+I8h+NEVLBMDePH0xnJJIS4w/iP2aZjwJGXSWRMi9y/EyMgxecQEucOvYG2S81K lBhnM+WPZGUPQa8LDX+m/uFPlExl9TQs/7fTnxT2rTqMph5wrl9+ml/+Y34loph4kASa N3XZ9OSAEgpThANZAEwGFuOLbKwe3K1QvZng/gKYK0aeEZ7t/SX/7B1NmZr82QKh0E7x mOA2J0XIr2qf6KLwAziIZedL+cwUvrdOwmiNW96TqDKtE0L+QPhqkT/bs04I7nLlvmne jZfQ== 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:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=i379AXdDm0SC0Ki5HyZ6B4Wsuui+F5Ds563f6oUNynU=; b=eGfy/LNAAx7OKFMLJGswWMu32bUiBnR221u4CHRkxGJzhCDvOR3LFMPS+M0zFuopQl at4+bjFFnuANj0X1osQmQI7AJhqBVkYWlc1iUjAgVVnQ2FwxWKVHuOLa5ZbS5xfCXBCm i+P6PgPIDgpt9hTr1mcv8QhG1dUYdWo9W7Vuei/3wrgjjNPODvN5flFMZEknctPnKXG8 DqFs/pvH6Yn6AtrTT2QI2NM56uB+aO3/KG3FFm4VN7GyTXAhfYQHgypGPK/FQE7CMVUF HA3AIq6+6k+au1m74C2arWxxBdgiPnFRJLmdO0X5fpKZU+/ab9XIjJ8pHaAFVHyX6EKh 8vFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="C/ZQrkW+"; 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 i9-20020a17090a65c900b0021bc843908esi16927683pjs.119.2023.01.11.05.36.42; Wed, 11 Jan 2023 05:36:50 -0800 (PST) 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="C/ZQrkW+"; 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 S238741AbjAKN3w (ORCPT + 55 others); Wed, 11 Jan 2023 08:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238397AbjAKN3b (ORCPT ); Wed, 11 Jan 2023 08:29:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A1B62E2 for ; Wed, 11 Jan 2023 05:25:57 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 4A612B81BE6 for ; Wed, 11 Jan 2023 13:25:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9192BC433EF; Wed, 11 Jan 2023 13:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673443555; bh=M20/WHbbHylbZdX8Uu54Y8EoLEkklBuaRyDGzuWSCeU=; h=Date:To:Cc:References:From:Subject:In-Reply-To:From; b=C/ZQrkW+J8kGwmGWfLtDA3bHIdDLV93wXJfBHcYAzlr9mEn7ExI+UZDnMExUuDAfy RE83+xaAEvcywLWDF2AABnrZ0XTuiluYrXuwV+QPE1hOrsryTGBGji1SVKSyTLesJe rNtLxSI9VYgFEESnpT/krOwIydmljrcThTfb5tFcMjEdRHAPGeONOGozElRmgIlSrz Zt2LJmzFxqawEZXauZ4khaVnxnjKjx1nNdxV7WUlUgIC69Q1v18gBEkbKioV6f9lcn CzQeBG3ZhGepP/EUavmaO3Qq0/Joy9r/O4IOanARr6p9Q/wA6NoudxBKby2Y41/MGI pUMgPREBhQOTQ== Message-ID: <59f19f5f-dcde-6042-cbc1-eee4b3d2469b@kernel.org> Date: Wed, 11 Jan 2023 21:25:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US To: Yangtao Li , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20221222081855.81553-1-frank.li@vivo.com> From: Chao Yu Subject: Re: [PATCH] f2fs: drop useless initializer and unneeded local variable In-Reply-To: <20221222081855.81553-1-frank.li@vivo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 2022/12/22 16:18, Yangtao Li wrote: > No need to initialize idx twice. BTW, remove the unnecessary cnt variable. > > Signed-off-by: Yangtao Li > --- > fs/f2fs/iostat.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c > index 3166a8939ed4..335b055ffe7d 100644 > --- a/fs/f2fs/iostat.c > +++ b/fs/f2fs/iostat.c > @@ -97,8 +97,7 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset) > > static inline void __record_iostat_latency(struct f2fs_sb_info *sbi) > { > - int io, idx = 0; > - unsigned int cnt; > + int io, idx; > struct f2fs_iostat_latency iostat_lat[MAX_IO_TYPE][NR_PAGE_TYPE]; > struct iostat_lat_info *io_lat = sbi->iostat_io_lat; > unsigned long flags; > @@ -106,12 +105,11 @@ static inline void __record_iostat_latency(struct f2fs_sb_info *sbi) > spin_lock_irqsave(&sbi->iostat_lat_lock, flags); > for (idx = 0; idx < MAX_IO_TYPE; idx++) { > for (io = 0; io < NR_PAGE_TYPE; io++) { > - cnt = io_lat->bio_cnt[idx][io]; > iostat_lat[idx][io].peak_lat = > jiffies_to_msecs(io_lat->peak_lat[idx][io]); > - iostat_lat[idx][io].cnt = cnt; > - iostat_lat[idx][io].avg_lat = cnt ? > - jiffies_to_msecs(io_lat->sum_lat[idx][io]) / cnt : 0; > + iostat_lat[idx][io].cnt = io_lat->bio_cnt[idx][io]; > + iostat_lat[idx][io].avg_lat = iostat_lat[idx][io].cnt ? > + jiffies_to_msecs(io_lat->sum_lat[idx][io]) / iostat_lat[idx][io].cnt : 0; exceed 80 column? Thanks, > io_lat->sum_lat[idx][io] = 0; > io_lat->peak_lat[idx][io] = 0; > io_lat->bio_cnt[idx][io] = 0;