Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=79ea81b8a8496774…
Commit: 79ea81b8a849677489c35717fb571d3d6e67a0a0
Parent: d4c024c836aa10be0fe4d55157bac15f5ede62a8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 14 17:41:27 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 17 11:25:03 2015 +0200
thin: restore transaction_id handling
Revert back to already existing behavior which has been slightly
modified by a900d150e4658a5d72c39acdd4fefd069b8f00b8.
At the end however it seem to be equal to change TID right with first
metadata write.
Existing code missed handling for 'unused' thin-pool which would
require to also check empty message list for TID==0.
So with the fix we now again preserve 'active' thin-pool volume
when first thin volume is created - this property was lost and caused
problems in cluster, where the lock was hold, but volume was no longer
active on the node.
Another missing part was the proper support for already increased,
but unfinished TID change.
So going back here with existing logic -
TID is increased with first MDA update.
Code allows start with either same TID or (TID-1).
If there are messages, TID must be lower by 1 for sending,
otherwise messages were already posted.
---
lib/metadata/thin_manip.c | 7 ++++---
lib/thin/thin.c | 10 +++++-----
libdm/libdm-deptree.c | 2 +-
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index d0a5c55..24c68a8 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -63,6 +63,10 @@ int attach_pool_message(struct lv_segment *pool_seg, dm_thin_message_t type,
tmsg->type = type;
+ /* If the 1st message is add in non-read-only mode, modify transaction_id */
+ if (!no_update && dm_list_empty(&pool_seg->thin_messages))
+ pool_seg->transaction_id++;
+
dm_list_add(&pool_seg->thin_messages, &tmsg->list);
log_debug_metadata("Added %s message.",
@@ -476,9 +480,6 @@ int update_pool_lv(struct logical_volume *lv, int activate)
dm_list_init(&(first_seg(lv)->thin_messages));
- /* thin-pool target transaction is finished, increase lvm2 TID */
- first_seg(lv)->transaction_id++;
-
if (!vg_write(lv->vg) || !vg_commit(lv->vg))
return_0;
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 4c4636f..c5f04f3 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -295,7 +295,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
}
if (!dm_tree_node_add_thin_pool_target(node, len,
- seg->transaction_id + (laopts->send_messages ? 1 : 0),
+ seg->transaction_id,
metadata_dlid, pool_dlid,
seg->chunk_size, seg->low_water_mark,
seg->zero_new_blocks ? 0 : 1))
@@ -345,7 +345,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
*/
if (!lv_thin_pool_transaction_id(seg->lv, &transaction_id))
return_0; /* Thin pool should exist and work */
- if (transaction_id != seg->transaction_id) {
+ if ((transaction_id + 1) != seg->transaction_id) {
log_error("Can't create snapshot %s as origin %s is not suspended.",
lmsg->u.lv->name, origin->name);
return 0;
@@ -373,11 +373,11 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
if (!dm_list_empty(&seg->thin_messages)) {
/* Messages were passed, modify transaction_id as the last one */
- log_debug_activation("Thin pool set transaction id %" PRIu64 ".", seg->transaction_id + 1);
+ log_debug_activation("Thin pool set transaction id %" PRIu64 ".", seg->transaction_id);
if (!dm_tree_node_add_thin_pool_message(node,
DM_THIN_MESSAGE_SET_TRANSACTION_ID,
- seg->transaction_id,
- seg->transaction_id + 1))
+ seg->transaction_id - 1,
+ seg->transaction_id))
return_0;
}
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index d28f0de..84f1d28 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1586,7 +1586,7 @@ static int _node_send_messages(struct dm_tree_node *dnode,
}
/* Error if there are no stacked messages or id mismatches */
- if (trans_id != (seg->transaction_id - have_messages)) {
+ if ((trans_id + 1) != seg->transaction_id) {
log_error("Thin pool %s transaction_id is %" PRIu64 ", while expected %" PRIu64 ".",
_node_name(dnode), trans_id, seg->transaction_id - have_messages);
return 0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d4c024c836aa10be…
Commit: d4c024c836aa10be0fe4d55157bac15f5ede62a8
Parent: b297d78367c2a9395bcc6abc7484763368979842
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Aug 17 11:19:28 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Aug 17 11:25:03 2015 +0200
cache: use undefined settings for cache_policy
As cache_policy is evaluated in runtime, we no longer should use
CFG_COMMENTED, but have to switch to CFG_UNDEFINED.
So as long as the value is undefined, it's runtime evaluated.
Once it's set - it's always respected (no runtime fallback).
Also fix version of introduced settings to 2.2.128.
---
lib/config/config_settings.h | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index b687c57..f18d173 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -474,13 +474,13 @@ cfg(allocation_cache_mode_CFG, "cache_mode", allocation_CFG_SECTION, CFG_DEFAULT
"writeback - Data blocks are written from the cache back\n"
"to disk after some delay to improve performance.\n")
-cfg_runtime(allocation_cache_policy_CFG, "cache_policy", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, vsn(2, 2, 127), 0, NULL,
+cfg_runtime(allocation_cache_policy_CFG, "cache_policy", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, vsn(2, 2, 128), 0, NULL,
"The default cache policy used for new cache volume.\n"
- "Generally available policies are: mq, smq.\n"
- "mq - Multiqueue policy with 88 bytes per block\n"
- "smq - Stochastic multique with 25 bytes per block (kernel >= 4.2).\n")
+ "For the kernel 4.2 and newer the default policy is smq\n"
+ "(Stochastic multique), otherwise the older mq (Multiqueue),\n"
+ "policy is selected.\n")
-cfg_section(allocation_cache_settings_CFG_SECTION, "cache_settings", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, vsn(2, 2, 127), 0, NULL,
+cfg_section(allocation_cache_settings_CFG_SECTION, "cache_settings", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, vsn(2, 2, 128), 0, NULL,
"Individual settings for policies.\n"
"See the help for individual policies for more info.\n")
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b297d78367c2a939…
Commit: b297d78367c2a9395bcc6abc7484763368979842
Parent: 4a6d5e2012cbcf40842b5ef051347694bbf5ca04
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Sun Aug 16 01:16:16 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Sun Aug 16 01:16:16 2015 +0100
WHATS_NEW: Update.
---
WHATS_NEW | 7 +++----
WHATS_NEW_DM | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1e34e1c..dbb78d6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,10 +1,9 @@
Version 2.02.128 -
===================================
Check for valid cache mode in validation of cache segment.
- Enhance internal API cache_set_mode() and cache_set_policy().
- Enhance toollib's get_cache_params().
- Runtime detect presence of cache smq policy.
- Add demo cache-mq and cache-smq profiles.
+ Change internal interface handling cache mode and policy.
+ When no cache policy specified, prefer smq (if available) over mq.
+ Add demo cache-mq and cache-smq profiles.
Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
Require cache_check 0.5.4 for use of --clear-needs-check-flag.
Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 8e816a0..870ffb2 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,8 +1,8 @@
Version 1.02.105 -
===================================
- Fix 'stats list -o all' segfault
- Separate statistics fields from region information fields
- Add interval and interval_ns fields to DR_STATS reports.
+ Fix 'dmstats list -o all' segfault.
+ Separate dmstats statistics fields from region information fields.
+ Add interval and interval_ns fields to dmstats reports.
Do not include internal glibc headers in libdm-timestamp.c (1.02.104)
Exit immediately if no device is supplied to dmsetup wipe_table.
Suppress dmsetup report headings when no data is output. (1.02.104)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9d5cd4ca14a94d83…
Commit: 9d5cd4ca14a94d83bf7b3c0b73896abc4ff8926c
Parent: 0b487802a041a0848e927e3dfc3d71618b66ca42
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Sat Aug 15 00:32:59 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Sat Aug 15 00:42:51 2015 +0100
dmstats: fix new area count for 'create --areasize'
Commit f10ad95 introduced a regression in the calculation of the
number of areas in a region created with the --areasize switch:
vg_hex-lv_home: Created new region with 0 area(s) as region ID 1
vg_hex-lv_swap: Created new region with 0 area(s) as region ID 1
Fis this by using the correct region size when calculating the
value.
---
tools/dmsetup.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 9e72226..ee1e1fe 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4456,7 +4456,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
const char *program_id,
const char *aux_data)
{
- uint64_t this_start, this_len, region_id = UINT64_C(0);
+ uint64_t this_start = 0, this_len = 0, region_id = UINT64_C(0);
char *target_type, *params; /* unused */
struct dm_task *dmt;
struct dm_info info;
@@ -4506,7 +4506,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
* whole-device region).
*/
this_start = (segments) ? segment_start : start;
- this_len = (segments) ? segment_len : len;
+ this_len = (segments) ? segment_len : this_len;
if (!dm_stats_create_region(dms, ®ion_id,
this_start, this_len, step,
program_id, aux_data)) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=00ed52365916753d…
Commit: 00ed52365916753d0bd6eb0de09c46ad782fec2e
Parent: 77fae3d8522ffb1077dcb0e2e9ebfba86cf19daf
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Fri Aug 14 20:30:05 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Fri Aug 14 22:03:37 2015 +0100
libdm: add dm_stats_get_{current_}area_offset()
Add a method to retrieve the offset of an area within the
containing region (rather than the offset within the containing
device returned by dm_stats_get_area_start()).
Although users of the library can calculate this themselves it is
better to provide this through a method call to avoid users making
assumptions about the structure of regions and areas.
---
libdm/.exported_symbols.DM_1_02_105 | 2 ++
libdm/libdevmapper.h | 17 ++++++++++++++---
libdm/libdm-stats.c | 15 +++++++++++++++
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/libdm/.exported_symbols.DM_1_02_105 b/libdm/.exported_symbols.DM_1_02_105
index 9b701f1..4707164 100644
--- a/libdm/.exported_symbols.DM_1_02_105
+++ b/libdm/.exported_symbols.DM_1_02_105
@@ -1 +1,3 @@
dm_report_is_empty
+dm_stats_get_area_offset
+dm_stats_get_current_area_offset
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 303ed67..bfc90da 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -705,19 +705,27 @@ uint64_t dm_stats_get_region_area_len(const struct dm_stats *dms,
uint64_t *area_len, uint64_t region_id);
/*
- * Area properties: start and length.
+ * Area properties: start, offset and length.
*
* The area length is always equal to the area length of the region
* that contains it and is obtained from dm_stats_get_region_area_len().
*
- * The start offset of an area is a function of the area_id and the
- * containing region's start and area length.
+ * The start of an area is a function of the area_id and the containing
+ * region's start and area length: it gives the absolute offset into the
+ * containing device of the beginning of the area.
+ *
+ * The offset expresses the area's relative offset into the current
+ * region. I.e. the area start minus the start offset of the containing
+ * region.
*
* All values are returned in units of 512b sectors.
*/
uint64_t dm_stats_get_area_start(const struct dm_stats *dms, uint64_t *start,
uint64_t region_id, uint64_t area_id);
+uint64_t dm_stats_get_area_offset(const struct dm_stats *dms, uint64_t *offset,
+ uint64_t region_id, uint64_t area_id);
+
/*
* Retrieve program_id and aux_data for a specific region. Only valid
* following a call to dm_stats_list(). The returned pointer does not
@@ -876,6 +884,9 @@ uint64_t dm_stats_get_current_region_area_len(const struct dm_stats *dms,
uint64_t dm_stats_get_current_area_start(const struct dm_stats *dms,
uint64_t *start);
+uint64_t dm_stats_get_current_area_offset(const struct dm_stats *dms,
+ uint64_t *offset);
+
uint64_t dm_stats_get_current_area_len(const struct dm_stats *dms,
uint64_t *start);
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 51aba79..400b12d 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1335,6 +1335,14 @@ uint64_t dm_stats_get_area_start(const struct dm_stats *dms, uint64_t *start,
return 1;
}
+uint64_t dm_stats_get_area_offset(const struct dm_stats *dms, uint64_t *offset,
+ uint64_t region_id, uint64_t area_id)
+{
+ if (!dms || !dms->regions)
+ return_0;
+ *offset = dms->regions[region_id].step * area_id;
+}
+
uint64_t dm_stats_get_current_area_start(const struct dm_stats *dms,
uint64_t *start)
{
@@ -1342,6 +1350,13 @@ uint64_t dm_stats_get_current_area_start(const struct dm_stats *dms,
dms->cur_region, dms->cur_area);
}
+uint64_t dm_stats_get_current_area_offset(const struct dm_stats *dms,
+ uint64_t *offset)
+{
+ return dm_stats_get_area_offset(dms, offset,
+ dms->cur_region, dms->cur_area);
+}
+
uint64_t dm_stats_get_current_area_len(const struct dm_stats *dms,
uint64_t *len)
{