Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2813563pxj; Mon, 17 May 2021 10:20:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQolTpV9hD5zHTForEh8y9ZeLR7XcL9KkzhKp8JXictso2L8/Laws5YZmdkB9zfpPrhGSC X-Received: by 2002:a17:907:161f:: with SMTP id hb31mr1034880ejc.514.1621272022117; Mon, 17 May 2021 10:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621272022; cv=none; d=google.com; s=arc-20160816; b=yya2jIbzYeV/rYApPUvDz3Ua5sdW3oFFzEFmuUdP+MUP7SyIv8h9qBlzIzTQuDFCJu hYPKZVlqZSrRWoSLmuNoXqvvF3Pto3zZY2fLrPEnO1eVMsCY42VS3RxV9ID3S+Ndkjt9 zqpL9wR4/0Pk7UAsmdO/Ahl5eE9HiqeZa7UxqSc5C/x7FMSunFsqO4evLL5Y1vVPKDLb jZfg1p9GAgdNecxUOE+laN508rIGanKOfLUaeGpgl15UfiYwIQwbZbuJfV4uY367S+pv 9xn/f1OQzYloIIb+XwZwvQ7FstC8go1fOjYbDvuET2ea5hCflfyh7aoaXlC3jIXRFxbX xRQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=Qy2caDS4XFb/AW7rLi94xAj0rUbhzK37slT4ntBBKR8=; b=W0FIH4IywlQufyWAbKyFBkFgnjMgHnGR/s1kGBmptsueJG2hd2UJh8I3z8Dhsso7tZ iZ0WzZaqZ2I3bd0WOGqViyWxQSRdSXHmb/vffHXRzvQkZjJqgZ8CPXOWerBmfeVAQM5e idVmkbC15uEIDs/1p7mZ+AyI8fLpZP8JKzRS6Bv3LGPpj4G/DbLPpJbGOFX7DLcceok6 pKf1tSYK7DNl9pIAvlqjA32QFavOiLSVfBFoDH/5WCkZgB/btyjh8ZWGxQaf23PcGw+0 httuisvOmtZLbJx/s0ZAihXNSN9qWfs6h/98WDQEQf5J8jhSb0j2bXeT8fFMRn5Coa4h 67mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="c/Pc4PFw"; 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=gmx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kt11si14698601ejb.655.2021.05.17.10.19.57; Mon, 17 May 2021 10:20:22 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b="c/Pc4PFw"; 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=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236259AbhEQKP0 (ORCPT + 99 others); Mon, 17 May 2021 06:15:26 -0400 Received: from mout.gmx.net ([212.227.15.15]:37943 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229474AbhEQKPZ (ORCPT ); Mon, 17 May 2021 06:15:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1621246437; bh=v94oBgU27MM+bPMwIq+5aXQmdE9Vdj1PZQAxw8h2u24=; h=X-UI-Sender-Class:To:Cc:References:From:Subject:Date:In-Reply-To; b=c/Pc4PFw4OplGruKpXYpfyLHMAmlItPh6lURIPdrPBMk1ZTJKSBBgQjTiaFegYQKr RyMcABxzYgRnlUoooONbjkCk8YNzuzggtqXnClXSt1uBmHe4zhHrNcj8O1wNhtuFjz nrEfxIpEQEj3i/z5lU/0WB7p9PaDFL7sVuSsi9Ow= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N7zBR-1lMQlj0u8Z-014zCc; Mon, 17 May 2021 12:13:56 +0200 To: Yang Li , clm@fb.com Cc: josef@toxicpanda.com, dsterba@suse.com, nathan@kernel.org, ndesaulniers@google.com, linux-btrfs@vger.kernel.org, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com References: <1621244810-38832-1-git-send-email-yang.lee@linux.alibaba.com> From: Qu Wenruo Subject: Re: [PATCH v2] btrfs: Remove redundant initialization of 'to_add' Message-ID: <5938551d-a083-a62c-4ab3-bc29fc62b1df@gmx.com> Date: Mon, 17 May 2021 18:13:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1621244810-38832-1-git-send-email-yang.lee@linux.alibaba.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:0U/g3hMrG3o9fGlDnHRwXK68W/K/FH6/b8eQv0VDDz9dIoTuExD xiqwfwDQjRUSbpsNx+V1gb4ixIk+Gbu8vRb48DLnUwvhlCqjKIizRtaHsZpe0hoW7KvFJyw NKlCxDKqndQ3Bdx5RHdM/anE7VyaVFQpGiMtm5BBwqE4eSZaOTiIynYlx3a9sS6WhDItKGV I79EuEnKM4vzA+F17vjEw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:EPaV5kE0SOE=:ncrqL6P/aa5VszjRuabaVJ v0NDRFGqT4o6+C9MIYC7tdXkezCnrPaKX9AQ5GKXGf7MSx2vRxow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YmTAKQlVhOSTo4C93nrNHDUkshMrxjeUD1wX3PfeSeorV8 O2JTWFXuUEXjiXRL3XAwY0PBfPvN9zufUtQGpWUDUDmfJhTLDNwSCfpTWWAqlumWwgMaO5LQ2 ogOYv3hOMnM8x6XXv Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/5/17 =E4=B8=8B=E5=8D=885:46, Yang Li wrote: > Variable 'to_add' is being initialized however this value is never > read as 'to_add' is assigned a new value in if statement. Remove the > redundant assignment. At the same time, move its declaration into the > if statement, because the variable is not used elsewhere. > > Clean up clang warning: > > fs/btrfs/extent-tree.c:2774:8: warning: Value stored to 'to_add' during > its initialization is never read [clang-analyzer-deadcode.DeadStores] Personally speaking, compiler should be able to optimize out such problem, nothing really worthy bothering. Especially considering these "fixes" just randomly pop up, distracting the reviewers' time. If you really believe these "fixes" are really worthy (not to just fulfill the stupid KPI), please at least pack them into a larger patchset (but keep the separate patches), not just sending one when you find one. > > Reported-by: Abaci Robot I know some maintainers are already very upset about the bot, although in your case it reduces a lifespan of a variable, thus it's marginally acceptable, but under other cases, it doesn't really help much. If such fixes come from indie developers, I'm pretty fine or even happy to help them to start more contribution. But a sponsored bot just repeating clang static analyzer Trust me, no maintainer will be happy with that, and you're destroying the reputation of your company (if the reputation hasn't been destoryed already). > Signed-off-by: Yang Li > --- > > Change in v2: > --According to Lukas's suggestion, combine the declaration and assignmen= t of > variable 'to_add' into one line, just as "u64 to_add =3D min(len, ...= );" > https://lore.kernel.org/patchwork/patch/1428697/ > > fs/btrfs/extent-tree.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c > index f1d15b6..13ac978 100644 > --- a/fs/btrfs/extent-tree.c > +++ b/fs/btrfs/extent-tree.c > @@ -2774,11 +2774,9 @@ static int unpin_extent_range(struct btrfs_fs_inf= o *fs_info, > spin_unlock(&cache->lock); > if (!readonly && return_free_space && > global_rsv->space_info =3D=3D space_info) { > - u64 to_add =3D len; > - > spin_lock(&global_rsv->lock); > if (!global_rsv->full) { > - to_add =3D min(len, global_rsv->size - > + u64 to_add =3D min(len, global_rsv->size - > global_rsv->reserved); Have you ever wondered why "global_rsv" is not indented by tab only, but with extra spaces? It's supposed to be aligned with "len". Thanks, Qu > global_rsv->reserved +=3D to_add; > btrfs_space_info_update_bytes_may_use(fs_info, >