diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-12-08 20:40:52 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-12-13 18:16:00 +0100 |
commit | 0776aa0e30aa31b2fad606457e9d3faf39d88314 (patch) | |
tree | 251b9ea6e8630a9267a9bbf757f4aa357b736757 /drivers/md/dm-table.c | |
parent | dm: remove BIOSET_NEED_RESCUER based dm_offload infrastructure (diff) | |
download | linux-0776aa0e30aa31b2fad606457e9d3faf39d88314.tar.xz linux-0776aa0e30aa31b2fad606457e9d3faf39d88314.zip |
dm: ensure bio-based DM's bioset and io_pool support targets' maximum IOs
alloc_multiple_bios() assumes it can allocate the requested number of
bios but until now there was no gaurantee that the mempools would be
accomodating.
Suggested-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index aaffd0c0ee9a..7b22cc8d30f4 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1079,7 +1079,8 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device * { enum dm_queue_mode type = dm_table_get_type(t); unsigned per_io_data_size = 0; - struct dm_target *tgt; + unsigned min_pool_size = 0; + struct dm_target *ti; unsigned i; if (unlikely(type == DM_TYPE_NONE)) { @@ -1089,11 +1090,13 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device * if (__table_type_bio_based(type)) for (i = 0; i < t->num_targets; i++) { - tgt = t->targets + i; - per_io_data_size = max(per_io_data_size, tgt->per_io_data_size); + ti = t->targets + i; + per_io_data_size = max(per_io_data_size, ti->per_io_data_size); + min_pool_size = max(min_pool_size, ti->num_flush_bios); } - t->mempools = dm_alloc_md_mempools(md, type, t->integrity_supported, per_io_data_size); + t->mempools = dm_alloc_md_mempools(md, type, t->integrity_supported, + per_io_data_size, min_pool_size); if (!t->mempools) return -ENOMEM; |