===================================================================
@@ -492,9 +492,8 @@ void dm_set_device_limits(struct dm_targ
return;
}
- if (blk_stack_limits(&ti->limits, &q->limits, 0) < 0)
- DMWARN("%s: target device %s is misaligned",
- dm_device_name(ti->table->md), bdevname(bdev, b));
+ /* Copy queue_limits from underlying device */
+ ti->limits = q->limits;
/*
* Check if merge fn is supported.
@@ -643,34 +642,6 @@ int dm_split_args(int *argc, char ***arg
return 0;
}
-static void init_valid_queue_limits(struct queue_limits *limits)
-{
- if (!limits->max_sectors)
- limits->max_sectors = SAFE_MAX_SECTORS;
- if (!limits->max_hw_sectors)
- limits->max_hw_sectors = SAFE_MAX_SECTORS;
- if (!limits->max_phys_segments)
- limits->max_phys_segments = MAX_PHYS_SEGMENTS;
- if (!limits->max_hw_segments)
- limits->max_hw_segments = MAX_HW_SEGMENTS;
- if (!limits->logical_block_size)
- limits->logical_block_size = 1 << SECTOR_SHIFT;
- if (!limits->physical_block_size)
- limits->physical_block_size = 1 << SECTOR_SHIFT;
- if (!limits->io_min)
- limits->io_min = 1 << SECTOR_SHIFT;
- if (!limits->max_segment_size)
- limits->max_segment_size = MAX_SEGMENT_SIZE;
- if (!limits->seg_boundary_mask)
- limits->seg_boundary_mask = BLK_SEG_BOUNDARY_MASK;
- if (!limits->bounce_pfn)
- limits->bounce_pfn = -1;
- /*
- * The other fields (alignment_offset, io_opt, misaligned)
- * hold 0 from the kzalloc().
- */
-}
-
/*
* Impose necessary and sufficient conditions on a devices's table such
* that any incoming bio which respects its logical_block_size can be
@@ -788,12 +759,6 @@ int dm_table_add_target(struct dm_table
t->highs[t->num_targets++] = tgt->begin + tgt->len - 1;
- if (blk_stack_limits(&t->limits, &tgt->limits, 0) < 0)
- DMWARN("%s: target device (start sect %llu len %llu) "
- "is misaligned",
- dm_device_name(t->md),
- (unsigned long long) tgt->begin,
- (unsigned long long) tgt->len);
return 0;
bad:
@@ -836,8 +801,6 @@ int dm_table_complete(struct dm_table *t
int r = 0;
unsigned int leaf_nodes;
- init_valid_queue_limits(&t->limits);
-
r = validate_hardware_logical_block_alignment(t);
if (r)
return r;
@@ -958,8 +921,25 @@ no_integrity:
void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
{
/*
- * Copy table's limits to the DM device's request_queue
+ * Initialize table's queue_limits and merge each underlying
+ * device's queue_limits with it
+ */
+ struct dm_target *uninitialized_var(ti);
+ unsigned i = 0;
+
+ blk_set_default_limits(&t->limits);
+ while (i < dm_table_get_num_targets(t)) {
+ ti = dm_table_get_target(t, i++);
+ (void)blk_stack_limits(&t->limits, &ti->limits, 0);
+ }
+
+ /*
+ * Each target device in the table has a data area that is aligned
+ * (via LVM2) so the DM device's alignment_offset should be 0.
*/
+ t->limits.alignment_offset = 0;
+
+ /* Copy table's queue_limits to the DM device's request_queue */
q->limits = t->limits;
if (t->limits.no_cluster)