Bug 460796 - lvm2 should try to align new PV to MD chunksize if possible
lvm2 should try to align new PV to MD chunksize if possible
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Milan Broz
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-09-01 04:42 EDT by Milan Broz
Modified: 2013-02-28 23:06 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-02-02 15:07:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Milan Broz 2008-09-01 04:42:13 EDT
+++ This bug was initially created as a clone of Bug #232843 +++

There is still problem, that if LV over MD is not aligned to md chunk size
(iow beginning of lv is shifted comparing to start sector of md chunk) and some IOs are splitted which slow down performance.
(This is probably most common situation for performance loss now.
Manualy it can be fixed when creating VG - just align metadata to end on md chunk size "pvcreate --metadatasize ...". Unfortunatelly it cannot be fixed if VG is already created...)

LV metadata area should be probably aligned by default if underlying md device has different chunk size - please report new bug if you want to track this issue (it is on my todo list). Also readahead should be optimized here.
I think we can modify pvcreate to detect md chunk size.

(Correcting myself: not metadata need to be aligned, beginning of PE area sould be).

I have already experimental patch, this bug covers it inclusion to lvm2 tools.
Comment 1 Pierre Ossman 2008-09-01 08:43:55 EDT
Until this patch is available, same question as on the original bug:

should something like that following be done:

c = md chunk size

pvcreate --metadatasize c*n /dev/md#
vgcreate --physicalextentsize c*m foo /dev/md#


And what is the size of the metadata? I.e. what's the minimum value of c*n?
Comment 2 Milan Broz 2008-09-22 03:48:24 EDT
Usptream lvm2 >= 2.02.40 alligns all LVs to md chunksize (configurable in lvm.conf).

It doesn't change default metadata size - this workround works only for the first LV allocated on PV...

Setting to POST until new Fedora build of lvm2 tools available.
Comment 3 Milan Broz 2008-10-06 04:29:07 EDT
Just FYI: please use lvm2 2.02.41 when released or current CVS code - there is nasty bug in LVM2 MD chunksize alignment code causing excessive alignment in 2.02.40
(these last minute changes... :-)
Comment 4 Bug Zapper 2008-11-25 21:55:00 EST
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
Comment 5 Jason Farrell 2008-11-26 22:47:19 EST
This nasty bug has plagued me for quite a while, and now follows me to Fedora 10 (lvm2-2.02.39-6.fc10.x86_64 kernel- I get pitifully slow LVM over MD performance, until I manually increase the readahead for each LV to match the MD. I used to do this with a simple "blockdev --setra 4096 /dev/dm-*" workaround in /etc/rc.local, but now use a more appropriate script that sets the readahead to match each device.

I will reproduce my testcase -- https://bugzilla.redhat.com/show_bug.cgi?id=232843#c45 -- when lvm2 2.02.41 is available in f10 updates-testing.

Comment 6 Milan Broz 2009-02-02 15:07:08 EST
Well, rawhide should have for some time lvm2 which had md chunksize alignment by default switched on (for new PV/VG).

I also sent patch to lvm-devel, which allows manually overwrite alignment through pvcreate commandline paramater (so it can be used even for HW raid devices). This should help optimize performance too.

So only remaining problem is automatically increase readahead valued for md device (but you can already manually increase readahead using --readahead during lvcreate/lvchange, and this value is stored into metadata - so it is automatically applied during activation next time).

Closing this as fixed.
Comment 7 Andy Burns 2009-02-02 15:41:54 EST
Look forward to trying it in F11 test releases, is it also likely to show up in RHEL6?
Comment 8 Milan Broz 2009-02-02 16:02:36 EST
md alignment lvm.conf option will be also in RHEL4.8 and it is already in RHEL5.3

I expect that explicit pvcreate --align paramater will be in next update of RHEL (just waiting for review, but I expect it to be in upstream lvm2 2.02.45, then through rebase/backport it propagates to RHEL).

So these changes will be in RHEL6 too.

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