Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 74d4ce9

Browse files
Coly Liaxboe
authored andcommitted
bcache: code cleanup in __bch_bucket_alloc_set()
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@suse.de> Link: https://lore.kernel.org/r/20240528120914.28705-4-colyli@suse.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0535693 commit 74d4ce9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/md/bcache/alloc.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
498498

499499
ca = c->cache;
500500
b = bch_bucket_alloc(ca, reserve, wait);
501-
if (b == -1)
502-
goto err;
501+
if (b < 0)
502+
return -1;
503503

504504
k->ptr[0] = MAKE_PTR(ca->buckets[b].gen,
505505
bucket_to_sector(c, b),
@@ -508,10 +508,6 @@ int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
508508
SET_KEY_PTRS(k, 1);
509509

510510
return 0;
511-
err:
512-
bch_bucket_free(c, k);
513-
bkey_put(c, k);
514-
return -1;
515511
}
516512

517513
int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,

0 commit comments

Comments
 (0)