Re: [PATCH 3/3] bcache: code cleanup in __bch_bucket_alloc_set()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> 2024年5月28日 06:33,Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> 写道:
> 
> On Tue, 28 May 2024, Coly Li wrote:
>> In __bch_bucket_alloc_set() the lines after lable 'err:' indeed do
>> nothing useful after multiple cache devices are removed from bcache
>> code. This cleanup patch drops the useless code to save a bit CPU
>> cycles.
>> 
>> Signed-off-by: Coly Li <colyli@xxxxxxx>
>> ---
>> drivers/md/bcache/alloc.c | 8 ++------
>> 1 file changed, 2 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
>> index 32a46343097d..48ce750bf70a 100644
>> --- a/drivers/md/bcache/alloc.c
>> +++ b/drivers/md/bcache/alloc.c
>> @@ -498,8 +498,8 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
>> 
>> ca = c->cache;
>> b = bch_bucket_alloc(ca, reserve, wait);
>> - if (b == -1)
>> - goto err;
>> + if (b < 0)
>> + return -1;
>> 
>> k->ptr[0] = MAKE_PTR(ca->buckets[b].gen,
>>     bucket_to_sector(c, b),
>> @@ -508,10 +508,6 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
>> SET_KEY_PTRS(k, 1);
>> 
>> return 0;
>> -err:
>> - bch_bucket_free(c, k);
>> - bkey_put(c, k);
> 
> 
> Is there a matching "get" somewhere that should be removed, too?

No, it is unnecessary and should be avoided. Because k is ZERO_KEY here, calling bch_bucket_free() and bkey_put() are NOOP indeed.

Coly Li






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux