[dm-devel] dm: Fix alignment stacking on partitioned devices

Martin K. Petersen martin.petersen at oracle.com
Tue Dec 22 17:41:31 UTC 2009


>>>>> "Mike" == Mike Snitzer <snitzer at redhat.com> writes:

Mike,

Mike> OK, so is MD somehow getting things wrong?  (You originally said
Mike> that with the new stacking function MD resulted in an error but DM
Mike> did not).

MD is passing in absolute offsets and got the right result in both
cases.


Mike> "start" isn't a relative offset.  

It's relative to the beginning of the partition (block_device), not
relative to the beginning of the disk (request_queue).

My beef here is that DM created a device like this:

[root at 10 ~]# pvs -o +pe_start
  PV         VG   Fmt  Attr PSize   PFree   1st PE 
  /dev/sde1  foo  lvm2 a-   508.00M 256.00M 192.00K
  /dev/sde2  foo  lvm2 a-   512.00M 260.00M 192.00K
[root at 10 ~]# dmsetup table
foo-bar: 0 1032192 striped 2 32 8:66 384 8:65 384

/dev/sde  has an alignment_offset of 3584
/dev/sde1 has an alignment_offset of 0
/dev/sde2 has an alignment_offset of 1024

dm_set_device_limits() calls blk_stack_limits() with a byte offset of
196608 for both sde1 and sde2.  And that offset is checked for alignment
with the queue's limits which has an alignment_offset of 3584.

The two PVs are misaligned but that information is lost because you use
blk_stack_limits() with partition-relative offsets.  My patch was an
attempt to fix that.

Test case:

# modprobe scsi_debug dev_size_mb=1024 num_parts=2 lowest_aligned=7 physblk_exp=3
# pvcreate /dev/sde1
# pvcreate /dev/sde2
# vgcreate foo /dev/sde1 /dev/sde2
# lvcreate -I 16 -i 2 -L 500M -n bar foo

-- 
Martin K. Petersen	Oracle Linux Engineering




More information about the dm-devel mailing list