Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=faccdeda83ee8c04…
Commit: faccdeda83ee8c04546a2224fa2dee82a55413fe
Parent: e9a233ee8ef362fccc5537125a19c28e5d596168
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Mar 9 18:53:22 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Mar 9 18:53:22 2015 +0000
comments: Use full flag names.
---
lib/format_text/export.c | 8 ++++----
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/metadata.c | 14 +++++++-------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 2d985b4..018772e 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -411,8 +411,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outfc(f, "# informational", "format = \"%s\"", fmt->name);
/*
- * Removing WRITE and adding WRITE_LOCKED makes it read-only
- * to old versions of lvm that only look for WRITE.
+ * Removing WRITE and adding LVM_WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for LVM_WRITE.
*/
if ((status & LVM_WRITE) && vg_flag_write_locked(vg)) {
status &= ~LVM_WRITE;
@@ -630,8 +630,8 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "id = \"%s\"", buffer);
/*
- * Removing WRITE and adding WRITE_LOCKED makes it read-only
- * to old versions of lvm that only look for WRITE.
+ * Removing WRITE and adding LVM_WRITE_LOCKED makes it read-only
+ * to old versions of lvm that only look for LVM_WRITE.
*/
if ((status & LVM_WRITE) && vg_flag_write_locked(lv->vg)) {
status &= ~LVM_WRITE;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index b5ab1f2..414216a 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -58,6 +58,7 @@
#define LVM_READ UINT64_C(0x0000000000000100) /* LV, VG */
#define LVM_WRITE UINT64_C(0x0000000000000200) /* LV, VG */
+#define LVM_WRITE_LOCKED UINT64_C(0x0020000000000000) /* LV, VG */
#define CLUSTERED UINT64_C(0x0000000000000400) /* VG */
//#define SHARED UINT64_C(0x0000000000000800) /* VG */
@@ -122,7 +123,6 @@
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
e.g. to prohibit allocation of a RAID image
on a PV already holing an image of the RAID set */
-#define LVM_WRITE_LOCKED UINT64_C(0x0020000000000000) /* VG, LV */
/* Next unused flag: UINT64_C(0x0040000000000000) */
/* Format features flags */
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index f495bdd..ab23d25 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4249,22 +4249,22 @@ int vg_check_write_mode(struct volume_group *vg)
/*
* Return 1 if the VG metadata should be written
- * *without* the WRITE flag in the status line, and
- * *with* the WRITE_LOCKED flag in the flags line.
+ * *without* the LVM_WRITE flag in the status line, and
+ * *with* the LVM_WRITE_LOCKED flag in the flags line.
*
* If this is done for a VG, it forces previous versions
- * of lvm (before the WRITE_LOCKED flag was added), to view
- * the VG and its LVs as read-only (because the WRITE flag
+ * of lvm (before the LVM_WRITE_LOCKED flag was added), to view
+ * the VG and its LVs as read-only (because the LVM_WRITE flag
* is missing). Versions of lvm that understand the
- * WRITE_LOCKED flag know to check the other methods of
+ * LVM_WRITE_LOCKED flag know to check the other methods of
* access control for the VG, specifically system_id and lock_type.
*
* So, if a VG has a system_id or lock_type, then the
* system_id and lock_type control access to the VG in
* addition to its basic writable status. Because previous
* lvm versions do not know about system_id or lock_type,
- * VGs depending on either of these should have WRITE_LOCKED
- * instead of WRITE to prevent the previous lvm versions from
+ * VGs depending on either of these should have LVM_WRITE_LOCKED
+ * instead of LVM_WRITE to prevent the previous lvm versions from
* assuming they can write the VG and its LVs.
*/
int vg_flag_write_locked(struct volume_group *vg)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e9a233ee8ef362fc…
Commit: e9a233ee8ef362fccc5537125a19c28e5d596168
Parent: 08371a8b8031b43394d80612d24029cfd4c710d4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Mar 9 13:27:34 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Mar 9 13:27:34 2015 -0500
system_id: detect an lvm1 system id
Detect an lvm1 system id by looking at the WRITE_LOCKED flag.
Don't copy this lvm1 system id into vg->system_id so that the
restrictions associated with the new system id are not applied
to the old VG with the inherited lvm1 system id.
---
lib/format_text/import_vsn1.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 6afe71d..837af6b 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -812,6 +812,14 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
+ /*
+ * A system id without WRITE_LOCKED is an old lvm1 system id.
+ */
+ if (!(vg->status & LVM_WRITE_LOCKED) && system_id[0]) {
+ memcpy(vg->lvm1_system_id, system_id, NAME_LEN + 1);
+ memset(system_id, 0, NAME_LEN + 1);
+ }
+
if (vg->status & LVM_WRITE_LOCKED) {
vg->status |= LVM_WRITE;
vg->status &= ~LVM_WRITE_LOCKED;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=08371a8b8031b433…
Commit: 08371a8b8031b43394d80612d24029cfd4c710d4
Parent: 588b3bd7a16b19423f9c4d06b27a3cbe7ac9d623
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 6 09:55:24 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Mar 6 09:57:37 2015 -0600
tests: fix systemid uname test
The string reported by uname -n may include characters
that lvm omits from the system id (like parens, as seen
on a test machine.) Check against the final system id
string that lvm uses.
---
test/shell/system_id.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/shell/system_id.sh b/test/shell/system_id.sh
index 6e80c1a..6aa367b 100644
--- a/test/shell/system_id.sh
+++ b/test/shell/system_id.sh
@@ -38,12 +38,13 @@ fi
## uname
-SID=$(uname -n)
-if [ -n $SID ]; then
+SID1=$(uname -n)
+if [ -n $SID1 ]; then
aux lvmconf "global/system_id_source = uname"
+SID2=$(lvm systemid | awk '{ print $3 }')
vgcreate $vg1 "$dev1"
vgs -o+systemid $vg1
-check vg_field $vg1 systemid $SID
+check vg_field $vg1 systemid $SID2
vgremove $vg1
fi
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=588b3bd7a16b1942…
Commit: 588b3bd7a16b19423f9c4d06b27a3cbe7ac9d623
Parent: 85ef614b37bafd3c91c9fb6e6cfb6c40d6f80f99
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 6 14:29:26 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 6 14:29:26 2015 +0100
tests: speed of many PVS in a VG
---
test/shell/vgcreate-many-pvs.sh | 62 +++++++++++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/test/shell/vgcreate-many-pvs.sh b/test/shell/vgcreate-many-pvs.sh
new file mode 100644
index 0000000..c6d3852
--- /dev/null
+++ b/test/shell/vgcreate-many-pvs.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/inittest
+
+#
+# Test to exercise larger number of PVs in a VG
+# Related to https://bugzilla.redhat.com/show_bug.cgi?id=736027
+#
+# Original measured times of the whole test case before
+# and with the acceleration patch from my bare metal hw
+# (Lenovo T61, 2.2GHz, 4G RAM, rawhide 2015-03-06 with ndebug kernel):
+#
+# export LVM_TEST_PVS=300
+#
+# make check_local ~52sec (U:29s, S:13s)
+# make check_lvmetad ~20sec (U: 4s, S: 5s)
+#
+# With patch from 2015-03-06:
+#
+# make check_local ~30sec (U:10s, S:12s)
+# make check_lvmetad ~20sec (U: 4s, S: 5s)
+#
+
+# TODO: extend test suite to monitor performance and report regressions...
+
+# Use just 100 to get 'decent' speed on slow boxes
+LVM_TEST_PVS=${LVM_TEST_PVS:-100}
+
+#aux prepare_devs $LVM_TEST_PVS 8
+#vgcreate $vg $(< DEVICES)
+
+# prepare_vg is now directly using steps above
+aux prepare_vg $LVM_TEST_PVS
+
+# Check we have decent speed with typical commands
+vgs
+
+lvs
+
+pvs
+
+lvcreate -l1 -n $lv1 $vg
+
+lvremove -f $vg/$lv1
+
+vgremove -ff $vg
+
+#
+# TODO Turn this into another test case:
+#
+#for i in $(seq 1 $LVM_TEST_PVS); do
+# vgcreate ${vg}$i "$DM_DEV_DIR/mapper/${PREFIX}pv$i"
+#done
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04101bc4307e14f7…
Commit: 04101bc4307e14f71f6ca3a1d253761f82e6a76e
Parent: a9b28a4f2105b92fdfc9f3915859e0deec4004a0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 6 10:22:33 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 6 14:05:06 2015 +0100
lib: drop unneeded vg_read call
Since we take a lock inside vg_lock_newname() and we do a full
detection of presence of vgname inside all scanned labels,
there is no point to do this for second time to be sure
there is no such vg.
The only side-effect of such call would be a full validation of
some already exising VG metadata - but that's not the task for
vgcreate when create a new VG.
This call noticable reduces number of scans during 'vgcreate'.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 10 ----------
2 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9bf8699..680879d 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Don't do a full read of VG when creating a new VG with an existing name.
Reduce number of VG metadata parsing when looking for vgname on a PV.
Avoid reparsing same metadata when reading same metadata from multiple PVs.
Save extra device open/close when scanning device for size.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 57066a5..f495bdd 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1009,7 +1009,6 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
.context.vg_ref.vg_name = vg_name
};
struct format_instance *fid;
- int consistent = 0;
uint32_t rc;
if (!validate_name(vg_name)) {
@@ -1023,15 +1022,6 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
/* NOTE: let caller decide - this may be check for existence */
return _vg_make_handle(cmd, NULL, rc);
- /* FIXME: Is this vg_read_internal necessary? Move it inside
- vg_lock_newname? */
- /* is this vg name already in use ? */
- if ((vg = vg_read_internal(cmd, vg_name, NULL, WARN_PV_READ, &consistent))) {
- log_error("A volume group called '%s' already exists.", vg_name);
- unlock_and_release_vg(cmd, vg, vg_name);
- return _vg_make_handle(cmd, NULL, FAILED_EXIST);
- }
-
/* Strip dev_dir if present */
vg_name = strip_dir(vg_name, cmd->dev_dir);