Bug 1685787 - PV misalignment on UAS due to optimal_io_size not a multiple of physical_sector_size
Summary: PV misalignment on UAS due to optimal_io_size not a multiple of physical_sect...
Keywords:
Status: NEW
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: LVM Team
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-06 04:26 UTC by Kevin Locke
Modified: 2023-08-10 15:39 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:
pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?


Attachments (Terms of Use)
Patch to only use optimal_io_size matching physical_sector_size (6.12 KB, application/mbox)
2019-03-06 04:26 UTC, Kevin Locke
no flags Details

Description Kevin Locke 2019-03-06 04:26:44 UTC
Created attachment 1541220 [details]
Patch to only use optimal_io_size matching physical_sector_size

Description of problem:

Some devices (USB Attached SCSI in particular) report an optimal_io_size which is not a multiple of physical_sector_size.[^1][^2][^3][^4]  This causes pvcreate to create physical volumes which are mis-aligned to physical sectors, degrading performance.[^5][^6]

Version-Release number of selected component (if applicable): 2.03.02 and current git master (a0c848d4e)

How reproducible:  Always

Steps to Reproduce:
1. pvcreate -v /dev/sdb
2. pvs -o pe_start --units b /dev/sdb

Actual results:

  1st PE   
  33553920B

Expected results:

  1st PE   
  1048576B

Additional info:

The kernel maintainers have stated that sanity checking this value is the responsibility of user-space.[^7]  util-linux only uses the value if it is a multiple of physical_sector_size.[^8]  cryptsetup only uses the value if it is a multiple of minimum_io_size.[^9]  parted is currently discussing the issue.[^10]

I have attached a patch which adopts the util-linux strategy and does not constrain alignment based on optimal_io_size when it is not a multiple of physical_sector_size.

The testing was a bit complicated and required use of the scsi_debug device directly.  I'd appreciate a sanity check before it is applied.

Thanks for considering,
Kevin

[^1]: https://www.saout.de/pipermail/dm-crypt/2016-January/004934.html
[^2]: https://www.spinics.net/lists/linux-usb/msg125988.html
[^3]: https://www.spinics.net/lists/util-linux-ng/msg11693.html
[^4]: https://linux-blog.anracom.com/2018/12/03/linux-ssd-partition-alignment-problems-with-external-usb-to-sata-controllers-i/
[^5]: https://www.redhat.com/archives/linux-lvm/2018-June/msg00049.html
[^6]: https://unix.stackexchange.com/a/496607
[^7]: https://www.spinics.net/lists/util-linux-ng/msg11702.html
[^8]: https://github.com/karelzak/util-linux/commit/acb7651f8
[^9]: https://gitlab.com/cryptsetup/cryptsetup/commit/b80278c0
[^10]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923561


Note You need to log in before you can comment on or make changes to this bug.