From: kaixuxia <xiakaixu1987@gmail.com>
To: dsterba@suse.cz, dsterba@suse.com
Cc: clm@fb.com, josef@toxicpanda.com, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org, Kaixu Xia <kaixuxia@tencent.com>
Subject: Re: [PATCH] btrfs: remove the useless value assignment in block_rsv_release_bytes
Date: Tue, 17 Nov 2020 11:17:17 +0800 [thread overview]
Message-ID: <104c5965-fbbe-b306-e835-5f2bbf60aa7f@gmail.com> (raw)
In-Reply-To: <20201116151512.GJ6756@twin.jikos.cz>
On 2020/11/16 23:15, David Sterba wrote:
> On Sun, Nov 15, 2020 at 02:39:23PM +0800, xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> The variable qgroup_to_release is overwritten by the following if/else
>> statement before it is used, so this assignment is useless. Remove it.
>
> Again this lacks explanation why removing it is correct.
>
Actually this assignment is redundant because the variable qgroup_to_release
has been overwritten before it is used. The logic like this,
static u64 block_rsv_release_bytes(...)
{
...
if (num_bytes == (u64)-1) {
num_bytes = block_rsv->size;
qgroup_to_release = block_rsv->qgroup_rsv_size;
}
//qgroup_to_release isn't used
if (block_rsv->qgroup_rsv_reserved >= block_rsv->qgroup_rsv_size) {
qgroup_to_release = block_rsv->qgroup_rsv_reserved -
block_rsv->qgroup_rsv_size;
block_rsv->qgroup_rsv_reserved = block_rsv->qgroup_rsv_size;
} else {
qgroup_to_release = 0;
}//qgroup_to_release is overwritten
...
}
Thanks,
Kaixu
--
kaixuxia
next prev parent reply other threads:[~2020-11-17 3:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 6:39 [PATCH] btrfs: remove the useless value assignment in block_rsv_release_bytes xiakaixu1987
2020-11-16 15:15 ` David Sterba
2020-11-17 3:17 ` kaixuxia [this message]
2020-11-23 17:58 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=104c5965-fbbe-b306-e835-5f2bbf60aa7f@gmail.com \
--to=xiakaixu1987@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=kaixuxia@tencent.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox