aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2011-03-17 06:11:05 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-03-17 06:11:05 -0400
commita91a2785b200864aef2270ed6a3babac7a253a20 (patch)
tree3d21d7ef82ddabbdbfb74499d68a73f15adc819f /drivers/md/dm.c
parent82f04ab47e1d94d78503591a7460b2cad9601ede (diff)
block: Require subsystems to explicitly allocate bio_set integrity mempool
MD and DM create a new bio_set for every metadevice. Each bio_set has an integrity mempool attached regardless of whether the metadevice is capable of passing integrity metadata. This is a waste of memory. Instead we defer the allocation decision to MD and DM since we know at metadevice creation time whether integrity passthrough is needed or not. Automatic integrity mempool allocation can then be removed from bioset_create() and we make an explicit integrity allocation for the fs_bio_set. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Acked-by: Mike Snitzer <snizer@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index d22b9905c168..88820704a191 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2620,9 +2620,10 @@ int dm_noflush_suspending(struct dm_target *ti)
2620} 2620}
2621EXPORT_SYMBOL_GPL(dm_noflush_suspending); 2621EXPORT_SYMBOL_GPL(dm_noflush_suspending);
2622 2622
2623struct dm_md_mempools *dm_alloc_md_mempools(unsigned type) 2623struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity)
2624{ 2624{
2625 struct dm_md_mempools *pools = kmalloc(sizeof(*pools), GFP_KERNEL); 2625 struct dm_md_mempools *pools = kmalloc(sizeof(*pools), GFP_KERNEL);
2626 unsigned int pool_size = (type == DM_TYPE_BIO_BASED) ? 16 : MIN_IOS;
2626 2627
2627 if (!pools) 2628 if (!pools)
2628 return NULL; 2629 return NULL;
@@ -2639,13 +2640,18 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type)
2639 if (!pools->tio_pool) 2640 if (!pools->tio_pool)
2640 goto free_io_pool_and_out; 2641 goto free_io_pool_and_out;
2641 2642
2642 pools->bs = (type == DM_TYPE_BIO_BASED) ? 2643 pools->bs = bioset_create(pool_size, 0);
2643 bioset_create(16, 0) : bioset_create(MIN_IOS, 0);
2644 if (!pools->bs) 2644 if (!pools->bs)
2645 goto free_tio_pool_and_out; 2645 goto free_tio_pool_and_out;
2646 2646
2647 if (integrity && bioset_integrity_create(pools->bs, pool_size))
2648 goto free_bioset_and_out;
2649
2647 return pools; 2650 return pools;
2648 2651
2652free_bioset_and_out:
2653 bioset_free(pools->bs);
2654
2649free_tio_pool_and_out: 2655free_tio_pool_and_out:
2650 mempool_destroy(pools->tio_pool); 2656 mempool_destroy(pools->tio_pool);
2651 2657