[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <104c5965-fbbe-b306-e835-5f2bbf60aa7f@gmail.com>
Date: Tue, 17 Nov 2020 11:17:17 +0800
From: kaixuxia <xiakaixu1987@...il.com>
To: dsterba@...e.cz, dsterba@...e.com
Cc: clm@...com, josef@...icpanda.com, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org, Kaixu Xia <kaixuxia@...cent.com>
Subject: Re: [PATCH] btrfs: remove the useless value assignment in
block_rsv_release_bytes
On 2020/11/16 23:15, David Sterba wrote:
> On Sun, Nov 15, 2020 at 02:39:23PM +0800, xiakaixu1987@...il.com wrote:
>> From: Kaixu Xia <kaixuxia@...cent.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
Powered by blists - more mailing lists