Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a24eae6e82f365c6…
Commit: a24eae6e82f365c66f4faeabc975ead0c476916b
Parent: bf157ed833f8732c4e264422bd8be46fdf75673a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 17 21:52:27 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 18 19:23:13 2016 +0100
cache: prepare status checking for layer
To be ready to show status of cache volume, call the status
with layer. Layer is automatically detected in this case when
cache volume is used in 'layered' form (needs -real suffix).
---
WHATS_NEW | 1 +
lib/activate/activate.c | 4 ++--
lib/metadata/cache_manip.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e9c953..6b9a310 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Support status checking of cache volume used in layer.
Avoid shifting by one number of blocks when clearing dirty cache volume.
Extend metadata validation of external origin LV use count.
Fix dm table when the last user of active external origin is removed.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index c554337..b7009e6 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -770,7 +770,7 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
/* INFO is not set as cache-pool cannot be active.
* STATUS is collected from cache LV */
lv_seg = get_only_segment_using_this_lv(lv);
- (void) _lv_info(cmd, lv_seg->lv, 0, NULL, lv_seg, &status->seg_status, 0, 0);
+ (void) _lv_info(cmd, lv_seg->lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
return 1;
}
@@ -1171,7 +1171,7 @@ int lv_cache_status(const struct logical_volume *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, 1, NULL, 0, 0)) {
log_error("Cannot check status for locally inactive cache volume %s.",
display_lvname(cache_lv));
return 0;
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 54d907c..ed72fae 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -475,7 +475,7 @@ int lv_cache_remove(struct logical_volume *cache_lv)
}
/* Localy active volume is needed for writeback */
- if (!lv_is_active_locally(cache_lv)) {
+ if (!lv_info(cache_lv->vg->cmd, cache_lv, 1, NULL, 0, 0)) {
/* Give up any remote locks */
if (!deactivate_lv(cache_lv->vg->cmd, cache_lv)) {
log_error("Cannot deactivate remotely active cache volume %s.",
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c71fefad8d5e1d9a…
Commit: c71fefad8d5e1d9a075553ab69791ddbf6bcb153
Parent: bdfc96cb089031c6d95dccb0ff66616efdb16783
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Dec 17 21:54:51 2016 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Dec 18 19:12:12 2016 +0100
lvs: show status for layer
When LV is external origin, show info for LV but
status for -layer. So we expose more info to a user
as otherwise active external origin is only linear
mapping of -real layer.
We do the same for i.e. old snaphost origin.
---
WHATS_NEW | 1 +
lib/activate/activate.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index eee6e98..93fc93e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Improve reported lvs status for active external origin volume.
Fix table load for splitted RAID LV and require explicit activation.
Always active splitted RAID LV exclusively locally.
Do not use LV RAID status bit for segment status.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index b4c8a2c..c554337 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -784,6 +784,13 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
status->info.exists = 0; /* So pool LV is not active */
}
return 1;
+ } else if (lv_is_external_origin(lv)) {
+ if (!_lv_info(cmd, lv, 0, &status->info, NULL, NULL,
+ with_open_count, with_read_ahead))
+ return_0;
+
+ (void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
+ return 1;
} else if (lv_is_origin(lv)) {
/* Query segment status for 'layered' (-real) device most of the time,
* only for merging snapshot, query its progress.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5635cd3b0337ac85…
Commit: 5635cd3b0337ac854a82a1a15cef2609c2091e6c
Parent: 886b4f755d7f33194f92dafbf2c22517db4de374
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Sun Dec 18 12:42:47 2016 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Sun Dec 18 13:03:44 2016 +0000
dmstats: separate TIMERFD and useleep() exit conditions
The time management code mixes tests of the _timer_fd value with
code that should be timer agnostic: this causes problems for users
of the usleep() timer, since it cannot properly detect the start
of a new interval:
Beginning first interval
Interval #18446744069414584348 time delta: 1000000000ns
Interval #18446744069414584348 current err: 0ns
End interval #18446744069414584348 duration: 1000000000ns
Adjusted sample interval duration: 1000000000ns
[...]
Beginning first interval
Interval #18446744069414584349 time delta: 1000000000ns
Interval #18446744069414584349 current err: 0ns
End interval #18446744069414584349 duration: 1000000000ns
Adjusted sample interval duration: 1000000000ns
Separate these out, by defining a _timer_running() call that each
timer implements, and only define _timer_fd if we are compiling
with TIMERFD enabled.
---
tools/dmsetup.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 17c5742..b1967db 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -286,7 +286,9 @@ static struct dm_timestamp *_start_timestamp = NULL;
static uint64_t _interval = 0; /* configured interval in nsecs */
static uint64_t _new_interval = 0; /* flag top-of-interval */
static uint64_t _last_interval = 0; /* approx. measured interval in nsecs */
+#ifdef HAVE_SYS_TIMERFD_H
static int _timer_fd = -1; /* timerfd file descriptor. */
+#endif /* HAVE_SYS_TIMERFD_H */
/* Invalid fd value used to signal end-of-reporting. */
#define TIMER_STOPPED -2
@@ -647,6 +649,14 @@ static int _do_timer_wait(void)
return _do_timerfd_wait();
}
+static int _timer_running(void)
+{
+ /*
+ * Clock shutdown for exit - nothing to do.
+ */
+ return ((_timer_fd == TIMER_STOPPED) && !_cycle_timestamp);
+}
+
#else /* !HAVE_SYS_TIMERFD_H */
static int _start_usleep_timer(void)
{
@@ -718,6 +728,11 @@ static int _do_timer_wait(void)
return _do_usleep_wait();
}
+static int _timer_running(void)
+{
+ return (_start_timestamp != NULL);
+}
+
#endif /* HAVE_SYS_TIMERFD_H */
static int _update_interval_times(void)
@@ -729,7 +744,7 @@ static int _update_interval_times(void)
/*
* Clock shutdown for exit - nothing to do.
*/
- if ((_timer_fd == TIMER_STOPPED) && !_cycle_timestamp)
+ if (!_timer_running())
goto out;
/* clock is running */
@@ -805,7 +820,7 @@ static int _update_interval_times(void)
out:
/* timer stopped or never started */
- if (!r || _timer_fd < 0) {
+ if (!r || !_timer_running()) {
/* The _cycle_timestamp has not yet been allocated if we
* fail to obtain this_timestamp on the first interval.
*/