# Re: \[PATCH V2 1/6\] block: manage bio slab cache by xarray

- From: Christoph Hellwig \<hch@lst.de\>
- Date: 2021-01-05 15:42:03 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/01/6400050
- Thread: https://ratatoskr.run/linux-block/2021/01/6400041/t.md

```text
> +	bslab->slab = kmem_cache_create(bslab->name, size,
> +			ARCH_KMALLOC_MINALIGN, SLAB_HWCACHE_ALIGN, NULL);
> +	if (!bslab->slab) {
> +		kfree(bslab);
> +		return NULL;
>  	}
>  
> +	bslab->slab_ref = 1;
> +	bslab->slab_size = size;
> +
> +	if (xa_err(xa_store(&bio_slabs, size, bslab, GFP_KERNEL))) {
> +		kmem_cache_destroy(bslab->slab);
> +		kfree(bslab);
> +		return NULL;
>  	}
> +	return bslab;

I'd prefer a label so that the error return and freeing of bslab is
shared between the two error conditions.

Otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
```
