]> Git Repo - linux.git/commitdiff
bcache: code cleanup in __bch_bucket_alloc_set()
authorColy Li <[email protected]>
Tue, 28 May 2024 12:09:14 +0000 (20:09 +0800)
committerJens Axboe <[email protected]>
Tue, 28 May 2024 12:55:59 +0000 (06:55 -0600)
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
drivers/md/bcache/alloc.c

index 32a46343097dd81e203eb18c2a74372bb1fef587..48ce750bf70af95c50888ab5b8622891160e59d0 100644 (file)
@@ -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);
-       return -1;
 }
 
 int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
This page took 0.059853 seconds and 4 git commands to generate.