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
Reply to
Ming Lei, 2021-01-05
quoted hunk ↗ jump to hunk
+	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>
Thread (9 messages) 9 messages, 2 authors, last reply 2021-01-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help