Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3775354 authored by Kent Overstreet's avatar Kent Overstreet Committed by Jens Axboe
Browse files

dm: Use kzalloc for all structs with embedded biosets/mempools



mempool_init()/bioset_init() require that the mempools/biosets be zeroed
first; they probably should not _require_ this, but not allocating those
structs with kzalloc is a fairly nonsensical thing to do (calling
mempool_exit()/bioset_exit() on an uninitialized mempool/bioset is legal
and safe, but only works if said memory was zeroed.)

Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0196d6b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ static struct kmem_cache *_cell_cache;
 */
struct dm_bio_prison *dm_bio_prison_create(void)
{
	struct dm_bio_prison *prison = kmalloc(sizeof(*prison), GFP_KERNEL);
	struct dm_bio_prison *prison = kzalloc(sizeof(*prison), GFP_KERNEL);
	int ret;

	if (!prison)
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static struct kmem_cache *_cell_cache;
 */
struct dm_bio_prison_v2 *dm_bio_prison_create_v2(struct workqueue_struct *wq)
{
	struct dm_bio_prison_v2 *prison = kmalloc(sizeof(*prison), GFP_KERNEL);
	struct dm_bio_prison_v2 *prison = kzalloc(sizeof(*prison), GFP_KERNEL);
	int ret;

	if (!prison)
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ struct dm_io_client *dm_io_client_create(void)
	unsigned min_ios = dm_get_reserved_bio_based_ios();
	int ret;

	client = kmalloc(sizeof(*client), GFP_KERNEL);
	client = kzalloc(sizeof(*client), GFP_KERNEL);
	if (!client)
		return ERR_PTR(-ENOMEM);

+1 −1
Original line number Diff line number Diff line
@@ -882,7 +882,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro
	int r;
	struct dm_kcopyd_client *kc;

	kc = kmalloc(sizeof(*kc), GFP_KERNEL);
	kc = kzalloc(sizeof(*kc), GFP_KERNEL);
	if (!kc)
		return ERR_PTR(-ENOMEM);

+1 −1
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ struct dm_region_hash *dm_region_hash_create(
		;
	nr_buckets >>= 1;

	rh = kmalloc(sizeof(*rh), GFP_KERNEL);
	rh = kzalloc(sizeof(*rh), GFP_KERNEL);
	if (!rh) {
		DMERR("unable to allocate region hash memory");
		return ERR_PTR(-ENOMEM);
Loading