master - tests: stacked snapshot merge
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=43dfc2011c8955...
Commit: 43dfc2011c8955550e9e7b2fe0de78b452921326
Parent: a67adbfe2ea99ca5ae3e9e0712f3e4499e4480e0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 27 15:21:38 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
tests: stacked snapshot merge
---
test/shell/snapshot-merge-stack.sh | 85 ++++++++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-merge-stack.sh b/test/shell/snapshot-merge-stack.sh
new file mode 100644
index 0000000..6ed9c95
--- /dev/null
+++ b/test/shell/snapshot-merge-stack.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+# Copyright (C) 2016 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Exercise snapshot merge also when stacked
+
+SKIP_WITH_LVMLOCKD=1
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+which mkfs.ext3 || skip
+
+aux target_at_least dm-snapshot-merge 1 0 0 || skip
+
+aux prepare_vg 2 100
+
+snap_and_merge() {
+ lvcreate -s -n $lv2 -L20 $vg/$lv1 "$dev2"
+ #dd if=/dev/zero of="$DM_DEV_DIR/$vg/$lv1" bs=1M count=10 conv=fdatasync
+ mkfs.ext3 "$DM_DEV_DIR/$vg/$lv2"
+ sync
+ lvs -a $vg
+
+ # keep device open to prevent instant merge
+ sleep 20 < "$DM_DEV_DIR/$vg/$lv1" &
+ SLEEP_PID=$!
+
+ # initiate background merge
+ lvconvert -b --merge $vg/$lv2
+
+ lvs -a -o+lv_merging,lv_merge_failed $vg
+ kill $SLEEP_PID
+
+ aux delay_dev "$dev1" 0 200 $(get first_extent_sector "$dev1"):
+ lvchange --refresh $vg/$lv1
+ dmsetup table
+ lvs -a -o+lv_merging,lv_merge_failed $vg
+ sleep 1
+ check lv_attr_bit state $vg/$lv1 "a"
+ check lv_attr_bit state $vg/$lv2 "a"
+ aux error_dev "$dev2" $(get first_extent_sector "$dev2"):
+ # delay to let snapshot merge 'discover' failing COW device
+ sleep 1
+ sync
+ dmsetup status
+ lvs -a -o+lv_merging,lv_merge_failed $vg
+ check lv_attr_bit state $vg/$lv1 "m"
+ check lv_attr_bit state $vg/$lv2 "m"
+
+ # device OK and running in full speed
+ aux enable_dev "$dev1" "$dev2"
+
+ # reactivate so merge can finish
+ lvchange -an $vg
+ lvchange -ay $vg
+ sleep 1
+ lvs -a -o+lv_merging,lv_merge_failed $vg
+ check lv_not_exists $vg $lv2
+ fsck -n "$DM_DEV_DIR/$vg/$lv1"
+
+ lvremove -f $vg
+}
+
+
+# First check merge on plain linear LV
+lvcreate -aey -L50 -n $lv1 $vg "$dev1"
+snap_and_merge
+
+# When available check merge of old snapshot with Thin LV being origin
+if aux have_thin 1 0 0 ; then
+ lvcreate -T -L10 -V50 -n $lv1 $vg/pool "$dev1"
+ snap_and_merge
+fi
+
+# TODO snapshot merge with Mirror, Raid, Cache...
+
+vgremove -f $vg
7 years, 6 months
master - tests: check cache_mode change on cachepool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a67adbfe2ea99c...
Commit: a67adbfe2ea99ca5ae3e9e0712f3e4499e4480e0
Parent: 090ecaabed9df1ead8781c6d504e1fe38ebcf7a4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:24:58 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
tests: check cache_mode change on cachepool
---
test/shell/lvchange-cache-mode.sh | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvchange-cache-mode.sh b/test/shell/lvchange-cache-mode.sh
index 8a056d6..239960c 100644
--- a/test/shell/lvchange-cache-mode.sh
+++ b/test/shell/lvchange-cache-mode.sh
@@ -58,7 +58,13 @@ vgcfgbackup -f /tmp/ooo $vg
#dmsetup resume $vg-$lv1
#dmsetup load --table "0 28672 cache 253:4 253:3 253:5 128 1 passthrough smq 2 migration_threshold 204800" $vg-$lv1
+#dmsetup status $vg-$lv1
+#dmsetup load --table "0 28672 cache 253:4 253:3 253:5 128 1 writethrough smq 2 migration_threshold 204800" $vg-$lv1
#dmsetup resume $vg-$lv1
+#dmsetup status $vg-$lv1
+#dmsetup table $vg-$lv1
+#dmsetup ls --tree
+#exit
check lv_field $vg/$lv1 cache_mode "writeback"
lvchange --cachemode passthrough $vg/$lv1
@@ -68,4 +74,18 @@ check lv_field $vg/$lv1 cache_mode "writethrough"
lvchange --cachemode writeback $vg/$lv1
check lv_field $vg/$lv1 cache_mode "writeback"
+lvconvert --splitcache $vg/$lv1
+
+lvs -a $vg
+
+check lv_field $vg/cpool cache_mode "writeback"
+lvchange --cachemode passthrough $vg/cpool
+check lv_field $vg/cpool cache_mode "passthrough"
+lvchange --cachemode writethrough $vg/cpool
+check lv_field $vg/cpool cache_mode "writethrough"
+lvchange --cachemode writeback $vg/cpool
+check lv_field $vg/cpool cache_mode "writeback"
+
+lvs -a $vg
+
vgremove -f $vg
7 years, 6 months
master - debug: use display_lvname
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=090ecaabed9df1...
Commit: 090ecaabed9df1ead8781c6d504e1fe38ebcf7a4
Parent: 04003cf1ff1c4d00c0d155de6387cdd83478f812
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 20 11:28:23 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
debug: use display_lvname
---
lib/metadata/cache_manip.c | 5 ++++-
lib/metadata/lv_manip.c | 34 +++++++++++++++++-----------------
2 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 4d84fe1..275696e 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -340,6 +340,7 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
for (;;) {
if (!lv_cache_status(cache_lv, &status))
return_0;
+
if (status->cache->fail) {
dm_pool_destroy(status->mem);
log_warn("WARNING: Skippping flush for failed cache %s.",
@@ -422,7 +423,8 @@ int lv_cache_remove(struct logical_volume *cache_lv)
if (!lv_is_active_locally(cache_lv)) {
/* Give up any remote locks */
if (!deactivate_lv(cache_lv->vg->cmd, cache_lv)) {
- log_error("Cannot deactivate remotely active cache lv.");
+ log_error("Cannot deactivate remotely active cache volume %s.",
+ display_lvname(cache_lv));
return 0;
}
@@ -497,6 +499,7 @@ int lv_cache_remove(struct logical_volume *cache_lv)
if (!(cache_seg->areas = dm_pool_zalloc(cache_lv->vg->vgmem, sizeof(*cache_seg->areas))))
return_0;
+
if (!set_lv_segment_area_lv(cache_seg, 0, cache_lv, 0, 0))
return_0;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fdf0c86..b31676d 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5771,39 +5771,39 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return_0;
if (lv_is_origin(lv)) {
- log_error("Can't remove logical volume \"%s\" under snapshot",
- lv->name);
+ log_error("Can't remove logical volume %s under snapshot.",
+ display_lvname(lv));
return 0;
}
if (lv_is_external_origin(lv)) {
- log_error("Can't remove external origin logical volume \"%s\".",
- lv->name);
+ log_error("Can't remove external origin logical volume %s.",
+ display_lvname(lv));
return 0;
}
if (lv_is_mirror_image(lv)) {
- log_error("Can't remove logical volume %s used by a mirror",
- lv->name);
+ log_error("Can't remove logical volume %s used by a mirror.",
+ display_lvname(lv));
return 0;
}
if (lv_is_mirror_log(lv)) {
- log_error("Can't remove logical volume %s used as mirror log",
- lv->name);
+ log_error("Can't remove logical volume %s used as mirror log.",
+ display_lvname(lv));
return 0;
}
if (lv_is_raid_metadata(lv) || lv_is_raid_image(lv)) {
- log_error("Can't remove logical volume %s used as RAID device",
- lv->name);
+ log_error("Can't remove logical volume %s used as RAID device.",
+ display_lvname(lv));
return 0;
}
if (lv_is_thin_pool_data(lv) || lv_is_thin_pool_metadata(lv) ||
lv_is_cache_pool_data(lv) || lv_is_cache_pool_metadata(lv)) {
log_error("Can't remove logical volume %s used by a pool.",
- lv->name);
+ display_lvname(lv));
return 0;
} else if (lv_is_thin_volume(lv)) {
if (!(pool_lv = first_seg(lv)->pool_lv)) {
@@ -5815,7 +5815,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
}
if (lv_is_locked(lv)) {
- log_error("Can't remove locked LV %s", lv->name);
+ log_error("Can't remove locked logical volume %s.", display_lvname(lv));
return 0;
}
@@ -5838,8 +5838,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
"%slogical volume %s? [y/n]: ",
ask_discard ? " and DISCARD" : "",
vg_is_clustered(vg) ? "clustered " : "",
- lv->name) == 'n') {
- log_error("Logical volume %s not removed", lv->name);
+ display_lvname(lv)) == 'n') {
+ log_error("Logical volume %s not removed.", display_lvname(lv));
return 0;
} else {
ask_discard = 0;
@@ -5850,8 +5850,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (!lv_is_historical(lv) && (force == PROMPT) && ask_discard &&
yes_no_prompt("Do you really want to remove and DISCARD "
"logical volume %s? [y/n]: ",
- lv->name) == 'n') {
- log_error("Logical volume %s not removed", lv->name);
+ display_lvname(lv)) == 'n') {
+ log_error("Logical volume %s not removed.", display_lvname(lv));
return 0;
}
@@ -5907,7 +5907,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (!(lv->vg->fid->fmt->features & FMT_MDAS))
format1_origin = origin_from_cow(lv);
- log_verbose("Removing snapshot %s", lv->name);
+ log_verbose("Removing snapshot volume %s.", display_lvname(lv));
/* vg_remove_snapshot() will preload origin/former snapshots */
if (!vg_remove_snapshot(lv))
return_0;
7 years, 6 months
master - cache: add log_error on error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=04003cf1ff1c4d...
Commit: 04003cf1ff1c4d00c0d155de6387cdd83478f812
Parent: ecfb90de7405e55d79239d70838a31c66f2e926a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:27:12 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
cache: add log_error on error path
Validate and report error when lv_cache_status is called
for inactive LV, or pending delete or unused cache_pool.
---
lib/activate/activate.c | 22 ++++++++++++++++------
tools/lvchange.c | 3 ++-
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 2b22eec..1260b10 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1131,19 +1131,29 @@ int lv_cache_status(const struct logical_volume *cache_lv,
struct dev_manager *dm;
struct lv_segment *cache_seg;
- if (lv_is_cache_pool(cache_lv) && !dm_list_empty(&cache_lv->segs_using_this_lv)) {
- if (!(cache_seg = get_only_segment_using_this_lv(cache_lv)))
- return_0;
+ if (lv_is_cache_pool(cache_lv)) {
+ if (dm_list_empty(&cache_lv->segs_using_this_lv) ||
+ !(cache_seg = get_only_segment_using_this_lv(cache_lv))) {
+ log_error(INTERNAL_ERROR "Cannot check status for unused cache pool %s.",
+ display_lvname(cache_lv));
+ return 0;
+ }
cache_lv = cache_seg->lv;
}
- if (lv_is_pending_delete(cache_lv))
+ if (lv_is_pending_delete(cache_lv)) {
+ log_error("Cannot check status for deleted cache volume %s.",
+ display_lvname(cache_lv));
return 0;
+ }
- if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0))
+ if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0)) {
+ log_error("Cannot check status for locally inactive cache volume %s.",
+ display_lvname(cache_lv));
return 0;
+ }
- log_debug_activation("Checking cache status for LV %s.",
+ log_debug_activation("Checking status for cache volume %s.",
display_lvname(cache_lv));
if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1)))
diff --git a/tools/lvchange.c b/tools/lvchange.c
index ad27786..16ede56 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -702,7 +702,8 @@ static int _lvchange_cache(struct cmd_context *cmd, struct logical_volume *lv)
goto_out;
if ((mode != CACHE_MODE_UNDEFINED) &&
- (mode != pool_seg->cache_mode)) {
+ (mode != pool_seg->cache_mode) &&
+ lv_is_cache(lv)) {
if (!lv_cache_wait_for_clean(lv, &is_clean))
return_0;
if (!is_clean) {
7 years, 6 months
master - report: convert more options to use single status
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ecfb90de7405e5...
Commit: ecfb90de7405e55d79239d70838a31c66f2e926a
Parent: 80603ad49aeec70c9a3f391236668f212342d10a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:26:10 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
report: convert more options to use single status
Convert fields into using a single status ioctl call per LV.
This is a bit tricky since when there are more complicated
stacks, at this moment its undefined which values should be shown.
It's clear we need to cache more then single ioctl per LV,
but also we need to define more explicitely relation between
reported values for snapshots.
This patch is not a final state, rather a transitional step.
It should not be giving more 'worst' values then previous
many-ioctl-calls-per-lv solution.
---
WHATS_NEW | 1 +
lib/report/columns.h | 16 +++++-----
lib/report/report.c | 82 +++++++++++++------------------------------------
3 files changed, 31 insertions(+), 68 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9f270c6..7eac3a7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ When reporting Data%,Snap%,Meta%,Cpy%Sync use single ioctl per LV.
Add lvseg_percent_with_info_and_seg_status() for percent retrieval.
Enhance internal seg_status handling to understand snapshots better.
When refresh failed in suspend, call resume upon error path.
diff --git a/lib/report/columns.h b/lib/report/columns.h
index a17b3eb..212f9ed 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -62,18 +62,18 @@ FIELD(LVS, lv, SIZ, "Rahead", lvid, 0, lvreadahead, lv_read_ahead, "Read ahead s
FIELD(LVS, lv, SIZ, "LSize", size, 0, size64, lv_size, "Size of LV in current units.", 0)
FIELD(LVS, lv, SIZ, "MSize", lvid, 0, lvmetadatasize, lv_metadata_size, "For thin and cache pools, the size of the LV that holds the metadata.", 0)
FIELD(LVS, lv, NUM, "#Seg", lvid, 0, lvsegcount, seg_count, "Number of segments in LV.", 0)
-FIELD(LVS, lv, STR, "Origin", lvid, 0, origin, origin, "For snapshots, the origin device of this LV.", 0)
-FIELD(LVS, lv, STR, "Origin UUID", lvid, 38, originuuid, origin_uuid, "For snapshots, the UUID of origin device of this LV.", 0)
+FIELD(LVS, lv, STR, "Origin", lvid, 0, origin, origin, "For snapshots and thins, the origin device of this LV.", 0)
+FIELD(LVS, lv, STR, "Origin UUID", lvid, 38, originuuid, origin_uuid, "For snapshots and thins, the UUID of origin device of this LV.", 0)
FIELD(LVS, lv, SIZ, "OSize", lvid, 0, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0)
FIELD(LVS, lv, STR_LIST, "Ancestors", lvid, 0, lvancestors, lv_ancestors, "LV ancestors ignoring any stored history of the ancestry chain.", 0)
FIELD(LVS, lv, STR_LIST, "FAncestors", lvid, 0, lvfullancestors, lv_full_ancestors, "LV ancestors including stored history of the ancestry chain.", 0)
FIELD(LVS, lv, STR_LIST, "Descendants", lvid, 0, lvdescendants, lv_descendants, "LV descendants ignoring any stored history of the ancestry chain.", 0)
FIELD(LVS, lv, STR_LIST, "FDescendants", lvid, 0, lvfulldescendants, lv_full_descendants, "LV descendants including stored history of the ancestry chain.", 0)
-FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0)
-FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
-FIELD(LVS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0)
-FIELD(LVS, lv, PCT, "Cpy%Sync", lvid, 0, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
-FIELD(LVS, lv, PCT, "Cpy%Sync", lvid, 0, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
+FIELD(LVSSTATUS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot, cache and thin pools and volumes, the percentage full if LV is active.", 0)
+FIELD(LVSSTATUS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0)
+FIELD(LVSSTATUS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For cache and thin pools, the percentage of metadata full if LV is active.", 0)
+FIELD(LVSSTATUS, lv, PCT, "Cpy%Sync", lvid, 0, copypercent, copy_percent, "For Cache, RAID, mirrors and pvmove, current percentage in-sync.", 0)
+FIELD(LVSSTATUS, lv, PCT, "Cpy%Sync", lvid, 0, copypercent, sync_percent, "For Cache, RAID, mirrors and pvmove, current percentage in-sync.", 0)
FIELD(LVS, lv, NUM, "Mismatches", lvid, 0, raidmismatchcount, raid_mismatch_count, "For RAID, number of mismatches found or repaired.", 0)
FIELD(LVS, lv, STR, "SyncAction", lvid, 0, raidsyncaction, raid_sync_action, "For RAID, the current synchronization action being performed.", 0)
FIELD(LVS, lv, NUM, "WBehind", lvid, 0, raidwritebehind, raid_write_behind, "For RAID1, the number of outstanding writes allowed to writemostly devices.", 0)
@@ -120,7 +120,7 @@ FIELD(LVSSTATUS, lv, STR_LIST, "KCacheSettings", lvid, 18, kernel_cache_settings
FIELD(LVSSTATUS, lv, STR, "KCachePolicy", lvid, 18, kernel_cache_policy, kernel_cache_policy, "Cache policy used in kernel.", 0)
FIELD(LVSSTATUS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
FIELD(LVSSTATUS, lv, STR, "KDiscards", lvid, 0, kdiscards, kernel_discards, "For thin pools, how discards are handled in kernel.", 0)
-FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools, whether metadata check is needed.", 0)
+FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools and cache volumes, whether metadata check is needed.", 0)
FIELD(LABEL, label, STR, "Fmt", type, 0, pvfmt, pv_fmt, "Type of metadata.", 0)
FIELD(LABEL, label, STR, "PV UUID", type, 38, pvuuid, pv_uuid, "Unique identifier.", 0)
diff --git a/lib/report/report.c b/lib/report/report.c
index fd084f1..56c6f5b 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -2812,28 +2812,11 @@ static int _snpercent_disp(struct dm_report *rh, struct dm_pool *mem __attribute
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- const struct logical_volume *lv = (const struct logical_volume *) data;
- dm_percent_t snap_percent;
-
- if ((lv_is_cow(lv) || lv_is_merging_origin(lv)) &&
- lv_snapshot_percent(lv, &snap_percent)) {
- if ((snap_percent != DM_PERCENT_INVALID) &&
- (snap_percent != LVM_PERCENT_MERGE_FAILED))
- return dm_report_field_percent(rh, field, &snap_percent);
-
- if (!lv_is_merging_origin(lv)) {
- snap_percent = DM_PERCENT_100;
- return dm_report_field_percent(rh, field, &snap_percent);
- }
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- /*
- * on activate merge that hasn't started yet would
- * otherwise display incorrect snap% in origin
- */
- }
+ dm_percent_t percent = lvseg_percent_with_info_and_seg_status(lvdm, PERCENT_GET_DATA);
- snap_percent = DM_PERCENT_INVALID;
- return dm_report_field_percent(rh, field, &snap_percent);
+ return dm_report_field_percent(rh, field, &percent);
}
static int _copypercent_disp(struct dm_report *rh,
@@ -2841,20 +2824,20 @@ static int _copypercent_disp(struct dm_report *rh,
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- const struct logical_volume *lv = (const struct logical_volume *) data;
- struct lv_status_cache *status;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
+
+ const struct logical_volume *lv = lvdm->lv;
dm_percent_t percent = DM_PERCENT_INVALID;
- if (((lv_is_raid(lv) && !seg_is_any_raid0(first_seg(lv)) && lv_raid_percent(lv, &percent)) ||
- (lv_is_mirror(lv) && lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL))) &&
- (percent != DM_PERCENT_INVALID)) {
+ /* TODO: just cache passes through lvseg_percent... */
+ if (lv_is_cache(lv) || lv_is_used_cache_pool(lv))
+ percent = lvseg_percent_with_info_and_seg_status(lvdm, PERCENT_GET_DIRTY);
+ else if (((lv_is_raid(lv) && !seg_is_any_raid0(first_seg(lv)) &&
+ lv_raid_percent(lv, &percent)) ||
+ (lv_is_mirror(lv) &&
+ lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL))) &&
+ (percent != DM_PERCENT_INVALID))
percent = copy_percent(lv);
- } else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
- if (lv_cache_status(lv, &status)) {
- percent = status->dirty_usage;
- dm_pool_destroy(status->mem);
- }
- }
return dm_report_field_percent(rh, field, &percent);
}
@@ -2937,22 +2920,9 @@ static int _datapercent_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct logical_volume *lv = (const struct logical_volume *) data;
- dm_percent_t percent = DM_PERCENT_INVALID;
- struct lv_status_cache *status;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
- if (lv_is_cow(lv))
- return _snpercent_disp(rh, mem, field, data, private);
- else if (lv_is_thin_pool(lv))
- (void) lv_thin_pool_percent(lv, 0, &percent);
- else if (lv_is_thin_volume(lv))
- (void) lv_thin_percent(lv, 0, &percent);
- else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
- if (lv_cache_status(lv, &status)) {
- percent = status->data_usage;
- dm_pool_destroy(status->mem);
- }
- }
+ dm_percent_t percent = lvseg_percent_with_info_and_seg_status(lvdm, PERCENT_GET_DATA);
return dm_report_field_percent(rh, field, &percent);
}
@@ -2962,20 +2932,12 @@ static int _metadatapercent_disp(struct dm_report *rh,
struct dm_report_field *field,
const void *data, void *private)
{
- const struct logical_volume *lv = (const struct logical_volume *) data;
+ const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
dm_percent_t percent = DM_PERCENT_INVALID;
- struct lv_status_cache *status;
- if (lv_is_thin_pool(lv))
- (void) lv_thin_pool_percent(lv, 1, &percent);
- else if (lv_is_thin_volume(lv))
- (void) lv_thin_percent(lv, 1, &percent);
- else if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) {
- if (lv_cache_status(lv, &status)) {
- percent = status->metadata_usage;
- dm_pool_destroy(status->mem);
- }
- }
+ if (lv_is_thin_pool(lvdm->lv) ||
+ lv_is_used_cache_pool(lvdm->lv))
+ percent = lvseg_percent_with_info_and_seg_status(lvdm, PERCENT_GET_METADATA);
return dm_report_field_percent(rh, field, &percent);
}
7 years, 6 months
master - snapshot: use seg_status for attrs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=80603ad49aeec7...
Commit: 80603ad49aeec70c9a3f391236668f212342d10a
Parent: 92eba53a797a011d1ce6fbd7bef88eab41af2072
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:19:59 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
snapshot: use seg_status for attrs
---
lib/metadata/lv.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 92ea3a9..d67caa2 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -1111,7 +1111,6 @@ int lv_raid_healthy(const struct logical_volume *lv)
char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_with_info_and_seg_status *lvdm)
{
- dm_percent_t snap_percent;
const struct logical_volume *lv = lvdm->lv;
struct lv_segment *seg;
char *repstr;
@@ -1203,19 +1202,18 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
repstr[4] = 'd'; /* Inactive without table */
/* Snapshot dropped? */
- if (lvdm->info.live_table && lv_is_cow(lv)) {
- if (!lv_snapshot_percent(lv, &snap_percent) ||
- snap_percent == DM_PERCENT_INVALID) {
+ if (lvdm->info.live_table &&
+ (lvdm->seg_status.type == SEG_STATUS_SNAPSHOT)) {
+ if (lvdm->seg_status.snapshot->invalid) {
if (lvdm->info.suspended)
repstr[4] = 'S'; /* Susp Inv snapshot */
else
repstr[4] = 'I'; /* Invalid snapshot */
- }
- else if (snap_percent == LVM_PERCENT_MERGE_FAILED) {
+ } else if (lvdm->seg_status.snapshot->merge_failed) {
if (lvdm->info.suspended)
repstr[4] = 'M'; /* Susp snapshot merge failed */
else
- repstr[4] = 'm'; /* snapshot merge failed */
+ repstr[4] = 'm'; /* Snapshot merge failed */
}
}
7 years, 6 months
master - lv: introduce lvseg_percent_with_info_and_seg_status
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=92eba53a797a01...
Commit: 92eba53a797a011d1ce6fbd7bef88eab41af2072
Parent: f7f395667ee5446e9127fe772deb46f3e4f3812e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:18:38 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
lv: introduce lvseg_percent_with_info_and_seg_status
Add function to obtain percentage value for cache lv_seg_status.
This API is rather evolving 'middle' step as the ultimate goal
is segment API fuctionality.
But first we need to be clear at reporting level which values
are needed to be reported for which LVs and segments.
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/metadata/lv.h | 9 ++++++
3 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2265c9b..9f270c6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Add lvseg_percent_with_info_and_seg_status() for percent retrieval.
Enhance internal seg_status handling to understand snapshots better.
When refresh failed in suspend, call resume upon error path.
Support passthrough cache mode when waiting for clean cache.
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 0a531cf..92ea3a9 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -345,6 +345,88 @@ uint64_t lvseg_size(const struct lv_segment *seg)
return (uint64_t) seg->len * seg->lv->vg->extent_size;
}
+dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_and_seg_status *lvdm,
+ percent_get_t type)
+{
+ dm_percent_t p;
+ uint64_t csize;
+ const struct lv_segment *seg;
+ const struct lv_seg_status *s = &lvdm->seg_status;
+
+ /*
+ * TODO:
+ * Later move to segment methods, instead of using single place.
+ * Also handle logic for mirror segments and it total_* summing
+ * Esentially rework _target_percent API for segtype.
+ */
+ switch (s->type) {
+ case SEG_STATUS_CACHE:
+ if (s->cache->fail || s->cache->error)
+ p = DM_PERCENT_INVALID;
+ else {
+ switch (type) {
+ case PERCENT_GET_DIRTY:
+ p = dm_make_percent(s->cache->dirty_blocks,
+ s->cache->used_blocks);
+ break;
+ case PERCENT_GET_METADATA:
+ p = dm_make_percent(s->cache->metadata_used_blocks,
+ s->cache->metadata_total_blocks);
+ break;
+ default:
+ p = dm_make_percent(s->cache->used_blocks,
+ s->cache->total_blocks);
+ }
+ }
+ break;
+ case SEG_STATUS_SNAPSHOT:
+ if (s->snapshot->invalid || s->snapshot->merge_failed)
+ p = DM_PERCENT_INVALID;
+ else if (s->snapshot->has_metadata_sectors &&
+ (s->snapshot->used_sectors == s->snapshot->metadata_sectors))
+ p = DM_PERCENT_0;
+ else
+ p = dm_make_percent(s->snapshot->used_sectors,
+ s->snapshot->total_sectors);
+ break;
+ case SEG_STATUS_THIN_POOL:
+ if (s->thin_pool->fail || s->thin_pool->error)
+ p = DM_PERCENT_INVALID;
+ else if (type == PERCENT_GET_METADATA)
+ p = dm_make_percent(s->thin_pool->used_metadata_blocks,
+ s->thin_pool->total_metadata_blocks);
+ else
+ p = dm_make_percent(s->thin_pool->used_data_blocks,
+ s->thin_pool->total_data_blocks);
+ break;
+ case SEG_STATUS_THIN:
+ if (s->thin->fail || (type != PERCENT_GET_DATA))
+ /* TODO: expose highest mapped sector */
+ p = DM_PERCENT_INVALID;
+ else {
+ seg = first_seg(lvdm->lv);
+ /* Pool allocates whole chunk so round-up to nearest one */
+ csize = first_seg(seg->pool_lv)->chunk_size;
+ csize = ((seg->lv->size + csize - 1) / csize) * csize;
+ if (s->thin->mapped_sectors <= csize)
+ p = dm_make_percent(s->thin->mapped_sectors, csize);
+ else {
+ log_warn("WARNING: Thin volume %s maps %s while the size is only %s.",
+ display_lvname(seg->lv),
+ display_size(lvdm->lv->vg->cmd, s->thin->mapped_sectors),
+ display_size(lvdm->lv->vg->cmd, csize));
+ /* Don't show nonsense numbers like i.e. 1000% full */
+ p = DM_PERCENT_100;
+ }
+ }
+ break;
+ default:
+ p = DM_PERCENT_INVALID;
+ }
+
+ return p;
+}
+
uint32_t lv_kernel_read_ahead(const struct logical_volume *lv)
{
struct lvinfo info;
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 08fc090..9f871d6 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -197,4 +197,13 @@ char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lv_lock_args_dup(struct dm_pool *mem, const struct logical_volume *lv);
char *lvseg_kernel_discards_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_with_info_and_seg_status *lvdm);
char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv, int iso_mode);
+
+typedef enum {
+ PERCENT_GET_DATA = 0,
+ PERCENT_GET_METADATA,
+ PERCENT_GET_DIRTY
+} percent_get_t;
+dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_and_seg_status *lvdm,
+ percent_get_t type);
+
#endif /* _LVM_LV_H */
7 years, 6 months
master - lvstatus: enhance seg_status to handle snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f7f395667ee544...
Commit: f7f395667ee5446e9127fe772deb46f3e4f3812e
Parent: 067c0a23e5c0d41e92551c2d3e40bcaf4aeb1488
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed May 25 16:14:46 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
lvstatus: enhance seg_status to handle snapshot
Add more code to properly store status for snapshot segment
maintaining lvm2 fiction of COW and snapshot internal volumes.
The key issue here is however not though-through reporting
logic - as there is no single answer for whole line state.
It not counting with layer and we may need few more ioctl to
cover all reporting needs depending upon what is actually
needed.
In reality we need to 'cache' more ioctl status queries for
individual LVs and their segments (so they checked at most once).
The other 'hard' topic for conversion is mirror segment handling.
Also we definitelly need to relocate some logic into segment's methods,
yet it might be complex as we have not clear border between targets.
TODO: define more clearly how are reporting fields defined in case
we 'stack' volumes like - cache of stacked thin LV snapshot origin.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 30 +++++++++++++++++++++++++++++-
lib/activate/dev_manager.c | 35 ++++++++++++++++++++++-------------
3 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 48e0109..2265c9b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ Enhance internal seg_status handling to understand snapshots better.
When refresh failed in suspend, call resume upon error path.
Support passthrough cache mode when waiting for clean cache.
Check cache status only for 'in-use' cache pools.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index d5e416d..2b22eec 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -691,8 +691,36 @@ static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv,
use_layer = 1;
}
- if (seg_status)
+ if (seg_status) {
+ /* TODO: for now it's mess with seg_status */
seg_status->seg = seg;
+ if (lv_is_merging_cow(lv)) {
+ if (lv_has_target_type(cmd->mem, origin_from_cow(lv), NULL, TARGET_NAME_SNAPSHOT_MERGE)) {
+ /*
+ * When the snapshot-merge has not yet started, query COW LVs as is.
+ * When merge is in progress, query merging origin LV instead.
+ * COW volume is already mapped as error target in this case.
+ */
+ lv = origin_from_cow(lv);
+ seg_status->seg = first_seg(lv);
+ log_debug_activation("Snapshot merge is in progress, querying status of %s instead.",
+ display_lvname(lv));
+ }
+ } else if (!use_layer && lv_is_origin(lv) && !lv_is_external_origin(lv)) {
+ /*
+ * Query status for 'layered' (-real) device most of the time,
+ * only when snapshot merge started, query its progress.
+ * TODO: single LV may need couple status to be exposed at once....
+ * but this needs more logical background
+ */
+ if (!lv_is_merging_origin(lv) ||
+ !lv_has_target_type(cmd->mem, origin_from_cow(lv), NULL, TARGET_NAME_SNAPSHOT_MERGE))
+ use_layer = 1;
+ } else if (lv_is_cow(lv)) {
+ /* Hadle fictional lvm2 snapshot and query snapshotX volume */
+ seg_status->seg = find_snapshot(lv);
+ }
+ }
if (!dev_manager_info(cmd, lv,
(use_layer) ? lv_layer(lv) : NULL,
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 63cfe9c..51f1a9a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -127,6 +127,7 @@ static int _get_segment_status_from_target_params(const char *target_name,
struct segment_type *segtype;
seg_status->type = SEG_STATUS_UNKNOWN;
+
/*
* TODO: Add support for other segment types too!
* The segment to report status for must be properly
@@ -134,19 +135,27 @@ static int _get_segment_status_from_target_params(const char *target_name,
* linear/striped, old snapshots and raids have proper
* segment selected for status!
*/
- if (strcmp(target_name, TARGET_NAME_CACHE) &&
- strcmp(target_name, TARGET_NAME_THIN_POOL) &&
- strcmp(target_name, TARGET_NAME_THIN))
- return 1;
+ if (!strcmp(target_name, TARGET_NAME_SNAPSHOT_MERGE) &&
+ lv_is_merging_origin(seg_status->seg->lv)) {
+ /* Snapshot merge has started, check snapshot status */
+ if (!(segtype = get_segtype_from_string(seg_status->seg->lv->vg->cmd, TARGET_NAME_SNAPSHOT)))
+ return_0;
+ } else {
+ if (strcmp(target_name, TARGET_NAME_CACHE) &&
+ strcmp(target_name, TARGET_NAME_SNAPSHOT) &&
+ strcmp(target_name, TARGET_NAME_THIN_POOL) &&
+ strcmp(target_name, TARGET_NAME_THIN))
+ return 1; /* TODO: Do not know how to handle yet */
- if (!(segtype = get_segtype_from_string(seg_status->seg->lv->vg->cmd, target_name)))
- return_0;
+ if (!(segtype = get_segtype_from_string(seg_status->seg->lv->vg->cmd, target_name)))
+ return_0;
- if (segtype != seg_status->seg->segtype) {
- log_error(INTERNAL_ERROR "_get_segment_status_from_target_params: "
- "segment type %s found does not match expected segment type %s",
- segtype->name, seg_status->seg->segtype->name);
- return 0;
+ if (segtype != seg_status->seg->segtype) {
+ log_error(INTERNAL_ERROR "_get_segment_status_from_target_params: "
+ "segment type %s found does not match expected segment type %s",
+ segtype->name, seg_status->seg->segtype->name);
+ return 0;
+ }
}
if (segtype_is_cache(segtype)) {
7 years, 6 months
master - refresh: call resume after failing suspend
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=067c0a23e5c0d4...
Commit: 067c0a23e5c0d41e92551c2d3e40bcaf4aeb1488
Parent: 98b41db324a432db5860cb7dbea697a09bc4321e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 20 13:20:54 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
refresh: call resume after failing suspend
lv_refresh_suspend_resume() has escaped with fail ret code
after failing suspend and could have left many volumes in suspend state.
So always unconditionally call resume also when suspend has failed.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 213bc72..48e0109 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.155 -
================================
+ When refresh failed in suspend, call resume upon error path.
Support passthrough cache mode when waiting for clean cache.
Check cache status only for 'in-use' cache pools.
Extend setup_task() to preset flushing for dm_task object.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 625cea6..fdf0c86 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1376,6 +1376,7 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
int lv_refresh_suspend_resume(const struct logical_volume *lv)
{
struct cmd_context *cmd = lv->vg->cmd;
+ int r = 1;
if (!cmd->partial_activation && lv_is_partial(lv)) {
log_error("Refusing refresh of partial LV %s."
@@ -1386,15 +1387,15 @@ int lv_refresh_suspend_resume(const struct logical_volume *lv)
if (!suspend_lv(cmd, lv)) {
log_error("Failed to suspend %s.", display_lvname(lv));
- return 0;
+ r = 0;
}
if (!resume_lv(cmd, lv)) {
log_error("Failed to reactivate %s.", display_lvname(lv));
- return 0;
+ r = 0;
}
- return 1;
+ return r;
}
/*
7 years, 6 months
master - cleanup: drop cmd and constify lv for lv_refresh_suspend_resume()
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=98b41db324a432...
Commit: 98b41db324a432db5860cb7dbea697a09bc4321e
Parent: cb49ceeabaa011f51aa20c1a66c85ecbcb2c36a7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 20 10:55:05 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 27 15:47:24 2016 +0200
cleanup: drop cmd and constify lv for lv_refresh_suspend_resume()
Like with most other lv_manip* functions take just LV arg and get cmd
from embeded pointer when needed.
---
lib/locking/lvmlockd.c | 2 +-
lib/metadata/cache_manip.c | 2 +-
lib/metadata/lv_manip.c | 4 +++-
lib/metadata/metadata-exported.h | 4 ++--
tools/toollib.c | 2 +-
5 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index c55f2b5..d718ac9 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -391,7 +391,7 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
static int _refresh_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg)
{
- if (!lv_refresh_suspend_resume(cmd, vg->sanlock_lv)) {
+ if (!lv_refresh_suspend_resume(vg->sanlock_lv)) {
log_error("Failed to refresh %s.", vg->sanlock_lv->name);
return 0;
}
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 3e8c5c7..4d84fe1 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -379,7 +379,7 @@ int lv_cache_wait_for_clean(struct logical_volume *cache_lv, int *is_clean)
* ATM this is workaround for missing cache sync when cache gets clean
*/
if (1) {
- if (!lv_refresh_suspend_resume(lock_lv->vg->cmd, lock_lv))
+ if (!lv_refresh_suspend_resume(lock_lv))
return_0;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b941979..625cea6 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1373,8 +1373,10 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
return 1;
}
-int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv)
+int lv_refresh_suspend_resume(const struct logical_volume *lv)
{
+ struct cmd_context *cmd = lv->vg->cmd;
+
if (!cmd->partial_activation && lv_is_partial(lv)) {
log_error("Refusing refresh of partial LV %s."
" Use '--activationmode partial' to override.",
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 1a9d5d9..a88ba1e 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -801,7 +801,7 @@ int lv_empty(struct logical_volume *lv);
/* Empty an LV and add error segment */
int replace_lv_with_error_segment(struct logical_volume *lv);
-int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv);
+int lv_refresh_suspend_resume(const struct logical_volume *lv);
/* Entry point for all LV extent allocations */
int lv_extend(struct logical_volume *lv,
diff --git a/tools/toollib.c b/tools/toollib.c
index 12dddc8..2f03a91 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1099,7 +1099,7 @@ int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
display_lvname(lv), display_lvname(snapshot_lv));
}
- if (!lv_refresh_suspend_resume(cmd, lv))
+ if (!lv_refresh_suspend_resume(lv))
return_0;
/*
7 years, 6 months