master - man: regenerate
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5bbe68cf15b00987e66...
Commit: 5bbe68cf15b00987e6644c956cf602251ac91581
Parent: 35cdd9cf48a8ec4e4e02fe62eec90dcce4fc8970
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Jan 12 00:30:52 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Jan 12 00:30:52 2018 +0000
man: regenerate
---
man/lvchange.8_pregen | 15 +++++++++++++++
man/lvconvert.8_pregen | 15 +++++++++++++++
man/lvcreate.8_pregen | 15 +++++++++++++++
man/lvdisplay.8_pregen | 11 +++++++++++
man/lvextend.8_pregen | 15 +++++++++++++++
man/lvm-fullreport.8_pregen | 11 +++++++++++
man/lvm-lvpoll.8_pregen | 11 +++++++++++
man/lvmconfig.8_pregen | 11 +++++++++++
man/lvmdiskscan.8_pregen | 11 +++++++++++
man/lvreduce.8_pregen | 11 +++++++++++
man/lvremove.8_pregen | 11 +++++++++++
man/lvrename.8_pregen | 11 +++++++++++
man/lvresize.8_pregen | 15 +++++++++++++++
man/lvs.8_pregen | 11 +++++++++++
man/lvscan.8_pregen | 11 +++++++++++
man/pvchange.8_pregen | 11 +++++++++++
man/pvck.8_pregen | 11 +++++++++++
man/pvcreate.8_pregen | 11 +++++++++++
man/pvdisplay.8_pregen | 11 +++++++++++
man/pvmove.8_pregen | 11 +++++++++++
man/pvremove.8_pregen | 11 +++++++++++
man/pvresize.8_pregen | 11 +++++++++++
man/pvs.8_pregen | 11 +++++++++++
man/pvscan.8_pregen | 11 +++++++++++
man/vgcfgbackup.8_pregen | 11 +++++++++++
man/vgcfgrestore.8_pregen | 15 +++++++++++++++
man/vgchange.8_pregen | 16 ++++------------
man/vgck.8_pregen | 11 +++++++++++
man/vgconvert.8_pregen | 11 +++++++++++
man/vgcreate.8_pregen | 8 ++++----
man/vgdisplay.8_pregen | 11 +++++++++++
man/vgexport.8_pregen | 11 +++++++++++
man/vgextend.8_pregen | 11 +++++++++++
man/vgimport.8_pregen | 11 +++++++++++
man/vgimportclone.8_pregen | 11 +++++++++++
man/vgmerge.8_pregen | 11 +++++++++++
man/vgmknodes.8_pregen | 11 +++++++++++
man/vgreduce.8_pregen | 15 +++++++++++++++
man/vgremove.8_pregen | 11 +++++++++++
man/vgrename.8_pregen | 11 +++++++++++
man/vgs.8_pregen | 11 +++++++++++
man/vgscan.8_pregen | 11 +++++++++++
man/vgsplit.8_pregen | 11 +++++++++++
43 files changed, 487 insertions(+), 16 deletions(-)
diff --git a/man/lvchange.8_pregen b/man/lvchange.8_pregen
index 68c21d8..26a6297 100644
--- a/man/lvchange.8_pregen
+++ b/man/lvchange.8_pregen
@@ -101,6 +101,10 @@ lvchange - Change the attributes of logical volume(s)
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -564,6 +568,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -809,6 +817,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index 243d1c3..5171d6a 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -79,6 +79,10 @@ lvconvert - Change logical volume layout
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -891,6 +895,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -1066,6 +1074,13 @@ Report progress at regular intervals.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
index 71bd82b..9dcb33f 100644
--- a/man/lvcreate.8_pregen
+++ b/man/lvcreate.8_pregen
@@ -99,6 +99,10 @@ lvcreate - Create a logical volume
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -904,6 +908,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -1147,6 +1155,13 @@ Do not use this if dmeventd is already monitoring a device.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvdisplay.8_pregen b/man/lvdisplay.8_pregen
index 6df90a0..33e4f5d 100644
--- a/man/lvdisplay.8_pregen
+++ b/man/lvdisplay.8_pregen
@@ -162,6 +162,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -283,6 +287,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/lvextend.8_pregen b/man/lvextend.8_pregen
index 9f4f097..130672e 100644
--- a/man/lvextend.8_pregen
+++ b/man/lvextend.8_pregen
@@ -47,6 +47,10 @@ lvextend - Add space to a logical volume
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -312,6 +316,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -420,6 +428,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvm-fullreport.8_pregen b/man/lvm-fullreport.8_pregen
index ff0cba7..3fb00b1 100644
--- a/man/lvm-fullreport.8_pregen
+++ b/man/lvm-fullreport.8_pregen
@@ -162,6 +162,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -258,6 +262,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/lvm-lvpoll.8_pregen b/man/lvm-lvpoll.8_pregen
index 2154b79..4591a28 100644
--- a/man/lvm-lvpoll.8_pregen
+++ b/man/lvm-lvpoll.8_pregen
@@ -76,6 +76,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -152,6 +156,13 @@ Report progress at regular intervals.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvmconfig.8_pregen b/man/lvmconfig.8_pregen
index 0b7fea6..b47d589 100644
--- a/man/lvmconfig.8_pregen
+++ b/man/lvmconfig.8_pregen
@@ -145,6 +145,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -245,6 +249,13 @@ options --typeconfig list --withsummary.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvmdiskscan.8_pregen b/man/lvmdiskscan.8_pregen
index fe379bb..8b26d95 100644
--- a/man/lvmdiskscan.8_pregen
+++ b/man/lvmdiskscan.8_pregen
@@ -71,6 +71,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -121,6 +125,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvreduce.8_pregen b/man/lvreduce.8_pregen
index 865aef4..3aa4b5a 100644
--- a/man/lvreduce.8_pregen
+++ b/man/lvreduce.8_pregen
@@ -102,6 +102,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -189,6 +193,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvremove.8_pregen b/man/lvremove.8_pregen
index 2c9aad1..88d0501 100644
--- a/man/lvremove.8_pregen
+++ b/man/lvremove.8_pregen
@@ -106,6 +106,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -170,6 +174,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvrename.8_pregen b/man/lvrename.8_pregen
index af39eed..69711e0 100644
--- a/man/lvrename.8_pregen
+++ b/man/lvrename.8_pregen
@@ -81,6 +81,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -138,6 +142,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvresize.8_pregen b/man/lvresize.8_pregen
index 2432495..8df157a 100644
--- a/man/lvresize.8_pregen
+++ b/man/lvresize.8_pregen
@@ -47,6 +47,10 @@ lvresize - Resize a logical volume
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -260,6 +264,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -368,6 +376,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/lvs.8_pregen b/man/lvs.8_pregen
index f773750..c6303bb 100644
--- a/man/lvs.8_pregen
+++ b/man/lvs.8_pregen
@@ -166,6 +166,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -273,6 +277,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/lvscan.8_pregen b/man/lvscan.8_pregen
index 7713e53..e9d90ee 100644
--- a/man/lvscan.8_pregen
+++ b/man/lvscan.8_pregen
@@ -97,6 +97,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -174,6 +178,13 @@ operations after locking failures.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvchange.8_pregen b/man/pvchange.8_pregen
index 33c49e9..6a80e72 100644
--- a/man/pvchange.8_pregen
+++ b/man/pvchange.8_pregen
@@ -146,6 +146,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -243,6 +247,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvck.8_pregen b/man/pvck.8_pregen
index 51b761d..1140d69 100644
--- a/man/pvck.8_pregen
+++ b/man/pvck.8_pregen
@@ -61,6 +61,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -120,6 +124,13 @@ in the source). Use with care.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvcreate.8_pregen b/man/pvcreate.8_pregen
index 6345b28..abceb82 100644
--- a/man/pvcreate.8_pregen
+++ b/man/pvcreate.8_pregen
@@ -137,6 +137,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -233,6 +237,13 @@ in the source). Use with care.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvdisplay.8_pregen b/man/pvdisplay.8_pregen
index 1e7ed4b..bbf09d8 100644
--- a/man/pvdisplay.8_pregen
+++ b/man/pvdisplay.8_pregen
@@ -158,6 +158,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -270,6 +274,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/pvmove.8_pregen b/man/pvmove.8_pregen
index cfc4549..cb121f2 100644
--- a/man/pvmove.8_pregen
+++ b/man/pvmove.8_pregen
@@ -129,6 +129,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -237,6 +241,13 @@ Report progress at regular intervals.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvremove.8_pregen b/man/pvremove.8_pregen
index 325654a..16a82ad 100644
--- a/man/pvremove.8_pregen
+++ b/man/pvremove.8_pregen
@@ -71,6 +71,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -128,6 +132,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvresize.8_pregen b/man/pvresize.8_pregen
index 09c81e4..7b61f81 100644
--- a/man/pvresize.8_pregen
+++ b/man/pvresize.8_pregen
@@ -66,6 +66,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -116,6 +120,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/pvs.8_pregen b/man/pvs.8_pregen
index 970c1f9..a2a62a6 100644
--- a/man/pvs.8_pregen
+++ b/man/pvs.8_pregen
@@ -162,6 +162,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -260,6 +264,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/pvscan.8_pregen b/man/pvscan.8_pregen
index ebd155f..230492b 100644
--- a/man/pvscan.8_pregen
+++ b/man/pvscan.8_pregen
@@ -210,6 +210,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -294,6 +298,13 @@ operations after locking failures.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgcfgbackup.8_pregen b/man/vgcfgbackup.8_pregen
index 6a56481..e9c42fe 100644
--- a/man/vgcfgbackup.8_pregen
+++ b/man/vgcfgbackup.8_pregen
@@ -97,6 +97,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -169,6 +173,13 @@ operations after locking failures.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgcfgrestore.8_pregen b/man/vgcfgrestore.8_pregen
index f4fe2e4..e028103 100644
--- a/man/vgcfgrestore.8_pregen
+++ b/man/vgcfgrestore.8_pregen
@@ -43,6 +43,10 @@ vgcfgrestore - Restore volume group configuration
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -185,6 +189,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -259,6 +267,13 @@ May be used with --file. Does not restore the VG.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgchange.8_pregen b/man/vgchange.8_pregen
index c1628a7..00cfc2b 100644
--- a/man/vgchange.8_pregen
+++ b/man/vgchange.8_pregen
@@ -547,10 +547,6 @@ Start the lockspace of a shared VG in lvmlockd.
[ \fB-S\fP|\fB--select\fP \fIString\fP ]
.ad b
.br
-.ad l
-[ \fB--lockopt\fP \fIString\fP ]
-.ad b
-.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -569,10 +565,6 @@ Stop the lockspace of a shared VG in lvmlockd.
[ \fB-S\fP|\fB--select\fP \fIString\fP ]
.ad b
.br
-.ad l
-[ \fB--lockopt\fP \fIString\fP ]
-.ad b
-.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -587,10 +579,6 @@ Change the lock type for a shared VG.
\fBvgchange\fP \fB--locktype\fP \fBsanlock\fP|\fBdlm\fP|\fBnone\fP \fIVG\fP
.br
.RS 4
-.ad l
-[ \fB--lockopt\fP \fIString\fP ]
-.ad b
-.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -641,6 +629,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
diff --git a/man/vgck.8_pregen b/man/vgck.8_pregen
index 9e3c2ef..83e4a19 100644
--- a/man/vgck.8_pregen
+++ b/man/vgck.8_pregen
@@ -66,6 +66,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -116,6 +120,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgconvert.8_pregen b/man/vgconvert.8_pregen
index c63bd50..6228087 100644
--- a/man/vgconvert.8_pregen
+++ b/man/vgconvert.8_pregen
@@ -90,6 +90,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -170,6 +174,13 @@ in the source). Use with care.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgcreate.8_pregen b/man/vgcreate.8_pregen
index 82d341c..ddad391 100644
--- a/man/vgcreate.8_pregen
+++ b/man/vgcreate.8_pregen
@@ -100,10 +100,6 @@ devices are also available with vgcreate.
[ \fB--locktype\fP \fBsanlock\fP|\fBdlm\fP|\fBnone\fP ]
.ad b
.br
-.ad l
-[ \fB--lockopt\fP \fIString\fP ]
-.ad b
-.br
[ COMMON_OPTIONS ]
.RE
.br
@@ -148,6 +144,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
diff --git a/man/vgdisplay.8_pregen b/man/vgdisplay.8_pregen
index 2fffacb..dcf9934 100644
--- a/man/vgdisplay.8_pregen
+++ b/man/vgdisplay.8_pregen
@@ -153,6 +153,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -265,6 +269,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/vgexport.8_pregen b/man/vgexport.8_pregen
index ed292f8..74aa597 100644
--- a/man/vgexport.8_pregen
+++ b/man/vgexport.8_pregen
@@ -89,6 +89,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -144,6 +148,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgextend.8_pregen b/man/vgextend.8_pregen
index bc6d959..ee805a8 100644
--- a/man/vgextend.8_pregen
+++ b/man/vgextend.8_pregen
@@ -115,6 +115,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -204,6 +208,13 @@ in the source). Use with care.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgimport.8_pregen b/man/vgimport.8_pregen
index 7e0c3d6..71f9d56 100644
--- a/man/vgimport.8_pregen
+++ b/man/vgimport.8_pregen
@@ -90,6 +90,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -153,6 +157,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgimportclone.8_pregen b/man/vgimportclone.8_pregen
index 96c95f9..aab34f4 100644
--- a/man/vgimportclone.8_pregen
+++ b/man/vgimportclone.8_pregen
@@ -70,6 +70,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -137,6 +141,13 @@ will not be changed (nor will their associated PVs).
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgmerge.8_pregen b/man/vgmerge.8_pregen
index c3a9bc8..ab6873d 100644
--- a/man/vgmerge.8_pregen
+++ b/man/vgmerge.8_pregen
@@ -67,6 +67,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -130,6 +134,13 @@ Display merged destination VG like vgdisplay -v.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgmknodes.8_pregen b/man/vgmknodes.8_pregen
index b50b3dc..9588694 100644
--- a/man/vgmknodes.8_pregen
+++ b/man/vgmknodes.8_pregen
@@ -78,6 +78,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -135,6 +139,13 @@ operations after locking failures.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgreduce.8_pregen b/man/vgreduce.8_pregen
index 44a6ae0..ecc5aca 100644
--- a/man/vgreduce.8_pregen
+++ b/man/vgreduce.8_pregen
@@ -41,6 +41,10 @@ vgreduce - Remove physical volume(s) from a volume group
.ad b
.br
.ad l
+ \fB--lockopt\fP \fIString\fP
+.ad b
+.br
+.ad l
\fB--longhelp\fP
.ad b
.br
@@ -175,6 +179,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -245,6 +253,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgremove.8_pregen b/man/vgremove.8_pregen
index 5399848..f562991 100644
--- a/man/vgremove.8_pregen
+++ b/man/vgremove.8_pregen
@@ -81,6 +81,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -138,6 +142,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgrename.8_pregen b/man/vgrename.8_pregen
index 3570e87..1f8928e 100644
--- a/man/vgrename.8_pregen
+++ b/man/vgrename.8_pregen
@@ -94,6 +94,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -158,6 +162,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgs.8_pregen b/man/vgs.8_pregen
index 6bef89d..efceb4e 100644
--- a/man/vgs.8_pregen
+++ b/man/vgs.8_pregen
@@ -158,6 +158,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -255,6 +259,13 @@ without clustered locking and clustered VGs are skipped.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--logonly\fP
.br
Suppress command report and display only log report.
diff --git a/man/vgscan.8_pregen b/man/vgscan.8_pregen
index bd2f4d9..18b2990 100644
--- a/man/vgscan.8_pregen
+++ b/man/vgscan.8_pregen
@@ -77,6 +77,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -140,6 +144,13 @@ operations after locking failures.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
diff --git a/man/vgsplit.8_pregen b/man/vgsplit.8_pregen
index d02e68a..210c266 100644
--- a/man/vgsplit.8_pregen
+++ b/man/vgsplit.8_pregen
@@ -114,6 +114,10 @@ Common options for lvm:
.ad b
.br
.ad l
+[ \fB--lockopt\fP \fIString\fP ]
+.ad b
+.br
+.ad l
[ \fB--longhelp\fP ]
.ad b
.br
@@ -198,6 +202,13 @@ Display help text.
.ad b
.HP
.ad l
+\fB--lockopt\fP \fIString\fP
+.br
+Used to pass options for special cases to lvmlockd.
+See \fBlvmlockd\fP(8) for more information.
+.ad b
+.HP
+.ad l
\fB--longhelp\fP
.br
Display long help text.
6 years, 4 months
master - label: Clean up storing of device and label sector.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=35cdd9cf48a8ec4e4e0...
Commit: 35cdd9cf48a8ec4e4e02fe62eec90dcce4fc8970
Parent: f771d3f870a3e0b86b729a730b1ef7797e35aec6
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Jan 11 02:39:30 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Jan 11 02:54:00 2018 +0000
label: Clean up storing of device and label sector.
No longer use the external 'result' pointer internally to set up the
cached label. The callback _set_label_read_result() is now given the
internal label pointer directly
Callers that don't need the result are no longer required to pass a
label pointer into label_read().
---
lib/cache/lvmcache.c | 15 +++++----------
lib/format1/lvm1-label.c | 7 ++++---
lib/format_pool/pool_label.c | 7 ++++---
lib/format_text/text_label.c | 19 ++++++++++---------
lib/label/label.c | 29 ++++++++++++++---------------
lib/label/label.h | 4 ++--
lib/metadata/metadata-liblvm.c | 3 +--
7 files changed, 40 insertions(+), 44 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index a24fd0a..bc74562 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -548,7 +548,6 @@ const struct format_type *lvmcache_fmt_from_vgname(struct cmd_context *cmd,
{
struct lvmcache_vginfo *vginfo;
struct lvmcache_info *info;
- struct label *label;
struct dm_list *devh, *tmp;
struct dm_list devs;
struct device_list *devl;
@@ -593,7 +592,7 @@ const struct format_type *lvmcache_fmt_from_vgname(struct cmd_context *cmd,
dm_list_iterate_safe(devh, tmp, &devs) {
devl = dm_list_item(devh, struct device_list);
- (void) label_read(devl->dev, &label, UINT64_C(0));
+ (void) label_read(devl->dev, NULL, UINT64_C(0));
dm_list_del(&devl->list);
dm_free(devl);
}
@@ -776,10 +775,8 @@ char *lvmcache_vgname_from_pvid(struct cmd_context *cmd, const char *pvid)
static void _rescan_entry(struct lvmcache_info *info)
{
- struct label *label;
-
if (info->status & CACHE_INVALID)
- (void) label_read(info->dev, &label, UINT64_C(0));
+ (void) label_read(info->dev, NULL, UINT64_C(0));
}
static int _scan_invalid(void)
@@ -1115,7 +1112,6 @@ int lvmcache_label_scan(struct cmd_context *cmd)
struct dm_list add_cache_devs;
struct lvmcache_info *info;
struct device_list *devl;
- struct label *label;
struct dev_iter *iter;
struct device *dev;
struct format_type *fmt;
@@ -1160,7 +1156,7 @@ int lvmcache_label_scan(struct cmd_context *cmd)
while ((dev = dev_iter_get(iter))) {
nr_labels_outstanding++;
- if (!label_read_callback(cmd->mem, dev, UINT64_C(0), _process_label_data, &nr_labels_outstanding))
+ if (!label_read_callback(dev, UINT64_C(0), _process_label_data, &nr_labels_outstanding))
nr_labels_outstanding--;
dev_count++;
}
@@ -1201,7 +1197,7 @@ int lvmcache_label_scan(struct cmd_context *cmd)
dm_list_iterate_items(devl, &add_cache_devs) {
log_debug_cache("Rescan preferred device %s for lvmcache", dev_name(devl->dev));
- (void) label_read(devl->dev, &label, UINT64_C(0));
+ (void) label_read(devl->dev, NULL, UINT64_C(0));
}
dm_list_splice(&_unused_duplicate_devs, &del_cache_devs);
@@ -1522,7 +1518,6 @@ const char *lvmcache_pvid_from_devname(struct cmd_context *cmd,
const char *devname)
{
struct device *dev;
- struct label *label;
if (!(dev = dev_cache_get(devname, cmd->filter))) {
log_error("%s: Couldn't find device. Check your filters?",
@@ -1530,7 +1525,7 @@ const char *lvmcache_pvid_from_devname(struct cmd_context *cmd,
return NULL;
}
- if (!(label_read(dev, &label, UINT64_C(0))))
+ if (!(label_read(dev, NULL, UINT64_C(0))))
return NULL;
return dev->pvid;
diff --git a/lib/format1/lvm1-label.c b/lib/format1/lvm1-label.c
index 84d6f4e..1452dea 100644
--- a/lib/format1/lvm1-label.c
+++ b/lib/format1/lvm1-label.c
@@ -54,12 +54,13 @@ static int _lvm1_write(struct label *label __attribute__((unused)), void *buf __
return 0;
}
-static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, struct label **label,
+static int _lvm1_read(struct labeller *l, struct device *dev, void *buf,
lvm_callback_fn_t read_label_callback_fn, void *read_label_callback_context)
{
struct pv_disk *pvd = (struct pv_disk *) buf;
struct vg_disk vgd;
struct lvmcache_info *info;
+ struct label *label;
const char *vgid = FMT_LVM1_ORPHAN_VG_NAME;
const char *vgname = FMT_LVM1_ORPHAN_VG_NAME;
unsigned exported = 0;
@@ -79,7 +80,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, struct
exported)))
goto_out;
- *label = lvmcache_get_label(info);
+ label = lvmcache_get_label(info);
lvmcache_set_device_size(info, ((uint64_t)xlate32(pvd->pv_size)) << SECTOR_SHIFT);
lvmcache_set_ext_version(info, 0);
@@ -92,7 +93,7 @@ static int _lvm1_read(struct labeller *l, struct device *dev, void *buf, struct
out:
if (read_label_callback_fn)
- read_label_callback_fn(!r, read_label_callback_context, NULL);
+ read_label_callback_fn(!r, read_label_callback_context, label);
return r;
}
diff --git a/lib/format_pool/pool_label.c b/lib/format_pool/pool_label.c
index 451d7d0..320cef2 100644
--- a/lib/format_pool/pool_label.c
+++ b/lib/format_pool/pool_label.c
@@ -55,16 +55,17 @@ static int _pool_write(struct label *label __attribute__((unused)), void *buf __
return 0;
}
-static int _pool_read(struct labeller *l, struct device *dev, void *buf, struct label **label,
+static int _pool_read(struct labeller *l, struct device *dev, void *buf,
lvm_callback_fn_t read_label_callback_fn, void *read_label_callback_context)
{
struct pool_list pl;
+ struct label *label;
int r;
- r = read_pool_label(&pl, l, dev, buf, label);
+ r = read_pool_label(&pl, l, dev, buf, &label);
if (read_label_callback_fn)
- read_label_callback_fn(!r, read_label_callback_context, NULL);
+ read_label_callback_fn(!r, read_label_callback_context, label);
return r;
}
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 7f3b2d3..44d43f1 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -321,7 +321,7 @@ static int _text_initialise_label(struct labeller *l __attribute__((unused)),
struct update_mda_baton {
struct lvmcache_info *info;
- struct label *label;
+ struct labeller *labeller;
int nr_outstanding_mdas;
lvm_callback_fn_t read_label_callback_fn;
void *read_label_callback_context;
@@ -362,7 +362,7 @@ static void _process_mda_header(int failed, void *context, const void *data)
struct process_mda_header_params *pmp = context;
const struct mda_header *mdah = data;
struct update_mda_baton *umb = pmp->umb;
- const struct format_type *fmt = umb->label->labeller->fmt;
+ const struct format_type *fmt = umb->labeller->fmt;
struct metadata_area *mda = pmp->mda;
struct mda_context *mdac = (struct mda_context *) mda->metadata_locn;
@@ -394,8 +394,8 @@ static int _update_mda(struct metadata_area *mda, void *baton)
{
struct process_mda_header_params *pmp;
struct update_mda_baton *umb = baton;
- const struct format_type *fmt = umb->label->labeller->fmt;
- struct dm_pool *mem = umb->label->labeller->fmt->cmd->mem;
+ const struct format_type *fmt = umb->labeller->fmt;
+ struct dm_pool *mem = umb->labeller->fmt->cmd->mem;
struct mda_context *mdac = (struct mda_context *) mda->metadata_locn;
if (!(pmp = dm_pool_zalloc(mem, sizeof(*pmp)))) {
@@ -434,7 +434,7 @@ static int _update_mda(struct metadata_area *mda, void *baton)
return pmp->ret;
}
-static int _text_read(struct labeller *l, struct device *dev, void *buf, struct label **label,
+static int _text_read(struct labeller *l, struct device *dev, void *buf,
lvm_callback_fn_t read_label_callback_fn, void *read_label_callback_context)
{
struct label_header *lh = (struct label_header *) buf;
@@ -446,6 +446,7 @@ static int _text_read(struct labeller *l, struct device *dev, void *buf, struct
uint32_t ext_version;
struct dm_pool *mem = l->fmt->cmd->mem;
struct update_mda_baton *umb;
+ struct label *label = NULL;
/*
* PV header base
@@ -457,7 +458,7 @@ static int _text_read(struct labeller *l, struct device *dev, void *buf, struct
FMT_TEXT_ORPHAN_VG_NAME, 0)))
goto_bad;
- *label = lvmcache_get_label(info);
+ label = lvmcache_get_label(info);
lvmcache_set_device_size(info, xlate64(pvhdr->device_size_xl));
@@ -511,7 +512,7 @@ out:
}
umb->info = info;
- umb->label = *label;
+ umb->labeller = label->labeller;
umb->read_label_callback_fn = read_label_callback_fn;
umb->read_label_callback_context = read_label_callback_context;
umb->nr_outstanding_mdas = 1;
@@ -526,13 +527,13 @@ out:
lvmcache_make_valid(info);
if (umb->read_label_callback_fn)
- umb->read_label_callback_fn(!umb->ret, umb->read_label_callback_context, NULL);
+ umb->read_label_callback_fn(!umb->ret, umb->read_label_callback_context, label);
return 1;
bad:
if (read_label_callback_fn)
- read_label_callback_fn(1, read_label_callback_context, NULL);
+ read_label_callback_fn(1, read_label_callback_context, label);
return 0;
}
diff --git a/lib/label/label.c b/lib/label/label.c
index 27b72d3..be05285 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -135,17 +135,22 @@ static void _set_label_read_result(int failed, void *context, const void *data)
{
struct find_labeller_params *flp = context;
struct label **result = flp->result;
+ struct label *label = (struct label *) data;
if (failed) {
flp->ret = 0;
goto_out;
}
- if (result && *result) {
- (*result)->dev = flp->dev;
- (*result)->sector = flp->label_sector;
+ /* Fix up device and label sector which the low-level code doesn't set */
+ if (label) {
+ label->dev = flp->dev;
+ label->sector = flp->label_sector;
}
+ if (result)
+ *result = (struct label *) label;
+
out:
if (!dev_close(flp->dev))
stack;
@@ -160,7 +165,6 @@ static void _find_labeller(int failed, void *context, const void *data)
const char *readbuf = data;
struct device *dev = flp->dev;
uint64_t scan_sector = flp->scan_sector;
- struct label **result = flp->result;
char labelbuf[LABEL_SIZE] __attribute__((aligned(8)));
struct labeller_i *li;
struct labeller *l = NULL; /* Set when a labeller claims the label */
@@ -233,7 +237,7 @@ static void _find_labeller(int failed, void *context, const void *data)
flp->ret = 0;
_set_label_read_result(1, flp, NULL);
} else
- (void) (l->ops->read)(l, dev, labelbuf, result, &_set_label_read_result, flp);
+ (void) (l->ops->read)(l, dev, labelbuf, &_set_label_read_result, flp);
}
/* FIXME Also wipe associated metadata area headers? */
@@ -318,7 +322,8 @@ static int _label_read(struct device *dev, uint64_t scan_sector, struct label **
if ((info = lvmcache_info_from_pvid(dev->pvid, dev, 1))) {
log_debug_devs("Reading label from lvmcache for %s", dev_name(dev));
- *result = lvmcache_get_label(info);
+ if (result)
+ *result = lvmcache_get_label(info);
if (process_label_data_fn)
process_label_data_fn(0, process_label_data_context, NULL);
return 1;
@@ -360,22 +365,16 @@ static int _label_read(struct device *dev, uint64_t scan_sector, struct label **
return flp->ret;
}
+/* result may be NULL if caller doesn't need it */
int label_read(struct device *dev, struct label **result, uint64_t scan_sector)
{
return _label_read(dev, scan_sector, result, NULL, NULL);
}
-int label_read_callback(struct dm_pool *mem, struct device *dev, uint64_t scan_sector,
+int label_read_callback(struct device *dev, uint64_t scan_sector,
lvm_callback_fn_t process_label_data_fn, void *process_label_data_context)
{
- struct label **result; /* FIXME Eliminate this */
-
- if (!(result = dm_pool_zalloc(mem, sizeof(*result)))) {
- log_error("Couldn't allocate memory for internal result pointer.");
- return 0;
- }
-
- return _label_read(dev, scan_sector, result, process_label_data_fn, process_label_data_context);
+ return _label_read(dev, scan_sector, NULL, process_label_data_fn, process_label_data_context);
}
/* Caller may need to use label_get_handler to create label struct! */
diff --git a/lib/label/label.h b/lib/label/label.h
index 7f365f2..c566870 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -62,7 +62,7 @@ struct label_ops {
/*
* Read a label from a volume.
*/
- int (*read) (struct labeller *l, struct device *dev, void *buf, struct label **label,
+ int (*read) (struct labeller *l, struct device *dev, void *buf,
lvm_callback_fn_t label_read_callback_fn, void *label_read_callback_context);
/*
@@ -96,7 +96,7 @@ struct labeller *label_get_handler(const char *name);
int label_remove(struct device *dev);
int label_read(struct device *dev, struct label **result,
uint64_t scan_sector);
-int label_read_callback(struct dm_pool *mem, struct device *dev, uint64_t scan_sector,
+int label_read_callback(struct device *dev, uint64_t scan_sector,
lvm_callback_fn_t process_label_data_fn, void *process_label_data_context);
int label_write(struct device *dev, struct label *label);
struct label *label_create(struct labeller *labeller);
diff --git a/lib/metadata/metadata-liblvm.c b/lib/metadata/metadata-liblvm.c
index a4284bc..d192b15 100644
--- a/lib/metadata/metadata-liblvm.c
+++ b/lib/metadata/metadata-liblvm.c
@@ -491,7 +491,6 @@ static int _pvremove_check(struct cmd_context *cmd, const char *name,
{
static const char really_wipe_msg[] = "Really WIPE LABELS from physical volume";
struct device *dev;
- struct label *label;
struct pv_list *pvl;
struct physical_volume *pv = NULL;
int used;
@@ -506,7 +505,7 @@ static int _pvremove_check(struct cmd_context *cmd, const char *name,
/* Is there a pv here already? */
/* If not, this is an error unless you used -f. */
- if (!label_read(dev, &label, 0)) {
+ if (!label_read(dev, NULL, 0)) {
if (force_count)
return 1;
log_error("No PV label found on %s.", name);
6 years, 4 months
master - config: Move use_mmap to local variable.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f771d3f870a3e0b86b7...
Commit: f771d3f870a3e0b86b729a730b1ef7797e35aec6
Parent: 6210c1ec28b9b6859d3e4c30a4dd1928f5c5badc
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 20:35:02 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 20:35:02 2018 +0000
config: Move use_mmap to local variable.
---
lib/config/config.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 668df26..44d646e 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -500,7 +500,6 @@ struct process_config_file_params {
uint32_t checksum;
int checksum_only;
int no_dup_node_check;
- int use_mmap;
lvm_callback_fn_t config_file_read_fd_callback;
void *config_file_read_fd_context;
int ret;
@@ -552,6 +551,7 @@ int config_file_read_fd(struct dm_pool *mem, struct dm_config_tree *cft, struct
char *fb;
int r = 0;
off_t mmap_offset = 0;
+ int use_mmap = 1;
const char *buf = NULL;
unsigned circular = size2 ? 1 : 0; /* Wrapped around end of disk metadata buffer? */
struct config_source *cs = dm_config_get_custom(cft);
@@ -581,14 +581,13 @@ int config_file_read_fd(struct dm_pool *mem, struct dm_config_tree *cft, struct
pcfp->no_dup_node_check = no_dup_node_check;
pcfp->config_file_read_fd_callback = config_file_read_fd_callback;
pcfp->config_file_read_fd_context = config_file_read_fd_context;
- pcfp->use_mmap = 1;
pcfp->ret = 1;
/* Only use mmap with regular files */
if (!(dev->flags & DEV_REGULAR) || circular)
- pcfp->use_mmap = 0;
+ use_mmap = 0;
- if (pcfp->use_mmap) {
+ if (use_mmap) {
mmap_offset = offset % lvm_getpagesize();
/* memory map the file */
fb = mmap((caddr_t) 0, size + mmap_offset, PROT_READ,
6 years, 4 months
master - device: Mark read-only device buffers const.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6210c1ec28b9b6859d3...
Commit: 6210c1ec28b9b6859d3e4c30a4dd1928f5c5badc
Parent: c350f96c09f3fb591de1742829006769f53c29eb
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 19:50:53 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 19:57:10 2018 +0000
device: Mark read-only device buffers const.
---
lib/cache/lvmcache.c | 4 ++--
lib/cache/lvmcache.h | 2 +-
lib/config/config.c | 8 ++++----
lib/device/dev-io.c | 4 ++--
lib/device/device.h | 10 +++++-----
lib/format_text/format-text.c | 30 +++++++++++++++---------------
lib/format_text/import.c | 4 ++--
lib/format_text/layout.h | 2 +-
lib/format_text/text_label.c | 8 ++++----
lib/label/label.c | 10 +++++-----
lib/label/label.h | 2 +-
11 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 017a86b..a24fd0a 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1102,7 +1102,7 @@ next:
}
/* Track the number of outstanding label reads */
-static void _process_label_data(int failed, void *context, void *data)
+static void _process_label_data(int failed, void *context, const void *data)
{
int *nr_labels_outstanding = context;
@@ -1996,7 +1996,7 @@ int lvmcache_add_orphan_vginfo(const char *vgname, struct format_type *fmt)
return _lvmcache_update_vgname(NULL, vgname, vgname, 0, "", fmt);
}
-int lvmcache_update_vgname_and_id(struct lvmcache_info *info, struct lvmcache_vgsummary *vgsummary)
+int lvmcache_update_vgname_and_id(struct lvmcache_info *info, const struct lvmcache_vgsummary *vgsummary)
{
const char *vgname = vgsummary->vgname;
const char *vgid = (char *)&vgsummary->vgid;
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index 847c208..3c76b78 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -85,7 +85,7 @@ void lvmcache_del(struct lvmcache_info *info);
/* Update things */
int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
- struct lvmcache_vgsummary *vgsummary);
+ const struct lvmcache_vgsummary *vgsummary);
int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted);
void lvmcache_lock_vgname(const char *vgname, int read_only);
diff --git a/lib/config/config.c b/lib/config/config.c
index 9dd8a61..668df26 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -506,10 +506,10 @@ struct process_config_file_params {
int ret;
};
-static void _process_config_file_buffer(int failed, void *context, void *data)
+static void _process_config_file_buffer(int failed, void *context, const void *data)
{
struct process_config_file_params *pcfp = context;
- char *fb = data, *fe;
+ const char *fb = data, *fe;
if (failed) {
pcfp->ret = 0;
@@ -552,7 +552,7 @@ int config_file_read_fd(struct dm_pool *mem, struct dm_config_tree *cft, struct
char *fb;
int r = 0;
off_t mmap_offset = 0;
- char *buf = NULL;
+ const char *buf = NULL;
unsigned circular = size2 ? 1 : 0; /* Wrapped around end of disk metadata buffer? */
struct config_source *cs = dm_config_get_custom(cft);
struct process_config_file_params *pcfp;
@@ -609,7 +609,7 @@ int config_file_read_fd(struct dm_pool *mem, struct dm_config_tree *cft, struct
if (!(buf = dev_read_circular(dev, (uint64_t) offset, size, (uint64_t) offset2, size2, reason)))
goto_out;
_process_config_file_buffer(0, pcfp, buf);
- dm_free(buf);
+ dm_free((void *)buf);
} else if (!dev_read_callback(dev, (uint64_t) offset, size, reason, _process_config_file_buffer, pcfp))
goto_out;
r = pcfp->ret;
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 9920ee5..f916761 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -834,7 +834,7 @@ static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_rea
}
/* Returns pointer to read-only buffer. Caller does not free it. */
-char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason)
+const char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason)
{
if (!_dev_read(dev, offset, len, reason)) {
log_error("Read from %s failed", dev_name(dev));
@@ -881,7 +881,7 @@ int dev_read_buf(struct device *dev, uint64_t offset, size_t len, dev_io_reason_
* Read from 'dev' in 2 distinct regions, denoted by (offset,len) and (offset2,len2).
* Caller is responsible for dm_free().
*/
-char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
+const char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
uint64_t offset2, size_t len2, dev_io_reason_t reason)
{
char *buf = NULL;
diff --git a/lib/device/device.h b/lib/device/device.h
index cf44362..926d24a 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -37,7 +37,7 @@
* When provided, callback functions are called exactly once.
* If failed is set, data cannot be accessed.
*/
-typedef void (*lvm_callback_fn_t)(int failed, void *context, void *data);
+typedef void (*lvm_callback_fn_t)(int failed, void *context, const void *data);
/*
* Support for external device info.
@@ -63,7 +63,7 @@ struct device_area {
};
struct device_buffer {
- void *data; /* Location of start of requested data (inside buf) */
+ const void *data; /* Location of start of requested data (inside buf) */
/* Private */
void *malloc_address; /* Start of allocated memory */
@@ -171,9 +171,9 @@ int dev_fd(struct device *dev);
const char *dev_name(const struct device *dev);
/* Returns a read-only buffer */
-char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason);
-char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
- uint64_t offset2, size_t len2, dev_io_reason_t reason);
+const char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason);
+const char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
+ uint64_t offset2, size_t len2, dev_io_reason_t reason);
/* Passes the data to dev_read_callback_fn */
int dev_read_callback(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason,
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index d28449c..866f65f 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -182,7 +182,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
uint64_t offset2;
size_t size;
size_t size2;
- char *buf = NULL;
+ const char *buf = NULL;
struct device_area *area;
struct mda_context *mdac;
unsigned circular = 0;
@@ -273,14 +273,14 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
}
}
if (circular)
- dm_free(buf);
+ dm_free((void *)buf);
buf = NULL;
}
r = 1;
out:
if (circular)
- dm_free(buf);
+ dm_free((void *)buf);
if (!dev_close(area->dev))
stack;
return r;
@@ -334,7 +334,7 @@ struct process_raw_mda_header_params {
int ret;
};
-static void _process_raw_mda_header(int failed, void *context, void *data)
+static void _process_raw_mda_header(int failed, void *context, const void *data)
{
struct process_raw_mda_header_params *prmp = context;
struct mda_header *mdah = prmp->mdah;
@@ -472,7 +472,7 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
.vgname = FMT_TEXT_ORPHAN_VG_NAME,
};
int rlocn_was_ignored;
- char *buf;
+ const char *buf;
memcpy(&vgsummary_orphan.vgid, FMT_TEXT_ORPHAN_VG_NAME, sizeof(FMT_TEXT_ORPHAN_VG_NAME));
@@ -1348,7 +1348,7 @@ static int _scan_file(const struct format_type *fmt, const char *vgname)
struct vgname_from_mda_params{
const struct format_type *fmt;
- struct mda_header *mdah;
+ const struct mda_header *mdah;
struct device_area *dev_area;
int primary_mda;
struct lvmcache_vgsummary *vgsummary;
@@ -1360,14 +1360,14 @@ struct vgname_from_mda_params{
int ret;
};
-static void _vgname_from_mda_process(int failed, void *context, void *data)
+static void _vgname_from_mda_process(int failed, void *context, const void *data)
{
struct vgname_from_mda_params *vfmp = context;
- struct mda_header *mdah = vfmp->mdah;
+ const struct mda_header *mdah = vfmp->mdah;
struct device_area *dev_area = vfmp->dev_area;
struct lvmcache_vgsummary *vgsummary = vfmp->vgsummary;
uint64_t *mda_free_sectors = vfmp->mda_free_sectors;
- struct raw_locn *rlocn = mdah->raw_locns;
+ const struct raw_locn *rlocn = mdah->raw_locns;
uint64_t buffer_size, current_usage;
if (failed) {
@@ -1406,15 +1406,15 @@ out:
vfmp->update_vgsummary_fn(0, vfmp->update_vgsummary_context, vfmp->vgsummary);
}
-static void _vgname_from_mda_validate(int failed, void *context, void *data)
+static void _vgname_from_mda_validate(int failed, void *context, const void *data)
{
struct vgname_from_mda_params *vfmp = context;
- char *buffer = data;
+ const char *buffer = data;
const struct format_type *fmt = vfmp->fmt;
- struct mda_header *mdah = vfmp->mdah;
+ const struct mda_header *mdah = vfmp->mdah;
struct device_area *dev_area = vfmp->dev_area;
struct lvmcache_vgsummary *vgsummary = vfmp->vgsummary;
- struct raw_locn *rlocn = mdah->raw_locns;
+ const struct raw_locn *rlocn = mdah->raw_locns;
unsigned len = 0;
char buf[NAME_LEN + 1] __attribute__((aligned(8)));
@@ -1471,11 +1471,11 @@ out:
}
int vgname_from_mda(const struct format_type *fmt,
- struct mda_header *mdah, int primary_mda, struct device_area *dev_area,
+ const struct mda_header *mdah, int primary_mda, struct device_area *dev_area,
struct lvmcache_vgsummary *vgsummary, uint64_t *mda_free_sectors,
lvm_callback_fn_t update_vgsummary_fn, void *update_vgsummary_context)
{
- struct raw_locn *rlocn;
+ const struct raw_locn *rlocn;
struct vgname_from_mda_params *vfmp;
if (mda_free_sectors)
diff --git a/lib/format_text/import.c b/lib/format_text/import.c
index d6b72d4..a6310c9 100644
--- a/lib/format_text/import.c
+++ b/lib/format_text/import.c
@@ -43,7 +43,7 @@ struct import_vgsummary_params {
int ret;
};
-static void _import_vgsummary(int failed, void *context, void *data)
+static void _import_vgsummary(int failed, void *context, const void *data)
{
struct import_vgsummary_params *ivsp = context;
struct text_vg_version_ops **vsn;
@@ -150,7 +150,7 @@ struct import_vg_params {
char **desc;
};
-static void _import_vg(int failed, void *context, void *data)
+static void _import_vg(int failed, void *context, const void *data)
{
struct import_vg_params *ivp = context;
struct text_vg_version_ops **vsn;
diff --git a/lib/format_text/layout.h b/lib/format_text/layout.h
index 986f779..f99a6f8 100644
--- a/lib/format_text/layout.h
+++ b/lib/format_text/layout.h
@@ -107,7 +107,7 @@ struct mda_context {
#define MDA_ORIGINAL_ALIGNMENT 512 /* Original alignment used for start of VG metadata content */
#define MDA_ALIGNMENT 4096 /* Default alignment in bytes since 2.02.177 for start of VG metadata content. */
-int vgname_from_mda(const struct format_type *fmt, struct mda_header *mdah, int primary_mda,
+int vgname_from_mda(const struct format_type *fmt, const struct mda_header *mdah, int primary_mda,
struct device_area *dev_area, struct lvmcache_vgsummary *vgsummary,
uint64_t *mda_free_sectors,
lvm_callback_fn_t update_vgsummary_callback_fn, void *update_vgsummary_callback_context);
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index d0782a9..7f3b2d3 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -336,10 +336,10 @@ struct process_mda_header_params {
int ret;
};
-static void _process_vgsummary(int failed, void *context, void *data)
+static void _process_vgsummary(int failed, void *context, const void *data)
{
struct process_mda_header_params *pmp = context;
- struct lvmcache_vgsummary *vgsummary = data;
+ const struct lvmcache_vgsummary *vgsummary = data;
--pmp->umb->nr_outstanding_mdas;
@@ -357,10 +357,10 @@ out:
stack;
}
-static void _process_mda_header(int failed, void *context, void *data)
+static void _process_mda_header(int failed, void *context, const void *data)
{
struct process_mda_header_params *pmp = context;
- struct mda_header *mdah = data;
+ const struct mda_header *mdah = data;
struct update_mda_baton *umb = pmp->umb;
const struct format_type *fmt = umb->label->labeller->fmt;
struct metadata_area *mda = pmp->mda;
diff --git a/lib/label/label.c b/lib/label/label.c
index afb3b19..27b72d3 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -131,7 +131,7 @@ struct find_labeller_params {
int ret;
};
-static void _set_label_read_result(int failed, void *context, void *data)
+static void _set_label_read_result(int failed, void *context, const void *data)
{
struct find_labeller_params *flp = context;
struct label **result = flp->result;
@@ -154,17 +154,17 @@ out:
flp->process_label_data_fn(0, flp->process_label_data_context, NULL);
}
-static void _find_labeller(int failed, void *context, void *data)
+static void _find_labeller(int failed, void *context, const void *data)
{
struct find_labeller_params *flp = context;
- char *readbuf = data;
+ const char *readbuf = data;
struct device *dev = flp->dev;
uint64_t scan_sector = flp->scan_sector;
struct label **result = flp->result;
char labelbuf[LABEL_SIZE] __attribute__((aligned(8)));
struct labeller_i *li;
struct labeller *l = NULL; /* Set when a labeller claims the label */
- struct label_header *lh;
+ const struct label_header *lh;
struct lvmcache_info *info;
uint64_t sector;
@@ -246,7 +246,7 @@ int label_remove(struct device *dev)
struct labeller_i *li;
struct label_header *lh;
struct lvmcache_info *info;
- char *readbuf = NULL;
+ const char *readbuf = NULL;
memset(labelbuf, 0, LABEL_SIZE);
diff --git a/lib/label/label.h b/lib/label/label.h
index 1f12294..7f365f2 100644
--- a/lib/label/label.h
+++ b/lib/label/label.h
@@ -97,7 +97,7 @@ int label_remove(struct device *dev);
int label_read(struct device *dev, struct label **result,
uint64_t scan_sector);
int label_read_callback(struct dm_pool *mem, struct device *dev, uint64_t scan_sector,
- lvm_callback_fn_t process_label_data_fn, void *process_label_data_context);
+ lvm_callback_fn_t process_label_data_fn, void *process_label_data_context);
int label_write(struct device *dev, struct label *label);
struct label *label_create(struct labeller *labeller);
void label_destroy(struct label *label);
6 years, 4 months
master - device: Eliminate unnecessary buffer from dev_read.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c350f96c09f3fb591de...
Commit: c350f96c09f3fb591de1742829006769f53c29eb
Parent: 366493a1d1900757f4a203d3b89185afb878ad30
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 18:48:01 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 18:48:01 2018 +0000
device: Eliminate unnecessary buffer from dev_read.
---
lib/device/dev-io.c | 39 ++++++++++++---------------------------
lib/format_text/format-text.c | 14 +++++---------
lib/label/label.c | 1 -
3 files changed, 17 insertions(+), 37 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index bacc7de..9920ee5 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -817,7 +817,7 @@ static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_rea
/* Reuse this buffer */
devbuf->data = (char *) devbuf->buf + (offset - devbuf->where.start);
log_debug_io("Cached read for %" PRIu64 " bytes at %" PRIu64 " on %s (for %s)",
- len, (uint64_t) offset, dev_name(dev), _reason_text(reason));
+ (uint64_t) len, (uint64_t) offset, dev_name(dev), _reason_text(reason));
return 1;
}
}
@@ -833,27 +833,18 @@ static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_rea
return ret;
}
-/* Caller is responsible for dm_free */
+/* Returns pointer to read-only buffer. Caller does not free it. */
char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason)
{
- char *buf;
-
- if (!(buf = dm_malloc(len))) {
- log_error("Buffer allocation failed for device read.");
- return NULL;
- }
-
if (!_dev_read(dev, offset, len, reason)) {
log_error("Read from %s failed", dev_name(dev));
- dm_free(buf);
return NULL;
}
- memcpy(buf, DEV_DEVBUF(dev, reason)->data, len);
-
- return buf;
+ return DEV_DEVBUF(dev, reason)->data;
}
+/* Obtains data requested then passes it (read-only) to dev_read_callback_fn() */
int dev_read_callback(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason,
lvm_callback_fn_t dev_read_callback_fn, void *callback_context)
{
@@ -873,17 +864,15 @@ out:
return r;
}
-/* Read into supplied retbuf */
+/* Read into supplied retbuf owned by the caller. */
int dev_read_buf(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason, void *retbuf)
{
- char *buf = NULL;
-
- if (!(buf = dev_read(dev, offset, len, reason)))
- return_0;
+ if (!_dev_read(dev, offset, len, reason)) {
+ log_error("Read from %s failed", dev_name(dev));
+ return 0;
+ }
- memcpy(retbuf, buf, len);
-
- dm_free(buf);
+ memcpy(retbuf, DEV_DEVBUF(dev, reason)->data, len);
return 1;
}
@@ -902,22 +891,18 @@ char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
return NULL;
}
- if (!_dev_read(dev, offset, len, reason)) {
+ if (!dev_read_buf(dev, offset, len, reason, buf)) {
log_error("Read from %s failed", dev_name(dev));
dm_free(buf);
return NULL;
}
- memcpy(buf, DEV_DEVBUF(dev, reason)->data, len);
-
- if (!_dev_read(dev, offset2, len2, reason)) {
+ if (!dev_read_buf(dev, offset2, len2, reason, buf + len)) {
log_error("Circular read from %s failed", dev_name(dev));
dm_free(buf);
return NULL;
}
- memcpy(buf + len, DEV_DEVBUF(dev, reason)->data, len2);
-
return buf;
}
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 26a5007..d28449c 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -272,20 +272,20 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
size += SECTOR_SIZE;
}
}
- dm_free(buf);
+ if (circular)
+ dm_free(buf);
buf = NULL;
}
r = 1;
out:
- dm_free(buf);
+ if (circular)
+ dm_free(buf);
if (!dev_close(area->dev))
stack;
return r;
}
-
-
static int _text_lv_setup(struct format_instance *fid __attribute__((unused)),
struct logical_volume *lv)
{
@@ -512,12 +512,8 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
goto_bad;
if (!strncmp(buf, vgname, len = strlen(vgname)) &&
- (isspace(*(buf + len)) || *(buf + len) == '{')) {
- dm_free(buf);
+ (isspace(*(buf + len)) || *(buf + len) == '{'))
return rlocn;
- }
-
- dm_free(buf);
log_debug_metadata("Volume group name found in %smetadata on %s at " FMTu64 " does "
"not match expected name %s.",
diff --git a/lib/label/label.c b/lib/label/label.c
index 919a507..afb3b19 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -307,7 +307,6 @@ int label_remove(struct device *dev)
if (!dev_close(dev))
stack;
- dm_free(readbuf);
return r;
}
6 years, 4 months
master - device: Suppress repeated reads of the same data.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=366493a1d1900757f4a...
Commit: 366493a1d1900757f4a203d3b89185afb878ad30
Parent: dcb2a5a6116ed4853933e1a72e185a8109aab9cc
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 13:19:12 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 15:52:03 2018 +0000
device: Suppress repeated reads of the same data.
If the data being requested is present in last_[extra_]devbuf,
return that directly instead of reading it from disk again.
Typical LVM2 access patterns request data within two adjacent 4k blocks
so we eliminate some read() system calls by always reading at least 8k.
---
WHATS_NEW | 1 +
lib/device/dev-io.c | 33 +++++++++++++++++++++++++++++++--
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 897576c..489c315 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Suppress some repeated reads of the same disk data at the device layer.
Avoid exceeding array bounds in allocation tag processing.
Refactor metadata reading code to use callback functions.
Move memory allocation for the key dev_reads into the device layer.
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 30e4235..bacc7de 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -53,6 +53,12 @@
# endif
#endif
+/*
+ * Always read at least 8k from disk.
+ * This seems to be a good compromise for the existing LVM2 metadata layout.
+ */
+#define MIN_READ_SIZE (8 * 1024)
+
static DM_LIST_INIT(_open_devices);
static unsigned _dev_size_seqno = 1;
@@ -273,6 +279,11 @@ static int _aligned_io(struct device_area *where, char *buffer,
if (!block_size)
block_size = lvm_getpagesize();
+
+ /* Apply minimum read size */
+ if (!should_write && block_size < MIN_READ_SIZE)
+ block_size = MIN_READ_SIZE;
+
mask = block_size - 1;
_widen_region(block_size, where, &widened);
@@ -785,14 +796,32 @@ static void _dev_inc_error_count(struct device *dev)
static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason)
{
struct device_area where;
+ struct device_buffer *devbuf;
+ uint64_t buf_end;
int ret;
- if (!dev->open_count)
- return_0;
+ if (!dev->open_count) {
+ log_error(INTERNAL_ERROR "Attempt to access device %s while closed.", dev_name(dev));
+ return 0;
+ }
if (!_dev_is_valid(dev))
return 0;
+ /*
+ * Can we satisfy this from data we stored last time we read?
+ */
+ if ((devbuf = DEV_DEVBUF(dev, reason)) && devbuf->malloc_address) {
+ buf_end = devbuf->where.start + devbuf->where.size - 1;
+ if (offset >= devbuf->where.start && offset <= buf_end && offset + len - 1 <= buf_end) {
+ /* Reuse this buffer */
+ devbuf->data = (char *) devbuf->buf + (offset - devbuf->where.start);
+ log_debug_io("Cached read for %" PRIu64 " bytes at %" PRIu64 " on %s (for %s)",
+ len, (uint64_t) offset, dev_name(dev), _reason_text(reason));
+ return 1;
+ }
+ }
+
where.dev = dev;
where.start = offset;
where.size = len;
6 years, 4 months
master - device: Remove some data copying between buffers.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dcb2a5a6116ed485393...
Commit: dcb2a5a6116ed4853933e1a72e185a8109aab9cc
Parent: 4d568b709cec5f84c8a8a278747b997a75b4c463
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 13:18:56 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 15:48:03 2018 +0000
device: Remove some data copying between buffers.
Callers that read larger amounts of data now get a pointer to read-only
data directly without copying it through an intermediate buffer. This
data is owned by the device layer so the callers no longer free it.
---
lib/config/config.c | 4 +---
lib/device/dev-io.c | 38 ++++++++++++++++++--------------------
lib/device/device.h | 1 +
lib/format_text/format-text.c | 6 +-----
lib/label/label.c | 2 --
5 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 7217cd9..9dd8a61 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -534,9 +534,6 @@ static void _process_config_file_buffer(int failed, void *context, void *data)
}
out:
- if (!failed && !pcfp->use_mmap)
- dm_free(data);
-
if (pcfp->config_file_read_fd_callback)
pcfp->config_file_read_fd_callback(!pcfp->ret, pcfp->config_file_read_fd_context, NULL);
}
@@ -612,6 +609,7 @@ int config_file_read_fd(struct dm_pool *mem, struct dm_config_tree *cft, struct
if (!(buf = dev_read_circular(dev, (uint64_t) offset, size, (uint64_t) offset2, size2, reason)))
goto_out;
_process_config_file_buffer(0, pcfp, buf);
+ dm_free(buf);
} else if (!dev_read_callback(dev, (uint64_t) offset, size, reason, _process_config_file_buffer, pcfp))
goto_out;
r = pcfp->ret;
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 18a09d1..30e4235 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -284,7 +284,7 @@ static int _aligned_io(struct device_area *where, char *buffer,
where->size, (uint64_t) where->start, widened.size, (uint64_t) widened.start, dev_name(where->dev), _reason_text(reason));
}
- if (!buffer_was_widened && !((uintptr_t) buffer & mask))
+ if (should_write && !buffer_was_widened && !((uintptr_t) buffer & mask))
/* Perform the I/O directly. */
bounce = buffer;
#ifndef DEBUG_MEM
@@ -308,7 +308,7 @@ static int _aligned_io(struct device_area *where, char *buffer,
}
#endif
- devbuf = EXTRA_IO(reason) ? &where->dev->last_extra_devbuf : &where->dev->last_devbuf;
+ devbuf = DEV_DEVBUF(where->dev, reason);
_release_devbuf(devbuf);
devbuf->malloc_address = bounce_buf;
devbuf->buf = bounce;
@@ -345,9 +345,6 @@ static int _aligned_io(struct device_area *where, char *buffer,
}
/* read */
- if (bounce_buf)
- memcpy(buffer, bounce + (where->start - widened.start),
- (size_t) where->size);
/* We store what we just read as it often also satisfies the next request */
devbuf->data = bounce + (where->start - widened.start);
@@ -782,7 +779,10 @@ static void _dev_inc_error_count(struct device *dev)
dev->max_error_count, dev_name(dev));
}
-static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason, char *buf)
+/*
+ * Data is returned (read-only) at dev->last_[extra_]devbuf->data
+ */
+static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason)
{
struct device_area where;
int ret;
@@ -797,7 +797,7 @@ static int _dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_rea
where.start = offset;
where.size = len;
- ret = _aligned_io(&where, buf, 0, reason);
+ ret = _aligned_io(&where, NULL, 0, reason);
if (!ret)
_dev_inc_error_count(dev);
@@ -814,30 +814,24 @@ char *dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t
return NULL;
}
- if (!_dev_read(dev, offset, len, reason, buf)) {
+ if (!_dev_read(dev, offset, len, reason)) {
log_error("Read from %s failed", dev_name(dev));
dm_free(buf);
return NULL;
}
+ memcpy(buf, DEV_DEVBUF(dev, reason)->data, len);
+
return buf;
}
-/* Callback fn is responsible for dm_free */
int dev_read_callback(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason,
lvm_callback_fn_t dev_read_callback_fn, void *callback_context)
{
- char *buf;
int r = 0;
- if (!(buf = dm_malloc(len))) {
- log_error("Buffer allocation failed for device read.");
- goto out;
- }
-
- if (!_dev_read(dev, offset, len, reason, buf)) {
+ if (!_dev_read(dev, offset, len, reason)) {
log_error("Read from %s failed", dev_name(dev));
- dm_free(buf);
goto out;
}
@@ -845,7 +839,7 @@ int dev_read_callback(struct device *dev, uint64_t offset, size_t len, dev_io_re
out:
if (dev_read_callback_fn)
- dev_read_callback_fn(!r, callback_context, buf);
+ dev_read_callback_fn(!r, callback_context, DEV_DEVBUF(dev, reason)->data);
return r;
}
@@ -879,18 +873,22 @@ char *dev_read_circular(struct device *dev, uint64_t offset, size_t len,
return NULL;
}
- if (!_dev_read(dev, offset, len, reason, buf)) {
+ if (!_dev_read(dev, offset, len, reason)) {
log_error("Read from %s failed", dev_name(dev));
dm_free(buf);
return NULL;
}
- if (!_dev_read(dev, offset2, len2, reason, buf + len)) {
+ memcpy(buf, DEV_DEVBUF(dev, reason)->data, len);
+
+ if (!_dev_read(dev, offset2, len2, reason)) {
log_error("Circular read from %s failed", dev_name(dev));
dm_free(buf);
return NULL;
}
+ memcpy(buf + len, DEV_DEVBUF(dev, reason)->data, len2);
+
return buf;
}
diff --git a/lib/device/device.h b/lib/device/device.h
index 1728596..cf44362 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -124,6 +124,7 @@ typedef enum dev_io_reason {
* Is this I/O for a device's extra metadata area?
*/
#define EXTRA_IO(reason) ((reason) == DEV_IO_MDA_EXTRA_HEADER || (reason) == DEV_IO_MDA_EXTRA_CONTENT)
+#define DEV_DEVBUF(dev, reason) (EXTRA_IO((reason)) ? &(dev)->last_extra_devbuf : &(dev)->last_devbuf)
struct device_list {
struct dm_list list;
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 7e80a11..26a5007 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -385,9 +385,6 @@ static void _process_raw_mda_header(int failed, void *context, void *data)
bad:
prmp->ret = 0;
out:
- if (!failed)
- dm_free(data);
-
if (prmp->ret && prmp->mdah_callback_fn)
prmp->mdah_callback_fn(0, prmp->mdah_callback_context, mdah);
}
@@ -1474,8 +1471,7 @@ static void _vgname_from_mda_validate(int failed, void *context, void *data)
}
out:
- if (!failed)
- dm_free(data);
+ ;
}
int vgname_from_mda(const struct format_type *fmt,
diff --git a/lib/label/label.c b/lib/label/label.c
index 362a1b0..919a507 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -226,8 +226,6 @@ static void _find_labeller(int failed, void *context, void *data)
}
}
- dm_free(readbuf);
-
if (!l) {
if ((info = lvmcache_info_from_pvid(dev->pvid, dev, 0)))
_update_lvmcache_orphan(info);
6 years, 4 months
master - device: Free cached device bufs when metadata invalid or dev closed.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4d568b709cec5f84c8a...
Commit: 4d568b709cec5f84c8a8a278747b997a75b4c463
Parent: bd0967a4b1ac3dc6402b0e9ad8bc2f85f4f7af1c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 12:03:31 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 15:48:03 2018 +0000
device: Free cached device bufs when metadata invalid or dev closed.
---
lib/cache/lvmcache.c | 6 ++++++
lib/device/dev-io.c | 4 ++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 53f1c95..017a86b 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -141,6 +141,8 @@ void lvmcache_seed_infos_from_lvmetad(struct cmd_context *cmd)
/* Volume Group metadata cache functions */
static void _free_cached_vgmetadata(struct lvmcache_vginfo *vginfo)
{
+ struct lvmcache_info *info;
+
if (!vginfo || !vginfo->vgmetadata)
return;
@@ -154,6 +156,10 @@ static void _free_cached_vgmetadata(struct lvmcache_vginfo *vginfo)
vginfo->cft = NULL;
}
+ /* Invalidate any cached device buffers */
+ dm_list_iterate_items(info, &vginfo->infos)
+ devbufs_release(info->dev);
+
log_debug_cache("lvmcache: VG %s wiped.", vginfo->vgname);
release_vg(vginfo->cached_vg);
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 47d3ad9..18a09d1 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -85,6 +85,9 @@ static void _release_devbuf(struct device_buffer *devbuf)
void devbufs_release(struct device *dev)
{
+ if ((dev->flags & DEV_REGULAR))
+ return;
+
_release_devbuf(&dev->last_devbuf);
_release_devbuf(&dev->last_extra_devbuf);
}
@@ -706,6 +709,7 @@ static void _close(struct device *dev)
dev->phys_block_size = -1;
dev->block_size = -1;
dm_list_del(&dev->open_list);
+ devbufs_release(dev);
log_debug_devs("Closed %s", dev_name(dev));
6 years, 4 months
master - device: Keep the last data buffer read off each device.
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bd0967a4b1ac3dc6402...
Commit: bd0967a4b1ac3dc6402b0e9ad8bc2f85f4f7af1c
Parent: bacc94233368cf136b55e2574e969e7f53b31c6c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 02:09:06 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 15:48:03 2018 +0000
device: Keep the last data buffer read off each device.
If there's a second metadata area on device, we record that separately.
Note that the memory requirements aren't restricted yet.
---
lib/device/dev-cache.c | 10 +++
lib/device/dev-io.c | 156 +++++++++++++++++++++++++++++++-----------------
lib/device/device.h | 31 ++++++++--
3 files changed, 137 insertions(+), 60 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 2cd38f4..3d57735 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1247,12 +1247,22 @@ int dev_cache_check_for_open_devices(void)
int dev_cache_exit(void)
{
+ struct btree_iter *b;
int num_open = 0;
if (_cache.names)
if ((num_open = _check_for_open_devices(1)) > 0)
log_error(INTERNAL_ERROR "%d device(s) were left open and have been closed.", num_open);
+ if (_cache.devices) {
+ /* FIXME Replace with structured devbuf cache */
+ b = btree_first(_cache.devices);
+ while (b) {
+ devbufs_release(btree_get_data(b));
+ b = btree_next(b);
+ }
+ }
+
if (_cache.mem)
dm_pool_destroy(_cache.mem);
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index ee4a0a5..47d3ad9 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -74,38 +74,33 @@ static const char *_reason_text(dev_io_reason_t reason)
return _reasons[(unsigned) reason];
}
+/*
+ * Release the memory holding the last data we read
+ */
+static void _release_devbuf(struct device_buffer *devbuf)
+{
+ dm_free(devbuf->malloc_address);
+ devbuf->malloc_address = NULL;
+}
+
+void devbufs_release(struct device *dev)
+{
+ _release_devbuf(&dev->last_devbuf);
+ _release_devbuf(&dev->last_extra_devbuf);
+}
+
/*-----------------------------------------------------------------
* The standard io loop that keeps submitting an io until it's
* all gone.
*---------------------------------------------------------------*/
-static int _io(struct device_area *where, char *buffer, int should_write, dev_io_reason_t reason)
+static int _io_sync(struct device_buffer *devbuf)
{
+ struct device_area *where = &devbuf->where;
int fd = dev_fd(where->dev);
+ char *buffer = devbuf->buf;
ssize_t n = 0;
size_t total = 0;
- if (fd < 0) {
- log_error("Attempt to read an unopened device (%s).",
- dev_name(where->dev));
- return 0;
- }
-
- log_debug_io("%s %s:%8" PRIu64 " bytes (sync) at %" PRIu64 "%s (for %s)",
- should_write ? "Write" : "Read ", dev_name(where->dev),
- where->size, (uint64_t) where->start,
- (should_write && test_mode()) ? " (test mode - suppressed)" : "", _reason_text(reason));
-
- /*
- * Skip all writes in test mode.
- */
- if (should_write && test_mode())
- return 1;
-
- if (where->size > SSIZE_MAX) {
- log_error("Read size too large: %" PRIu64, where->size);
- return 0;
- }
-
if (lseek(fd, (off_t) where->start, SEEK_SET) == (off_t) -1) {
log_error("%s: lseek %" PRIu64 " failed: %s",
dev_name(where->dev), (uint64_t) where->start,
@@ -115,7 +110,7 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
while (total < (size_t) where->size) {
do
- n = should_write ?
+ n = devbuf->write ?
write(fd, buffer, (size_t) where->size - total) :
read(fd, buffer, (size_t) where->size - total);
while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
@@ -123,7 +118,7 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
if (n < 0)
log_error_once("%s: %s failed after %" PRIu64 " of %" PRIu64
" at %" PRIu64 ": %s", dev_name(where->dev),
- should_write ? "write" : "read",
+ devbuf->write ? "write" : "read",
(uint64_t) total,
(uint64_t) where->size,
(uint64_t) where->start, strerror(errno));
@@ -138,6 +133,36 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
return (total == (size_t) where->size);
}
+static int _io(struct device_buffer *devbuf, dev_io_reason_t reason)
+{
+ struct device_area *where = &devbuf->where;
+ int fd = dev_fd(where->dev);
+
+ if (fd < 0) {
+ log_error("Attempt to read an unopened device (%s).",
+ dev_name(where->dev));
+ return 0;
+ }
+
+ log_debug_io("%s %s(fd %d):%8" PRIu64 " bytes (sync) at %" PRIu64 "%s (for %s)",
+ devbuf->write ? "Write" : "Read ", dev_name(where->dev), fd,
+ where->size, (uint64_t) where->start,
+ (devbuf->write && test_mode()) ? " (test mode - suppressed)" : "", _reason_text(reason));
+
+ /*
+ * Skip all writes in test mode.
+ */
+ if (devbuf->write && test_mode())
+ return 1;
+
+ if (where->size > SSIZE_MAX) {
+ log_error("Read size too large: %" PRIu64, where->size);
+ return 0;
+ }
+
+ return _io_sync(devbuf);
+}
+
/*-----------------------------------------------------------------
* LVM2 uses O_DIRECT when performing metadata io, which requires
* block size aligned accesses. If any io is not aligned we have
@@ -230,12 +255,13 @@ static void _widen_region(unsigned int block_size, struct device_area *region,
static int _aligned_io(struct device_area *where, char *buffer,
int should_write, dev_io_reason_t reason)
{
- char *bounce, *bounce_buf;
+ char *bounce, *bounce_buf = NULL;
unsigned int physical_block_size = 0;
unsigned int block_size = 0;
unsigned buffer_was_widened = 0;
uintptr_t mask;
struct device_area widened;
+ struct device_buffer *devbuf;
int r = 0;
if (!(where->dev->flags & DEV_REGULAR) &&
@@ -253,59 +279,81 @@ static int _aligned_io(struct device_area *where, char *buffer,
buffer_was_widened = 1;
log_debug_io("Widening request for %" PRIu64 " bytes at %" PRIu64 " to %" PRIu64 " bytes at %" PRIu64 " on %s (for %s)",
where->size, (uint64_t) where->start, widened.size, (uint64_t) widened.start, dev_name(where->dev), _reason_text(reason));
- } else if (!((uintptr_t) buffer & mask))
- /* Perform the I/O directly. */
- return _io(where, buffer, should_write, reason);
+ }
+ if (!buffer_was_widened && !((uintptr_t) buffer & mask))
+ /* Perform the I/O directly. */
+ bounce = buffer;
#ifndef DEBUG_MEM
- /* Allocate a bounce buffer with an extra block */
- if (!(bounce_buf = bounce = dm_malloc_aligned((size_t) widened.size, 0))) {
+ else if (!(bounce_buf = bounce = dm_malloc_aligned((size_t) widened.size, 0))) {
log_error("Bounce buffer malloc failed");
return 0;
}
#else
- /* Allocate a bounce buffer with an extra block */
- if (!(bounce_buf = bounce = dm_malloc((size_t) widened.size + block_size))) {
- log_error("Bounce buffer malloc failed");
- return 0;
- }
+ else {
+ /* Allocate a bounce buffer with an extra block */
+ if (!(bounce_buf = bounce = dm_malloc((size_t) widened.size + block_size))) {
+ log_error("Bounce buffer malloc failed");
+ return 0;
+ }
- /*
- * Realign start of bounce buffer (using the extra sector)
- */
- if (((uintptr_t) bounce) & mask)
- bounce = (char *) ((((uintptr_t) bounce) + mask) & ~mask);
+ /*
+ * Realign start of bounce buffer (using the extra sector)
+ */
+ if (((uintptr_t) bounce) & mask)
+ bounce = (char *) ((((uintptr_t) bounce) + mask) & ~mask);
+ }
#endif
+ devbuf = EXTRA_IO(reason) ? &where->dev->last_extra_devbuf : &where->dev->last_devbuf;
+ _release_devbuf(devbuf);
+ devbuf->malloc_address = bounce_buf;
+ devbuf->buf = bounce;
+ devbuf->where.dev = where->dev;
+ devbuf->where.start = widened.start;
+ devbuf->where.size = widened.size;
+ devbuf->write = 0;
+
/* Do we need to read into the bounce buffer? */
if ((!should_write || buffer_was_widened) &&
- !_io(&widened, bounce, 0, reason)) {
+ !_io(devbuf, reason)) {
if (!should_write)
- goto_out;
+ goto_bad;
/* FIXME Handle errors properly! */
/* FIXME pre-extend the file */
memset(bounce, '\n', widened.size);
}
if (should_write) {
- memcpy(bounce + (where->start - widened.start), buffer,
- (size_t) where->size);
+ if (bounce_buf) {
+ memcpy(bounce + (where->start - widened.start), buffer,
+ (size_t) where->size);
+ log_debug_io("Overwriting %" PRIu64 " bytes at %" PRIu64 " (for %s)", where->size,
+ (uint64_t) where->start, _reason_text(reason));
+ }
/* ... then we write */
- if (!(r = _io(&widened, bounce, 1, reason)))
- stack;
+ devbuf->write = 1;
+ if (!(r = _io(devbuf, reason)))
+ goto_bad;
- goto out;
+ _release_devbuf(devbuf);
+ return 1;
}
- memcpy(buffer, bounce + (where->start - widened.start),
- (size_t) where->size);
+ /* read */
+ if (bounce_buf)
+ memcpy(buffer, bounce + (where->start - widened.start),
+ (size_t) where->size);
- r = 1;
+ /* We store what we just read as it often also satisfies the next request */
+ devbuf->data = bounce + (where->start - widened.start);
-out:
- dm_free(bounce_buf);
- return r;
+ return 1;
+
+bad:
+ _release_devbuf(devbuf);
+ return 0;
}
static int _dev_get_size_file(struct device *dev, uint64_t *size)
diff --git a/lib/device/device.h b/lib/device/device.h
index 4349222..1728596 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -56,6 +56,22 @@ struct dev_ext {
void *handle;
};
+struct device_area {
+ struct device *dev;
+ uint64_t start; /* Bytes */
+ uint64_t size; /* Bytes */
+};
+
+struct device_buffer {
+ void *data; /* Location of start of requested data (inside buf) */
+
+ /* Private */
+ void *malloc_address; /* Start of allocated memory */
+ void *buf; /* Aligned buffer that contains data within it */
+ struct device_area where; /* Location of buf */
+ unsigned write:1; /* 1 if write; 0 if read */
+};
+
/*
* All devices in LVM will be represented by one of these.
* pointer comparisons are valid.
@@ -78,6 +94,8 @@ struct device {
uint64_t end;
struct dm_list open_list;
struct dev_ext ext;
+ struct device_buffer last_devbuf; /* Last data buffer read from the device */
+ struct device_buffer last_extra_devbuf; /* Last data buffer read from the device for extra metadata area */
const char *vgid; /* if device is an LV */
const char *lvid; /* if device is an LV */
@@ -102,17 +120,16 @@ typedef enum dev_io_reason {
DEV_IO_LOG /* Logging messages */
} dev_io_reason_t;
+/*
+ * Is this I/O for a device's extra metadata area?
+ */
+#define EXTRA_IO(reason) ((reason) == DEV_IO_MDA_EXTRA_HEADER || (reason) == DEV_IO_MDA_EXTRA_CONTENT)
+
struct device_list {
struct dm_list list;
struct device *dev;
};
-struct device_area {
- struct device *dev;
- uint64_t start; /* Bytes */
- uint64_t size; /* Bytes */
-};
-
/*
* Support for external device info.
*/
@@ -174,6 +191,8 @@ struct device *dev_create_file(const char *filename, struct device *dev,
struct dm_str_list *alias, int use_malloc);
void dev_destroy_file(struct device *dev);
+void devbufs_release(struct device *dev);
+
/* Return a valid device name from the alias list; NULL otherwise */
const char *dev_name_confirmed(struct device *dev, int quiet);
6 years, 4 months
master - allocation: Avoid exceeding array bounds in allocation tag code
by Alasdair Kergon
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bacc94233368cf136b5...
Commit: bacc94233368cf136b55e2574e969e7f53b31c6c
Parent: e2438b5b9ff526cae8fa29ca7023b43995f00647
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Jan 10 02:03:32 2018 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Jan 10 15:48:03 2018 +0000
allocation: Avoid exceeding array bounds in allocation tag code
If _limit_to_one_area_per_tag() changes nothing it writes beyond
the array.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 345c472..897576c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
+ Avoid exceeding array bounds in allocation tag processing.
Refactor metadata reading code to use callback functions.
Move memory allocation for the key dev_reads into the device layer.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 70dc2d9..ac30dad 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2737,7 +2737,8 @@ static int _limit_to_one_area_per_tag(struct alloc_handle *ah, struct alloc_stat
s++;
}
- alloc_state->areas[u].pva = NULL;
+ if (u < alloc_state->areas_size)
+ alloc_state->areas[u].pva = NULL;
return 1;
}
6 years, 4 months