master - tests: fixed cache target reacts faster
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c5779846307832...
Commit: c57798463078325a7b7b1221d154312a20678e93
Parent: bc5376b151f4a5993c223de51f0218aa95184471
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 31 12:00:20 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:21:40 2016 +0200
tests: fixed cache target reacts faster
After kernel fixed in 4.6 cache target reacts promptly
and switches to Fail-ed state when disk error is detected.
Handle both cases in test...
---
test/shell/lvconvert-repair-cache.sh | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/test/shell/lvconvert-repair-cache.sh b/test/shell/lvconvert-repair-cache.sh
index 60b0b5d..1fdfd3f 100644
--- a/test/shell/lvconvert-repair-cache.sh
+++ b/test/shell/lvconvert-repair-cache.sh
@@ -101,13 +101,15 @@ sync
# Seriously damage cache metadata
aux error_dev "$dev1" 2054:2
-# Here we usually for the 1st. notice needs_check
-check lv_attr_bit state $vg/$lv1 "c"
-
-sleep .1
-
-# And now cache is finaly Failed
-check lv_attr_bit health $vg/$lv1 "F"
+# On fixed kernel we get instant Fail here
+get lv_field $vg/$lv1 lv_attr | tee out
+grep "Cwi-a-C-F-" out || {
+ # while on older unfixed we just notice needs_check
+ grep "Cwi-c-C---" out
+ sleep .1
+ # And now cache is finaly Failed
+ check lv_attr_bit health $vg/$lv1 "F"
+}
check lv_field $vg/$lv1 lv_health_status "failed"
aux disable_dev "$dev1"
7 years, 8 months
master - tests: do not test settings when MQ is emulated by SMQ
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc5376b151f4a5...
Commit: bc5376b151f4a5993c223de51f0218aa95184471
Parent: 5034bb8d180a496fc24cd0ac0d8dde2332d28bc2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 31 11:59:55 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:21:40 2016 +0200
tests: do not test settings when MQ is emulated by SMQ
---
test/shell/lvchange-cache.sh | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvchange-cache.sh b/test/shell/lvchange-cache.sh
index ca7522a..06d2f09 100644
--- a/test/shell/lvchange-cache.sh
+++ b/test/shell/lvchange-cache.sh
@@ -48,7 +48,8 @@ get lv_field $vg/corigin kernel_cache_settings | grep 'migration_threshold=333'
lvchange --cachesettings 'migration_threshold = 233 sequential_threshold = 13' $vg/corigin
get lv_field $vg/corigin kernel_cache_settings | tee out
grep 'migration_threshold=233' out
-grep 'sequential_threshold=13' out
+
+if grep 'sequential_threshold=13' out ; then
lvchange --cachesettings 'migration_threshold = 17' $vg/corigin
get lv_field $vg/corigin kernel_cache_settings | tee out
@@ -79,4 +80,10 @@ grep 'migration_threshold=2048' out
grep 'sequential_threshold=13' out
grep 'random_threshold=4' out
+else
+# When MQ is emulated by SMQ policy it does not hold settings.
+# So just skip testing of param changes when sequential_threshold=0
+grep 'sequential_threshold=0' out
+fi
+
vgremove -f $vg
7 years, 8 months
master - cleanup: use local var to read struct
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5034bb8d180a49...
Commit: 5034bb8d180a496fc24cd0ac0d8dde2332d28bc2
Parent: b10253ab4d932565dc69e5b3b6715177bb593ba8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 30 10:16:09 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:21:40 2016 +0200
cleanup: use local var to read struct
---
lib/activate/dev_manager.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index de07f96..5341b54 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1332,10 +1332,10 @@ int dev_manager_cache_status(struct dev_manager *dm,
* ->target_percent() API is able to transfer only a single value.
* Needs to be able to pass whole structure.
*/
- if (!dm_get_status_cache(dm->mem, params, &((*status)->cache)))
+ if (!dm_get_status_cache(dm->mem, params, &c))
goto_out;
- c = (*status)->cache;
+ (*status)->cache = c;
(*status)->mem = dm->mem; /* User has to destroy this mem pool later */
if (c->fail || c->error) {
(*status)->data_usage =
7 years, 8 months
master - cleanup: use TARGET define
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b10253ab4d9325...
Commit: b10253ab4d932565dc69e5b3b6715177bb593ba8
Parent: 86db143307effaa0f606e301ec6e1a8d8db5b716
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 30 10:15:47 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:21:40 2016 +0200
cleanup: use TARGET define
---
lib/activate/dev_manager.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 40e4086..de07f96 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1438,7 +1438,7 @@ int dev_manager_thin_percent(struct dev_manager *dm,
return_0;
log_debug_activation("Getting device status percentage for %s", name);
- if (!(_percent(dm, name, dlid, "thin", 0,
+ if (!(_percent(dm, name, dlid, TARGET_NAME_THIN, 0,
(mapped) ? NULL : lv, percent, NULL, 1)))
return_0;
7 years, 8 months
master - cleanup: debug message fix
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=86db143307effa...
Commit: 86db143307effaa0f606e301ec6e1a8d8db5b716
Parent: fc7dacaa4c6bf0af4c5a457c098da26d7cc71f9c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Mar 29 15:57:12 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:21:25 2016 +0200
cleanup: debug message fix
Reported-by: Ming-Hung Tsai <mingnus gmail com>
---
lib/activate/activate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 2eb24d4..a3b2379 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1160,7 +1160,7 @@ int lv_thin_pool_transaction_id(const struct logical_volume *lv,
if (!lv_info(lv->vg->cmd, lv, 1, NULL, 0, 0))
return 0;
- log_debug_activation("Checking thin-pool percent for LV %s.",
+ log_debug_activation("Checking thin-pool transaction id for LV %s.",
display_lvname(lv));
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
7 years, 8 months
master - thin: display highest mapped sector
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fc7dacaa4c6bf0...
Commit: fc7dacaa4c6bf0af4c5a457c098da26d7cc71f9c
Parent: 8bbec41bd482175ee61478bef65cc58c7e814abf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 30 11:14:13 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:20:43 2016 +0200
thin: display highest mapped sector
Use meta% to expose highest mapped sector in thinLV.
so showing there 100.00% means thinLV maps latest sector.
Currently using a 'trick' with total_numerator to pass-in
device size when 'seg==NULL'
TODO: Improve device status API per target - current 'percentage'
is not really extensible.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 4 ++++
lib/thin/thin.c | 15 +++++++++------
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 3237e0a..2ad2d69 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.149 -
==================================
+ Report highest mapping for thin volume as Meta%.
Do not flush thin-pool when checking metadata fullness.
Remove spurious error about no value in /sys/dev/block/major:minor/dm/uuid.
Fix device mismatch detection for LV if persistent .cache file is used.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 2696c56..40e4086 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -938,6 +938,10 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (!segtype->ops->target_percent)
continue;
+ /* For thin volume pass device size via 'total_numerator' */
+ if (!seg && segtype_is_thin_volume(segtype))
+ total_numerator = length - 1; /* highest mapped is 0 .. (length - 1) */
+
if (!segtype->ops->target_percent(&dm->target_state,
&percent, dm->mem,
dm->cmd, seg, params,
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index a850757..c07859a 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -613,7 +613,7 @@ static int _thin_add_target_line(struct dev_manager *dm,
static int _thin_target_percent(void **target_state __attribute__((unused)),
dm_percent_t *percent,
struct dm_pool *mem,
- struct cmd_context *cmd __attribute__((unused)),
+ struct cmd_context *cmd,
struct lv_segment *seg,
char *params,
uint64_t *total_numerator,
@@ -643,15 +643,18 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
*percent = dm_make_percent(s->mapped_sectors, csize);
*total_denominator += csize;
+ *total_numerator += s->mapped_sectors;
} else {
- /* No lv_segment info here */
- *percent = DM_PERCENT_INVALID;
- /* FIXME: Using denominator to pass the mapped info upward? */
+ /* Using denominator to pass the mapped info upward? */
+ if (s->highest_mapped_sector > *total_numerator) {
+ log_warn("WARNING: highest mapped sector %s is above device size.",
+ display_size(cmd, s->highest_mapped_sector));
+ s->highest_mapped_sector = *total_numerator;
+ }
+ *percent = dm_make_percent(s->highest_mapped_sector, *total_numerator);
*total_denominator += s->highest_mapped_sector;
}
- *total_numerator += s->mapped_sectors;
-
return 1;
}
7 years, 8 months
master - thin: no thin-pool flush when reading metadata status
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8bbec41bd48217...
Commit: 8bbec41bd482175ee61478bef65cc58c7e814abf
Parent: fe7ae37f5e4af4f73aee5439dbef93d4facfaadf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Mar 30 10:16:41 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 31 12:15:47 2016 +0200
thin: no thin-pool flush when reading metadata status
Previous fix missed the fact the we do query for 'percent' with
seg value either set or unset (API overload...)
When 'seg' was unset, we still issue flush with status.
Fix it by cheking segtype by target_type.
As we check for segtype - we could also skip whole percentage
if the 'segtype' is unknown by code directly.
Reported-by: Ming-Hung Tsai <mingnus gmail com
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 11 +++++------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dae6a10..3237e0a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.149 -
==================================
+ Do not flush thin-pool when checking metadata fullness.
Remove spurious error about no value in /sys/dev/block/major:minor/dm/uuid.
Fix device mismatch detection for LV if persistent .cache file is used.
Fix holder device not being found in /dev while sysfs has it during dev scan.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 5761ede..2696c56 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -884,20 +884,22 @@ static int _percent_run(struct dev_manager *dm, const char *name,
char *params = NULL;
const struct dm_list *segh = lv ? &lv->segments : NULL;
struct lv_segment *seg = NULL;
- struct segment_type *segtype;
int first_time = 1;
dm_percent_t percent = DM_PERCENT_INVALID;
-
uint64_t total_numerator = 0, total_denominator = 0;
+ struct segment_type *segtype;
*overall_percent = percent;
+ if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
+ return_0;
+
if (!(dmt = _setup_task(name, dlid, event_nr,
wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
/* No freeze on overfilled thin-pool, read existing slightly outdated data */
- if (lv && lv_is_thin_pool(lv) &&
+ if (segtype_is_thin(segtype) &&
!dm_task_no_flush(dmt))
log_warn("Can't set no_flush flag."); /* Non fatal */
@@ -926,9 +928,6 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (!type || !params)
continue;
- if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
- continue;
-
if (strcmp(type, target_type)) {
/* If kernel's type isn't an exact match is it compatible? */
if (!segtype->ops->target_status_compatible ||
7 years, 8 months
master - tests: vg-check-devs-used requires driver version 4.15 at least
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe7ae37f5e4af4...
Commit: fe7ae37f5e4af4f73aee5439dbef93d4facfaadf
Parent: 9a086a660772fbe8e0baa5717db94982f5015137
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 31 10:38:05 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 31 10:38:05 2016 +0200
tests: vg-check-devs-used requires driver version 4.15 at least
---
test/shell/vg-check-devs-used.sh | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/test/shell/vg-check-devs-used.sh b/test/shell/vg-check-devs-used.sh
index c978b9e..26ba694 100644
--- a/test/shell/vg-check-devs-used.sh
+++ b/test/shell/vg-check-devs-used.sh
@@ -13,6 +13,9 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+# We need "dm" directory for dm devices in sysfs.
+aux driver_at_least 4 15 || skip
+
aux prepare_devs 3 8
vgcreate $vg $dev1 $dev2
7 years, 8 months
master - dev-cache: fix check for already indexed dev in _index_dev_by_vgid_and_lvid
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a086a660772fb...
Commit: 9a086a660772fbe8e0baa5717db94982f5015137
Parent: 06ef7ba8765d64044b008a33f1c1faeac6112a4a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 30 14:35:06 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 30 15:57:57 2016 +0200
dev-cache: fix check for already indexed dev in _index_dev_by_vgid_and_lvid
---
lib/device/dev-cache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 50ef2f2..12d0d56 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -529,7 +529,7 @@ static int _index_dev_by_vgid_and_lvid(struct device *dev)
struct device_list *dl_vgid, *dl_lvid;
int r = 0;
- if (dev->vgid)
+ if (dev->flags & DEV_USED_FOR_LV)
/* already indexed */
return 1;
7 years, 8 months
master - dev-cache: cleanup: remove older part of the code in _index_dev_by_vgid_and_lvid
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c769d5249eea4d...
Commit: c769d5249eea4d1b80f1fb0d33fc7505a1618107
Parent: 06ef7ba8765d64044b008a33f1c1faeac6112a4a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 30 14:35:06 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 30 15:54:12 2016 +0200
dev-cache: cleanup: remove older part of the code in _index_dev_by_vgid_and_lvid
Part of devel code, not applicable anymore...
---
lib/device/dev-cache.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 50ef2f2..12d0d56 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -529,7 +529,7 @@ static int _index_dev_by_vgid_and_lvid(struct device *dev)
struct device_list *dl_vgid, *dl_lvid;
int r = 0;
- if (dev->vgid)
+ if (dev->flags & DEV_USED_FOR_LV)
/* already indexed */
return 1;
7 years, 8 months