Bug 460796

Summary: lvm2 should try to align new PV to MD chunksize if possible
Product: [Fedora] Fedora Reporter: Milan Broz <mbroz>
Component: lvm2Assignee: Milan Broz <mbroz>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: agk, bmarzins, bmr, dwysocha, farrellj, fedora, mbroz, mishu, pierre-bugzilla, prockai, pvrabec
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-02-02 20:07:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Milan Broz 2008-09-01 08:42:13 UTC
+++ 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 12:43:55 UTC
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 07:48:24 UTC
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 08:29:07 UTC
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-26 02:55:00 UTC
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:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Jason Farrell 2008-11-27 03:47:19 UTC
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-2.6.27.5-117.fc10.x86_64). 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.

Thanks.

Comment 6 Milan Broz 2009-02-02 20:07:08 UTC
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 20:41:54 UTC
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 21:02:36 UTC
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.