aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-table.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r--drivers/md/dm-table.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 16ba55ad7089..a5f94125ad01 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -942,21 +942,28 @@ static int dm_table_alloc_md_mempools(struct dm_table *t, struct mapped_device *
942{ 942{
943 unsigned type = dm_table_get_type(t); 943 unsigned type = dm_table_get_type(t);
944 unsigned per_bio_data_size = 0; 944 unsigned per_bio_data_size = 0;
945 struct dm_target *tgt;
946 unsigned i; 945 unsigned i;
947 946
948 if (unlikely(type == DM_TYPE_NONE)) { 947 switch (type) {
948 case DM_TYPE_BIO_BASED:
949 for (i = 0; i < t->num_targets; i++) {
950 struct dm_target *tgt = t->targets + i;
951
952 per_bio_data_size = max(per_bio_data_size,
953 tgt->per_bio_data_size);
954 }
955 t->mempools = dm_alloc_bio_mempools(t->integrity_supported,
956 per_bio_data_size);
957 break;
958 case DM_TYPE_REQUEST_BASED:
959 case DM_TYPE_MQ_REQUEST_BASED:
960 t->mempools = dm_alloc_rq_mempools(md, type);
961 break;
962 default:
949 DMWARN("no table type is set, can't allocate mempools"); 963 DMWARN("no table type is set, can't allocate mempools");
950 return -EINVAL; 964 return -EINVAL;
951 } 965 }
952 966
953 if (type == DM_TYPE_BIO_BASED)
954 for (i = 0; i < t->num_targets; i++) {
955 tgt = t->targets + i;
956 per_bio_data_size = max(per_bio_data_size, tgt->per_bio_data_size);
957 }
958
959 t->mempools = dm_alloc_md_mempools(md, type, t->integrity_supported, per_bio_data_size);
960 if (!t->mempools) 967 if (!t->mempools)
961 return -ENOMEM; 968 return -ENOMEM;
962 969