Commit b27d7f16 authored by Martin K. Petersen's avatar Martin K. Petersen Committed by Jens Axboe

DM: Fix device mapper topology stacking

Make DM use bdev_stack_limits() function so that partition offsets get
taken into account when calculating alignment.  Clarify stacking
warnings.

Also remove obsolete clearing of final alignment_offset and misalignment
flag.
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Cc: Alasdair G. Kergon <agk@redhat.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 17be8c24
...@@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, ...@@ -503,16 +503,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
return 0; return 0;
} }
if (blk_stack_limits(limits, &q->limits, start << 9) < 0) if (bdev_stack_limits(limits, bdev, start) < 0)
DMWARN("%s: target device %s is misaligned: " DMWARN("%s: adding target device %s caused an alignment inconsistency: "
"physical_block_size=%u, logical_block_size=%u, " "physical_block_size=%u, logical_block_size=%u, "
"alignment_offset=%u, start=%llu", "alignment_offset=%u, start=%llu",
dm_device_name(ti->table->md), bdevname(bdev, b), dm_device_name(ti->table->md), bdevname(bdev, b),
q->limits.physical_block_size, q->limits.physical_block_size,
q->limits.logical_block_size, q->limits.logical_block_size,
q->limits.alignment_offset, q->limits.alignment_offset,
(unsigned long long) start << 9); (unsigned long long) start << SECTOR_SHIFT);
/* /*
* Check if merge fn is supported. * Check if merge fn is supported.
...@@ -1026,9 +1025,9 @@ combine_limits: ...@@ -1026,9 +1025,9 @@ combine_limits:
* for the table. * for the table.
*/ */
if (blk_stack_limits(limits, &ti_limits, 0) < 0) if (blk_stack_limits(limits, &ti_limits, 0) < 0)
DMWARN("%s: target device " DMWARN("%s: adding target device "
"(start sect %llu len %llu) " "(start sect %llu len %llu) "
"is misaligned", "caused an alignment inconsistency",
dm_device_name(table->md), dm_device_name(table->md),
(unsigned long long) ti->begin, (unsigned long long) ti->begin,
(unsigned long long) ti->len); (unsigned long long) ti->len);
...@@ -1079,15 +1078,6 @@ no_integrity: ...@@ -1079,15 +1078,6 @@ no_integrity:
void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
struct queue_limits *limits) struct queue_limits *limits)
{ {
/*
* Each target device in the table has a data area that should normally
* be aligned such that the DM device's alignment_offset is 0.
* FIXME: Propagate alignment_offsets up the stack and warn of
* sub-optimal or inconsistent settings.
*/
limits->alignment_offset = 0;
limits->misaligned = 0;
/* /*
* Copy table's limits to the DM device's request_queue * Copy table's limits to the DM device's request_queue
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment