master - lvmcache: rename suspended_vg to saved_vg
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f8616ac2d87b247dd9a...
Commit: f8616ac2d87b247dd9ae041d59e6dbe43c88172c
Parent: 28a9fcd94b810cbd603b4fb0c5149bf96f6caeaa
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 24 12:18:22 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 25 16:39:43 2018 -0500
lvmcache: rename suspended_vg to saved_vg
The copy of the VG which clvmd stashes in lvmcache should
not only be used between suspend and resume, but between
sequential LV operations in clvmd, so that clvmd does not
need to reread the VG for each one. Prepare for that by
renaming the stashed VG as "saved_vg".
---
lib/activate/activate.c | 12 ++--
lib/cache/lvmcache.c | 127 +++++++++++++++++++++++------------------------
lib/cache/lvmcache.h | 6 +-
3 files changed, 72 insertions(+), 73 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 565e643..9211714 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2181,8 +2181,8 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
* did happen (or failed), and it will resume LVs using the
* new/precommitted metadata if the vg_commit succeeded.
*/
- lvmcache_save_suspended_vg(lv->vg, 0);
- lvmcache_save_suspended_vg(lv_pre->vg, 1);
+ lvmcache_save_vg(lv->vg, 0);
+ lvmcache_save_vg(lv_pre->vg, 1);
if (!info.exists || info.suspended) {
if (!error_if_not_suspended) {
@@ -2405,16 +2405,16 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
* When called in clvmd, lvid_s is set and lv is not. We need to
* get the VG metadata without reading disks because devs are
* suspended. lv_suspend() saved old and new VG metadata for us
- * to use here. If vg_commit() happened, lvmcache_get_suspended_vg
+ * to use here. If vg_commit() happened, lvmcache_get_saved_vg
* will return the new metadata for us to use in resuming LVs.
- * If vg_commit() did not happen, lvmcache_get_suspended_vg
+ * If vg_commit() did not happen, lvmcache_get_saved_vg
* returns the old metadata which we use to resume LVs.
*/
if (!lv && lvid_s) {
lvid = (const union lvid *) lvid_s;
vgid = (const char *)lvid->id[0].uuid;
- if ((vg = lvmcache_get_suspended_vg(vgid))) {
+ if ((vg = lvmcache_get_saved_vg(vgid))) {
log_debug_activation("Resuming LVID %s found saved vg seqno %d %s", lvid_s, vg->seqno, vg->name);
if ((lv_found = find_lv_in_vg_by_lvid(vg, lvid))) {
log_debug_activation("Resuming LVID %s found saved LV %s", lvid_s, display_lvname(lv_found));
@@ -2655,7 +2655,7 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
lvid = (const union lvid *) lvid_s;
vgid = (const char *)lvid->id[0].uuid;
- if ((vg = lvmcache_get_suspended_vg(vgid))) {
+ if ((vg = lvmcache_get_saved_vg(vgid))) {
log_debug_activation("activation_filter for %s found saved VG seqno %d %s", lvid_s, vg->seqno, vg->name);
if ((lv_found = find_lv_in_vg_by_lvid(vg, lvid))) {
log_debug_activation("activation_filter for %s found saved LV %s", lvid_s, display_lvname(lv_found));
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index f1fd683..7978b07 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -69,37 +69,36 @@ struct lvmcache_vginfo {
/*
* The following are not related to lvmcache or vginfo,
* but are borrowing the vginfo to store the data.
+ * saved_vg_* are used only by clvmd.
*
- * suspended_vg_* are used only by clvmd suspend/resume.
+ * For activation/deactivation, these are used to avoid
+ * clvmd rereading a VG for each LV that is activated.
+ *
+ * For suspend/resume, this is used to avoid disk reads
+ * while devices are suspended:
* In suspend, both old (current) and new (precommitted)
* metadata is saved. (Each in three forms: buffer, cft,
* and vg). In resume, if the vg was committed
- * (suspended_vg_committed is set), then LVs are resumed
+ * (saved_vg_committed is set), then LVs are resumed
* using the new metadata, but if the vg wasn't committed,
* then LVs are resumed using the old metadata.
*
- * suspended_vg_committed is set to 1 when clvmd gets
+ * saved_vg_committed is set to 1 when clvmd gets
* LCK_VG_COMMIT from vg_commit().
*
- * These fields are only used between suspend and resume
- * in clvmd, and should never be used in any other way.
- * The contents of this data are never changed. This
- * data does not really belong in lvmcache, it's unrelated
+ * This data does not really belong in lvmcache, it's unrelated
* to lvmcache or vginfo, but it's just a convenient place
- * for clvmd to stash the VG between suspend and resume
- * (since the same caller isn't present to pass the VG to
- * both suspend and resume in the case of clvmd.)
- *
- * This data is not really a "cache" of the VG, it is just
- * a location to pass the VG between suspend and resume.
+ * for clvmd to stash the VG (since the same caller isn't
+ * present to pass the VG to both suspend and resume in the
+ * case of clvmd.)
*/
- int suspended_vg_committed;
- char *suspended_vg_old_buf;
- struct dm_config_tree *suspended_vg_old_cft;
- struct volume_group *suspended_vg_old;
- char *suspended_vg_new_buf;
- struct dm_config_tree *suspended_vg_new_cft;
- struct volume_group *suspended_vg_new;
+ int saved_vg_committed;
+ char *saved_vg_old_buf;
+ struct dm_config_tree *saved_vg_old_cft;
+ struct volume_group *saved_vg_old;
+ char *saved_vg_new_buf;
+ struct dm_config_tree *saved_vg_new_cft;
+ struct volume_group *saved_vg_new;
};
static struct dm_hash_table *_pvid_hash = NULL;
@@ -195,32 +194,32 @@ static void _update_cache_lock_state(const char *vgname, int locked)
_update_cache_vginfo_lock_state(vginfo, locked);
}
-static void _suspended_vg_free(struct lvmcache_vginfo *vginfo, int free_old, int free_new)
+static void _saved_vg_free(struct lvmcache_vginfo *vginfo, int free_old, int free_new)
{
if (free_old) {
- if (vginfo->suspended_vg_old_buf)
- dm_free(vginfo->suspended_vg_old_buf);
- if (vginfo->suspended_vg_old_cft)
- dm_config_destroy(vginfo->suspended_vg_old_cft);
- if (vginfo->suspended_vg_old)
- release_vg(vginfo->suspended_vg_old);
+ if (vginfo->saved_vg_old_buf)
+ dm_free(vginfo->saved_vg_old_buf);
+ if (vginfo->saved_vg_old_cft)
+ dm_config_destroy(vginfo->saved_vg_old_cft);
+ if (vginfo->saved_vg_old)
+ release_vg(vginfo->saved_vg_old);
- vginfo->suspended_vg_old_buf = NULL;
- vginfo->suspended_vg_old_cft = NULL;
- vginfo->suspended_vg_old = NULL;
+ vginfo->saved_vg_old_buf = NULL;
+ vginfo->saved_vg_old_cft = NULL;
+ vginfo->saved_vg_old = NULL;
}
if (free_new) {
- if (vginfo->suspended_vg_new_buf)
- dm_free(vginfo->suspended_vg_new_buf);
- if (vginfo->suspended_vg_new_cft)
- dm_config_destroy(vginfo->suspended_vg_new_cft);
- if (vginfo->suspended_vg_new)
- release_vg(vginfo->suspended_vg_new);
+ if (vginfo->saved_vg_new_buf)
+ dm_free(vginfo->saved_vg_new_buf);
+ if (vginfo->saved_vg_new_cft)
+ dm_config_destroy(vginfo->saved_vg_new_cft);
+ if (vginfo->saved_vg_new)
+ release_vg(vginfo->saved_vg_new);
- vginfo->suspended_vg_new_buf = NULL;
- vginfo->suspended_vg_new_cft = NULL;
- vginfo->suspended_vg_new = NULL;
+ vginfo->saved_vg_new_buf = NULL;
+ vginfo->saved_vg_new_cft = NULL;
+ vginfo->saved_vg_new = NULL;
}
}
@@ -232,12 +231,12 @@ static void _drop_metadata(const char *vgname, int drop_precommitted)
return;
if (drop_precommitted)
- _suspended_vg_free(vginfo, 0, 1);
+ _saved_vg_free(vginfo, 0, 1);
else
- _suspended_vg_free(vginfo, 1, 1);
+ _saved_vg_free(vginfo, 1, 1);
}
-void lvmcache_save_suspended_vg(struct volume_group *vg, int precommitted)
+void lvmcache_save_vg(struct volume_group *vg, int precommitted)
{
struct lvmcache_vginfo *vginfo;
struct format_instance *fid;
@@ -253,16 +252,16 @@ void lvmcache_save_suspended_vg(struct volume_group *vg, int precommitted)
goto_bad;
/* already saved */
- if (old && vginfo->suspended_vg_old &&
- (vginfo->suspended_vg_old->seqno == vg->seqno))
+ if (old && vginfo->saved_vg_old &&
+ (vginfo->saved_vg_old->seqno == vg->seqno))
return;
/* already saved */
- if (new && vginfo->suspended_vg_new &&
- (vginfo->suspended_vg_new->seqno == vg->seqno))
+ if (new && vginfo->saved_vg_new &&
+ (vginfo->saved_vg_new->seqno == vg->seqno))
return;
- _suspended_vg_free(vginfo, old, new);
+ _saved_vg_free(vginfo, old, new);
if (!(size = export_vg_to_buffer(vg, &susp_buf)))
goto_bad;
@@ -280,24 +279,24 @@ void lvmcache_save_suspended_vg(struct volume_group *vg, int precommitted)
goto_bad;
if (old) {
- vginfo->suspended_vg_old_buf = susp_buf;
- vginfo->suspended_vg_old_cft = susp_cft;
- vginfo->suspended_vg_old = susp_vg;
+ vginfo->saved_vg_old_buf = susp_buf;
+ vginfo->saved_vg_old_cft = susp_cft;
+ vginfo->saved_vg_old = susp_vg;
log_debug_cache("lvmcache saved suspended vg old seqno %d %s", vg->seqno, vg->name);
} else {
- vginfo->suspended_vg_new_buf = susp_buf;
- vginfo->suspended_vg_new_cft = susp_cft;
- vginfo->suspended_vg_new = susp_vg;
+ vginfo->saved_vg_new_buf = susp_buf;
+ vginfo->saved_vg_new_cft = susp_cft;
+ vginfo->saved_vg_new = susp_vg;
log_debug_cache("lvmcache saved suspended vg new seqno %d %s", vg->seqno, vg->name);
}
return;
bad:
- _suspended_vg_free(vginfo, old, new);
+ _saved_vg_free(vginfo, old, new);
log_debug_cache("lvmcache failed to save suspended pre %d vg %s", precommitted, vg->name);
}
-struct volume_group *lvmcache_get_suspended_vg(const char *vgid)
+struct volume_group *lvmcache_get_saved_vg(const char *vgid)
{
struct lvmcache_vginfo *vginfo;
@@ -305,20 +304,20 @@ struct volume_group *lvmcache_get_suspended_vg(const char *vgid)
return_NULL;
- if (vginfo->suspended_vg_committed)
- return vginfo->suspended_vg_new;
+ if (vginfo->saved_vg_committed)
+ return vginfo->saved_vg_new;
else
- return vginfo->suspended_vg_old;
+ return vginfo->saved_vg_old;
}
-void lvmcache_drop_suspended_vg(struct volume_group *vg)
+void lvmcache_drop_saved_vg(struct volume_group *vg)
{
struct lvmcache_vginfo *vginfo;
if (!(vginfo = lvmcache_vginfo_from_vgid((const char *)&vg->id)))
return;
- _suspended_vg_free(vginfo, 1, 1);
+ _saved_vg_free(vginfo, 1, 1);
}
/*
@@ -333,7 +332,7 @@ void lvmcache_commit_metadata(const char *vgname)
if (!(vginfo = lvmcache_vginfo_from_vgname(vgname, NULL)))
return;
- vginfo->suspended_vg_committed = 1;
+ vginfo->saved_vg_committed = 1;
}
void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
@@ -1483,7 +1482,7 @@ static int _free_vginfo(struct lvmcache_vginfo *vginfo)
dm_free(vginfo->system_id);
dm_free(vginfo->vgname);
dm_free(vginfo->creation_host);
- _suspended_vg_free(vginfo, 1, 1);
+ _saved_vg_free(vginfo, 1, 1);
if (*vginfo->vgid && _vgid_hash &&
lvmcache_vginfo_from_vgid(vginfo->vgid) == vginfo)
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index ad478bd..b62d589 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -213,9 +213,9 @@ int lvmcache_get_vg_devs(struct cmd_context *cmd,
struct dm_list *devs);
void lvmcache_set_independent_location(const char *vgname);
-void lvmcache_save_suspended_vg(struct volume_group *vg, int precommitted);
-struct volume_group *lvmcache_get_suspended_vg(const char *vgid);
-void lvmcache_drop_suspended_vg(struct volume_group *vg);
+void lvmcache_save_vg(struct volume_group *vg, int precommitted);
+struct volume_group *lvmcache_get_saved_vg(const char *vgid);
+void lvmcache_drop_saved_vg(struct volume_group *vg);
int lvmcache_scan_mismatch(struct cmd_context *cmd, const char *vgname, const char *vgid);
5 years, 12 months
master - Merge remote-tracking branch 'sourceware/master' into upstream
by Joe Thornber
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=28a9fcd94b810cbd603...
Commit: 28a9fcd94b810cbd603b4fb0c5149bf96f6caeaa
Parent: f2504257e463bf58d991f8d137923a1a48bf4404 dcb5434a7f4a3b736d72c7bebe276be6735142ce
Author: Joe Thornber <ejt(a)redhat.com>
AuthorDate: Wed Apr 25 09:18:42 2018 +0100
Committer: Joe Thornber <ejt(a)redhat.com>
CommitterDate: Wed Apr 25 09:18:42 2018 +0100
Merge remote-tracking branch 'sourceware/master' into upstream
.gitignore | 44 ++
Makefile.in | 23 +-
aclocal.m4 | 222 ++++---
conf/example.conf.in | 16 -
configure | 23 +-
configure.in | 25 -
daemons/clvmd/Makefile.in | 2 +-
daemons/clvmd/lvm-functions.c | 3 +-
doc/aio_design.txt | 215 ------
include/.symlinks.in | 1 +
include/configure.h.in | 19 +-
lib/Makefile.in | 1 +
lib/activate/activate.c | 82 +++-
lib/cache/lvmcache.c | 1076 ++++++++++++++----------------
lib/cache/lvmcache.h | 40 +-
lib/cache/lvmetad.c | 485 ++++++++++----
lib/commands/toolcontext.c | 23 +-
lib/commands/toolcontext.h | 5 +-
lib/config/config.c | 166 ++---
lib/config/config.h | 8 +-
lib/config/config_settings.h | 17 +-
lib/config/defaults.h | 4 -
lib/device/bcache.c | 1182 +++++++++++++++++++++++++++++++++
lib/device/bcache.h | 164 +++++
lib/device/dev-cache.c | 52 +--
lib/device/dev-cache.h | 14 +-
lib/device/dev-io.c | 628 +++---------------
lib/device/dev-luks.c | 2 +-
lib/device/dev-md.c | 2 +-
lib/device/dev-swap.c | 3 +-
lib/device/dev-type.c | 8 +-
lib/device/device.h | 105 +---
lib/filters/filter-composite.c | 4 +-
lib/filters/filter-persistent.c | 21 +-
lib/filters/filter.h | 2 +-
lib/format1/disk-rep.c | 11 +-
lib/format1/format1.c | 2 +-
lib/format1/lvm1-label.c | 20 +-
lib/format_pool/disk_rep.c | 5 +-
lib/format_pool/format_pool.c | 2 +-
lib/format_pool/pool_label.c | 13 +-
lib/format_text/archive.c | 6 +-
lib/format_text/archiver.c | 12 +-
lib/format_text/export.c | 21 +-
lib/format_text/format-text.c | 907 ++++++++++----------------
lib/format_text/import-export.h | 16 +-
lib/format_text/import.c | 281 ++++-----
lib/format_text/import_vsn1.c | 60 +-
lib/format_text/layout.h | 12 +-
lib/format_text/text_label.c | 205 ++-----
lib/label/label.c | 998 +++++++++++++++++++++-------
lib/label/label.h | 33 +-
lib/metadata/lv_manip.c | 2 +-
lib/metadata/metadata-exported.h | 13 +
lib/metadata/metadata-liblvm.c | 7 +-
lib/metadata/metadata.c | 429 +++++++------
lib/metadata/metadata.h | 17 +-
lib/metadata/vg.c | 5 -
lib/misc/lvm-globals.c | 23 -
lib/misc/lvm-globals.h | 4 -
libdm/libdm-config.c | 10 +-
liblvm/Makefile.in | 2 +-
liblvm/lvm_vg.c | 3 +-
make.tmpl.in | 65 ++-
man/Makefile.in | 81 ++--
old-tests/config/.gitignore | 1 -
old-tests/config/Makefile | 5 -
old-tests/config/config_t.c | 37 -
old-tests/config/empty_array.conf | 1 -
old-tests/config/vg0 | 169 -----
old-tests/datastruct/hash_t.c | 106 ---
old-tests/dev-mgr/dev_cache_t.c | 54 --
old-tests/device/Makefile.in | 29 -
old-tests/device/dev_cache_t.c | 70 --
old-tests/device/fill_device.c | 27 -
old-tests/device/random.c | 116 ----
old-tests/device/random.h | 32 -
old-tests/filters/Makefile.in | 35 -
old-tests/filters/pfilter_t.c | 121 ----
old-tests/filters/rfilter_t.c | 92 ---
old-tests/filters/sample.cfg | 21 -
old-tests/format1/Makefile.in | 52 --
old-tests/format1/get_pvs_t.c | 73 --
old-tests/format1/get_vgs_t.c | 69 --
old-tests/format1/pretty_print.c | 86 ---
old-tests/format1/pretty_print.h | 28 -
old-tests/format1/read_pv_t.c | 75 ---
old-tests/format1/read_vg_t.c | 75 ---
old-tests/format1/write_vg_t.c | 77 ---
old-tests/mm/Makefile.in | 33 -
old-tests/mm/dbg_malloc_t.c | 156 -----
scripts/Makefile.in | 2 +-
test/Makefile.in | 2 +-
test/lib/flavour-ndev-cluster.sh | 1 -
test/lib/flavour-ndev-vanilla.sh | 1 -
test/lib/flavour-udev-cluster.sh | 1 -
test/lib/flavour-udev-vanilla.sh | 1 -
test/shell/lvconvert-mirror-updown.sh | 25 +-
test/shell/lvconvert-mirror.sh | 129 ++--
test/shell/mda-rollback.sh | 3 +
test/shell/vgck.sh | 8 +-
test/shell/vgsplit-usage.sh | 2 +
test/unit/Makefile.in | 53 +-
test/unit/bcache_t.c | 636 ++++++++++++++++++
test/unit/run.c | 1 +
test/unit/units.h | 1 +
tools/Makefile.in | 75 ++-
tools/command.c | 15 +-
tools/commands.h | 18 +-
tools/lvchange.c | 4 +
tools/lvconvert.c | 7 +
tools/lvmcmdline.c | 19 +-
tools/lvmdiskscan.c | 7 +-
tools/polldaemon.c | 20 +-
tools/pvck.c | 2 +
tools/pvscan.c | 53 ++-
tools/toollib.c | 181 ++++--
tools/tools.h | 10 +-
tools/vgcfgrestore.c | 2 +
tools/vgchange.c | 17 +-
tools/vgcreate.c | 27 +-
tools/vgimportclone.c | 1 -
tools/vgmerge.c | 3 +
tools/vgrename.c | 5 -
tools/vgsplit.c | 3 +
unit-tests/datastruct/Makefile.in | 32 -
unit-tests/datastruct/TESTS | 1 -
unit-tests/datastruct/bitset_t.c | 133 ----
unit-tests/mm/Makefile.in | 31 -
unit-tests/mm/TESTS | 1 -
unit-tests/mm/check_results | 31 -
unit-tests/mm/pool_valgrind_t.c | 181 -----
unit-tests/regex/Makefile.in | 37 -
unit-tests/regex/TESTS | 3 -
unit-tests/regex/dev_patterns | 2 -
unit-tests/regex/devices.list | 880 ------------------------
unit-tests/regex/matcher_t.c | 156 -----
unit-tests/regex/matcher_t.expected | 16 -
unit-tests/regex/matcher_t.expected2 | 1 -
unit-tests/regex/matcher_t.expected3 | 3 -
unit-tests/regex/nonprint_input | 4 -
unit-tests/regex/nonprint_regexes | 3 -
unit-tests/regex/parse_t.c | 118 ----
unit-tests/regex/random_regexes | 100 ---
144 files changed, 5487 insertions(+), 7173 deletions(-)
diff --cc .gitignore
index 28846b1,0ac0a32..7e031bf
--- a/.gitignore
+++ b/.gitignore
@@@ -32,6 -31,50 +32,50 @@@ make.tmp
/tags
/tmp/
+
tools/man-generator
tools/man-generator.c
+
+ test/lib/lvchange
+ test/lib/lvconvert
+ test/lib/lvcreate
+ test/lib/lvdisplay
+ test/lib/lvextend
+ test/lib/lvmconfig
+ test/lib/lvmdiskscan
+ test/lib/lvmsadc
+ test/lib/lvmsar
+ test/lib/lvreduce
+ test/lib/lvremove
+ test/lib/lvrename
+ test/lib/lvresize
+ test/lib/lvs
+ test/lib/lvscan
+ test/lib/pvchange
+ test/lib/pvck
+ test/lib/pvcreate
+ test/lib/pvdisplay
+ test/lib/pvmove
+ test/lib/pvremove
+ test/lib/pvresize
+ test/lib/pvs
+ test/lib/pvscan
+ test/lib/vgcfgbackup
+ test/lib/vgcfgrestore
+ test/lib/vgchange
+ test/lib/vgck
+ test/lib/vgconvert
+ test/lib/vgcreate
+ test/lib/vgdisplay
+ test/lib/vgexport
+ test/lib/vgextend
+ test/lib/vgimport
+ test/lib/vgimportclone
+ test/lib/vgmerge
+ test/lib/vgmknodes
+ test/lib/vgreduce
+ test/lib/vgremove
+ test/lib/vgrename
+ test/lib/vgs
+ test/lib/vgscan
+ test/lib/vgsplit
-
5 years, 12 months
master - [git] Update .gitignore
by Joe Thornber
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2504257e463bf58d99...
Commit: f2504257e463bf58d991f8d137923a1a48bf4404
Parent: d51429254f4e9b17083af0c554aa7045e5ec08bb
Author: Joe Thornber <ejt(a)redhat.com>
AuthorDate: Mon Jan 29 09:40:21 2018 +0000
Committer: Joe Thornber <ejt(a)redhat.com>
CommitterDate: Mon Apr 23 09:49:37 2018 +0100
[git] Update .gitignore
---
.gitignore | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index a890cee..28846b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.5
*.7
*.8
+*.8_gen
*.a
*.d
*.o
@@ -30,3 +31,7 @@ make.tmpl
/cscope.out
/tags
/tmp/
+
+
+tools/man-generator
+tools/man-generator.c
5 years, 12 months
master - tests: more zero usage
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=dcb5434a7f4a3b736d7...
Commit: dcb5434a7f4a3b736d72c7bebe276be6735142ce
Parent: fc3ed8856f445079de43cd33f64582cee9bc80ea
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 21 11:21:38 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
tests: more zero usage
Another case where usage of zero backend for mirror legs is more
effective then using delayed_dev.
---
test/shell/lvconvert-mirror-updown.sh | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/test/shell/lvconvert-mirror-updown.sh b/test/shell/lvconvert-mirror-updown.sh
index 5c7b130..d5059c2 100644
--- a/test/shell/lvconvert-mirror-updown.sh
+++ b/test/shell/lvconvert-mirror-updown.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2018 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
@@ -16,26 +16,27 @@ SKIP_WITH_LVMLOCKD=1
. lib/inittest
-aux prepare_pvs 3
+aux prepare_pvs 3 100
get_devs
vgcreate -s 64k "$vg" "${DEVICES[@]}"
-lvcreate -aey -l10 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2"
+# Use zero devices for big mirror legs
+aux zero_dev "$dev2" $(get first_extent_sector "$dev2"):
+aux zero_dev "$dev3" $(get first_extent_sector "$dev3"):
-# Slow down device so we are able to start next conversion in parallel
-aux delay_dev "$dev3" 0 200
+lvcreate -aey -L90 --type mirror --corelog --regionsize 16k -m1 -n $lv1 $vg "$dev1" "$dev2"
lvconvert -m+1 -b $vg/$lv1 "$dev3"
-# To fix - wait helps here....
-#lvconvert $vg/$lv1
-lvs -a $vg
+# We want here ongoing conversion
-#
-# It fails so use 'should' and -vvvv for now
-#
-should lvconvert -vvvv -m-1 $vg/$lv1 "$dev2"
+lvs -a -o+seg_pe_ranges $vg
+
+# Now it should be able to drop 2nd. leg
+lvconvert -m-1 $vg/$lv1 "$dev2"
+
+lvs -a $vg
vgremove -f $vg
5 years, 12 months
master - tests: update testing to not use delay dev
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fc3ed8856f445079de4...
Commit: fc3ed8856f445079de43cd33f64582cee9bc80ea
Parent: c492fbb51ce783ca32efd7ed8414d809daaf4ca5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 23 21:26:05 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
tests: update testing to not use delay dev
Instead of using delayer device user 'zero' device and let mirror
do some real work which takes some time.
In case the test machine is too fast - mirror might need to be made bigger
to meet needed criteria.
Also move all test needed this 'zero' PV trick to the end of test
so $dev2 and $dev4 are covered with 'zero' and can take any amount of
write without consuming any real space.
---
test/shell/lvconvert-mirror.sh | 129 +++++++++++++++++++++-------------------
1 files changed, 68 insertions(+), 61 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index 4e18212..a45e6e7 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2010-2018 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
@@ -17,7 +17,7 @@ export LVM_TEST_LVMETAD_DEBUG_OPTS=${LVM_TEST_LVMETAD_DEBUG_OPTS-}
. lib/inittest
-aux prepare_pvs 5 20
+aux prepare_pvs 5 100
get_devs
# proper DEVRANGE needs to be set according to extent size
@@ -78,56 +78,6 @@ lvcreate -aey -l2 -n $lv1 $vg "$dev1"
not lvconvert -m+1 --mirrorlog core $vg/$lv1 "$dev1"
lvremove -ff $vg
-# Start w/ 3-way mirror
-# Test pulling primary image before mirror in-sync (should fail)
-# Test pulling primary image after mirror in-sync (should work)
-# Test that the correct devices remain in the mirror
-offset=$(get first_extent_sector "$dev2")
-offset=$(( offset + 2 ))
-# put 1 single slowing delayed sector
-# update in case mirror ever gets faster and allows parallel read
-aux delay_dev "$dev2" 0 10 ${offset}:1
-
-lvcreate -aey -l10 -Zn -Wn --type mirror --regionsize 16k -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE"
-lvs -a -o+seg_pe_ranges $vg
-not lvconvert -m-1 $vg/$lv1 "$dev1"
-lvconvert $vg/$lv1 # wait
-lvs -a $vg
-aux enable_dev "$dev2"
-lvconvert $vg/$lv1 # wait
-lvconvert -m2 $vg/$lv1 "$dev1" "$dev2" "$dev4" "$dev3:0" # If the above "should" failed...
-
-aux wait_for_sync $vg $lv1
-lvconvert -m-1 $vg/$lv1 "$dev1"
-check mirror_images_on $vg $lv1 "$dev2" "$dev4"
-lvconvert -m-1 $vg/$lv1 "$dev2"
-check linear $vg $lv1
-check lv_on $vg $lv1 "$dev4"
-lvremove -ff $vg
-
-# FIXME: lots of unneeded extents here for log - it needs to be at least region_size in size
-# No parallel lvconverts on a single LV please
-
-lvcreate -aey -Zn -Wn -l8 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0-8"
-check mirror $vg $lv1
-check mirror_legs $vg $lv1 2
-
-offset=$(get first_extent_sector "$dev4")
-offset=$(( offset + 2 ))
-aux delay_dev "$dev4" 0 2000 ${offset}:
-LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
-
-# Next convert should fail b/c we can't have 2 at once
-not lvconvert -m+1 $vg/$lv1 "$dev5"
-aux enable_dev "$dev4"
-lvconvert $vg/$lv1 # wait
-lvconvert -m2 $vg/$lv1 # In case the above "should" actually failed
-
-check mirror $vg $lv1 "$dev3"
-check mirror_no_temporaries $vg $lv1
-check mirror_legs $vg $lv1 3
-lvremove -ff $vg
-
# add 1 mirror to core log mirror, but
# implicitly keep log as 'core'
lvcreate -aey -l2 --type mirror -m1 --mirrorlog core -n $lv1 $vg "$dev1" "$dev2"
@@ -240,13 +190,6 @@ lvremove -ff $vg
# ---------------------------------------------------------------------
-# "rhbz440405: lvconvert -m0 incorrectly fails if all PEs allocated"
-lvcreate -aey -l "$(get pv_field "$dev1" pe_count)" --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
-aux wait_for_sync $vg $lv1
-lvconvert -m0 $vg/$lv1 "$dev1"
-check linear $vg $lv1
-lvremove -ff $vg
-
# "rhbz264241: lvm mirror doesn't lose it's "M" --nosync attribute
# after being down and the up converted"
lvcreate -aey -l2 --type mirror -m1 -n $lv1 --nosync $vg
@@ -300,6 +243,7 @@ lvcreate -aey -l15 -n $lv1 $vg
not lvconvert --type mirror -m1 --corelog --stripes 2 $vg/$lv1
lvremove -ff $vg
+
# Linear to mirror with mirrored log using --alloc anywhere
lvcreate -aey -l2 -n $lv1 $vg "$dev1"
if test -e LOCAL_CLVMD; then
@@ -311,9 +255,10 @@ check mirror $vg $lv1
fi
lvremove -ff $vg
-# FIXME - cases which needs to be fixed to work in cluster
-test -e LOCAL_CLVMD && exit 0
+if test -e LOCAL_CLVMD; then
+: # FIXME - cases which needs to be fixed to work in cluster
+else
# Should not be able to add images to --nosync mirror
# but should be able to after 'lvchange --resync'
lvcreate -aey --type mirror -m 1 -l1 -n $lv1 $vg --nosync
@@ -359,5 +304,67 @@ lvcreate -l2 -n $lv1 $vg
lvconvert --type mirror -i1 -m1 $vg/$lv1 | tee out
grep -e "$vg/$lv1: Converted:" out || die "Missing sync info in foreground mode"
lvremove -ff $vg
+fi
+
+
+#########################################################################
+# Start w/ 3-way mirror
+# Test that the correct devices remain in the mirror
+# Make $dev2 & $dev4 zero backend device so large mirrors can be user
+# without consuming any real space. Clearly such mirrors can't be read back
+# but tests here are validating possibilies of those conversions
+#
+# Test pulling primary image before mirror in-sync (should fail)
+# Test pulling primary image after mirror in-sync (should work)
+#
+aux zero_dev "$dev2" $(get first_extent_sector "$dev2"):
+aux zero_dev "$dev4" $(get first_extent_sector "$dev4"):
+
+# Use large enough mirror that takes time to sychronize with small regionsize
+lvcreate -aey -L80 -Zn -Wn --type mirror --regionsize 16k -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE"
+not lvconvert -m-1 $vg/$lv1 "$dev1" 2>&1 | tee out
+grep "not in-sync" out
+
+lvconvert $vg/$lv1 # wait
+
+lvconvert -m-1 $vg/$lv1 "$dev1"
+check mirror_images_on $vg $lv1 "$dev2" "$dev4"
+lvconvert -m-1 $vg/$lv1 "$dev2"
+check linear $vg $lv1
+check lv_on $vg $lv1 "$dev4"
+lvremove -ff $vg
+
+# No parallel lvconverts on a single LV please
+# Use big enough mirror size and small regionsize to run on all test machines succesfully
+lvcreate -aey -Zn -Wn -L80 --type mirror --regionsize 16k -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0-8"
+check mirror $vg $lv1
+check mirror_legs $vg $lv1 2
+
+LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4"
+# ATM upconversion should be running
+
+# Next convert should fail b/c we can't have 2 at once
+not lvconvert -m+1 $vg/$lv1 "$dev5" 2>&1 | tee out
+grep "is already being converted" out
+
+lvconvert $vg/$lv1 # wait
+check mirror $vg $lv1 "$dev3"
+check mirror_no_temporaries $vg $lv1
+check mirror_legs $vg $lv1 3
+lvremove -ff $vg
+
+lvs -a $vg
+dmsetup table
+losetup -a
+ls -lRa $PWD
+
+# "rhbz440405: lvconvert -m0 incorrectly fails if all PEs allocated"
+lvcreate -aey -l "$(get pv_field "$dev1" pe_count)" --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE"
+lvs -a -o+seg_pe_ranges $vg
+aux wait_for_sync $vg $lv1
+lvconvert -m0 $vg/$lv1 "$dev1"
+check linear $vg $lv1
+lvremove -ff $vg
+
vgremove -ff $vg
5 years, 12 months
master - debug: more explanatory error message
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c492fbb51ce783ca32e...
Commit: c492fbb51ce783ca32efd7ed8414d809daaf4ca5
Parent: 66f4f8c27f6520edc79bafe4aa829d75b3d5e854
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 23 22:11:38 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
debug: more explanatory error message
---
lib/metadata/lv_manip.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 160943f..7f9cf0b 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3805,7 +3805,7 @@ int lv_add_mirror_lvs(struct logical_volume *lv,
return_0;
if (region_size && region_size != seg->region_size) {
- log_error("Conflicting region_size.");
+ log_error("Conflicting region_size %u != %u.", region_size, seg->region_size);
return 0;
}
5 years, 12 months
master - lvconvert: preserve regionsize from existing mirror
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=66f4f8c27f6520edc79...
Commit: 66f4f8c27f6520edc79bafe4aa829d75b3d5e854
Parent: ae274617770aa44263619151ef24393cb8a16a79
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 23 22:13:03 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
lvconvert: preserve regionsize from existing mirror
When adding leg to existing mirror - preserve its regionsize.
---
tools/lvconvert.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 44fdd16..abdcf2c 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -758,6 +758,13 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
if (*old_mimage_count != *new_mimage_count)
log_verbose("Adjusting mirror image count of %s", lv->name);
+ /* If region size is not given by user - use value from mirror */
+ if (lv_is_mirrored(lv) && !lp->region_size_supplied) {
+ lp->region_size = first_seg(lv)->region_size;
+ log_debug("Copying region size %s from existing mirror.",
+ display_size(lv->vg->cmd, lp->region_size));
+ }
+
/*
* Adjust log type
*
5 years, 12 months
master - lvchange: update mirror table when changing monitoring
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ae274617770aa442636...
Commit: ae274617770aa44263619151ef24393cb8a16a79
Parent: fcdac700f9aac079761ad302e06413a5eb2178b9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 23 21:28:35 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
lvchange: update mirror table when changing monitoring
Since for non-monitored mirrors we let mirror running without
error handling - when monitoring changes for mirror, updated
table (refresh) is needed.
---
tools/lvchange.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0aac5ac..e1be4cb 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1603,6 +1603,10 @@ static int _lvchange_monitor_poll_single(struct cmd_context *cmd,
struct logical_volume *lv,
struct processing_handle *handle)
{
+ /* Mirror is using different table line when un/monitored */
+ if (lv_is_mirror(lv) && !lv_refresh(cmd, lv))
+ return_ECMD_FAILED;
+
if (arg_is_set(cmd, monitor_ARG) &&
!_lvchange_monitoring(cmd, lv))
return_ECMD_FAILED;
5 years, 12 months
master - gcc: remove duplicate typedef
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fcdac700f9aac079761...
Commit: fcdac700f9aac079761ad302e06413a5eb2178b9
Parent: 1409c4a1c20319845171b91edb6310e25ae81792
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Apr 23 22:28:47 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 23 22:42:18 2018 +0200
gcc: remove duplicate typedef
---
lib/device/bcache.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/lib/device/bcache.h b/lib/device/bcache.h
index 999223a..4ce137a 100644
--- a/lib/device/bcache.h
+++ b/lib/device/bcache.h
@@ -97,8 +97,6 @@ enum bcache_get_flags {
GF_DIRTY = (1 << 1)
};
-typedef uint64_t block_address;
-
unsigned bcache_nr_cache_blocks(struct bcache *cache);
unsigned bcache_max_prefetches(struct bcache *cache);
5 years, 12 months
master - clvm: rescan when VG or PV not found
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1409c4a1c2031984517...
Commit: 1409c4a1c20319845171b91edb6310e25ae81792
Parent: c42a18d372f314aa51d9d7877342f1d78fd68973
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Apr 20 16:09:49 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Apr 20 16:09:49 2018 -0500
clvm: rescan when VG or PV not found
Rescan devices to update lvmcache content when
clvmd vg_read doesn't find a VG or PV.
---
lib/metadata/metadata.c | 28 ++++++++++++++++++++++++----
1 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 685c589..2df9abe 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4585,6 +4585,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if (!(vgname = lvmcache_vgname_from_vgid(cmd->mem, vgid))) {
log_debug_metadata("Reading VG by vgid %.8s no VG name found, retrying.", vgid);
lvmcache_destroy(cmd, 0, 0);
+ label_scan_destroy(cmd);
lvmcache_label_scan(cmd);
}
@@ -4597,14 +4598,33 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
label_scan_setup_bcache();
- if ((vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted))) {
- /* Does it matter if consistent is 0 or 1? */
- label_scan_destroy(cmd);
- return vg;
+ if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted))) {
+ log_error("Rescan devices to look for missing VG.");
+ goto scan;
+ }
+
+ if (vg_missing_pv_count(vg)) {
+ log_error("Rescan devices to look for missing PVs.");
+ release_vg(vg);
+ goto scan;
}
+ label_scan_destroy(cmd); /* drop bcache to close devs, keep lvmcache */
+ return vg;
+
+ scan:
+ lvmcache_destroy(cmd, 0, 0);
label_scan_destroy(cmd);
+ lvmcache_label_scan(cmd);
+
+ if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted)))
+ goto fail;
+
+ label_scan_destroy(cmd); /* drop bcache to close devs, keep lvmcache */
+ return vg;
+ fail:
+ label_scan_destroy(cmd); /* drop bache to close devs, keep lvmcache */
log_debug_metadata("Reading VG by vgid %.8s not found.", vgid);
return NULL;
}
5 years, 12 months