It's just a simple code cleanup, not functional change. Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx> --- block/bio.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/block/bio.c b/block/bio.c index 8081906f5d01..fefd49a561ab 100644 --- a/block/bio.c +++ b/block/bio.c @@ -90,29 +90,27 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) else if (bslab->slab_size == sz) { slab = bslab->slab; bslab->slab_ref++; - break; + goto out_unlock; } i++; } - if (slab) - goto out_unlock; - - if (bio_slab_nr == bio_slab_max && entry == -1) { - new_bio_slab_max = bio_slab_max << 1; - new_bio_slabs = krealloc(bio_slabs, + if (entry == -1) { + if (bio_slab_nr == bio_slab_max) { + new_bio_slab_max = bio_slab_max << 1; + new_bio_slabs = krealloc(bio_slabs, new_bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL); - if (!new_bio_slabs) - goto out_unlock; - bio_slab_max = new_bio_slab_max; - bio_slabs = new_bio_slabs; - } - if (entry == -1) + if (!new_bio_slabs) + goto out_unlock; + bio_slab_max = new_bio_slab_max; + bio_slabs = new_bio_slabs; + } + entry = bio_slab_nr; + } bslab = &bio_slabs[entry]; - snprintf(bslab->name, sizeof(bslab->name), "bio-%d", entry); slab = kmem_cache_create(bslab->name, sz, ARCH_KMALLOC_MINALIGN, SLAB_HWCACHE_ALIGN, NULL); -- 2.20.1