master - thin: add sub volumes as whole volumes
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0443c42e3bff5b...
Commit: 0443c42e3bff5b3e0bca6cfdc489d59cd45ada8a
Parent: e1e986f16d27e468a70dcbc2d2c2a249111d7725
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 13:39:53 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:58:07 2013 +0200
thin: add sub volumes as whole volumes
Do not use origin_only when add log_lv and metadata as a subvolume.
The stacked volume needs to access whole volume in this case.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 7 ++-----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 008fdf7..7aa3df9 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add whole log_lv and metadata_lv sub volumes when creating partial tree.
Properly use snapshot layer for origin which is also thin volume.
Avoid generating metadata backup when calling update_pool_lv().
Send thin messages also for active thin pool and inactive thin volume.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 986e696..260cb3e 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1728,22 +1728,19 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
!_add_lv_to_dtree(dm, dtree, seg->external_lv, 1)) /* stack */
return_0;
if (seg->log_lv &&
- !_add_lv_to_dtree(dm, dtree, seg->log_lv, origin_only))
+ !_add_lv_to_dtree(dm, dtree, seg->log_lv, 0))
return_0;
if (seg->metadata_lv &&
- !_add_lv_to_dtree(dm, dtree, seg->metadata_lv, origin_only))
+ !_add_lv_to_dtree(dm, dtree, seg->metadata_lv, 0))
return_0;
if (seg->pool_lv &&
!_add_lv_to_dtree(dm, dtree, seg->pool_lv, 1)) /* stack */
return_0;
for (s = 0; s < seg->area_count; s++) {
- /* FIXME: raid requires to use '0' instead of preserving
- * origin_only value for stacking */
if (seg_type(seg, s) == AREA_LV && seg_lv(seg, s) &&
!_add_lv_to_dtree(dm, dtree, seg_lv(seg, s), 0))
return_0;
- /* FIXME: raid tests fails with origin_only */
if (seg_is_raid(seg) &&
!_add_lv_to_dtree(dm, dtree, seg_metalv(seg, s), 0))
return_0;
10 years, 9 months
master - thin: lvcreate man examples
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e1e986f16d27e4...
Commit: e1e986f16d27e468a70dcbc2d2c2a249111d7725
Parent: 97d36d5750924029c247265c8d700f993405668f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:52:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:54:33 2013 +0200
thin: lvcreate man examples
Add more examples to man page about thin volume snapshot creation
and try to make the text more explicit about size specification.
---
man/lvcreate.8.in | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index fd36e90..64319c1 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -312,11 +312,11 @@ Snapshots provide a 'frozen image' of the contents of the origin
while the origin can still be updated. They enable consistent
backups and online recovery of removed/overwritten data/files.
Thin snapshot is created when the origin is a thin volume and
-the size is not specified. Thin snapshot shares same blocks within
+the size IS NOT specified. Thin snapshot shares same blocks within
the thin pool volume.
-The snapshot with the specified size does not need the same amount of
-storage the origin has. In a typical scenario, 15-20% might be enough.
-In case the snapshot runs out of storage, use
+The non thin volume snapshot with the specified size does not need
+the same amount of storage the origin has. In a typical scenario,
+15-20% might be enough. In case the snapshot runs out of storage, use
.BR lvextend (8)
to grow it. Shrinking a snapshot is supported by
.BR lvreduce (8)
@@ -453,10 +453,18 @@ build with 2 stripes 64KiB and chunk size 256KiB together with
.sp
.B lvcreate \-i 2 \-I 64 \-c 256 \-L100M \-T vg00/pool \-V 1T \-\-name thin_lv
-Creates thin volume snapshot of read only inactive volume "vg00/origin"
-that will use an existing thin pool "vg00/pool":
+Creates a thin snapshot volume "thinsnap" of thin volume "thinvol" that
+will share the same blocks within the thin pool.
+Note: the size MUST NOT be specified, otherwise the non-thin snapshot
+is created instead:
.sp
-.B lvcreate -s --thinpool "vg00/pool" origin
+.B lvcreate -s vg00/thinvol --name thinsnap
+
+Creates a thin snapshot volume of read-only inactive volume "origin"
+which then becomes the thin external origin for the thin snapshot volume
+in vg00 that will use an existing thin pool "vg00/pool":
+.sp
+.B lvcreate -s --thinpool vg00/pool origin
.SH SEE ALSO
.BR lvm (8),
10 years, 9 months
master - thin: check and use layered origin lv
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97d36d57509240...
Commit: 97d36d5750924029c247265c8d700f993405668f
Parent: 925701d9f37e149a738aa4875f2933bee42ca8d0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:47:10 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:51:39 2013 +0200
thin: check and use layered origin lv
Code needs to check if the layer origin device is suspended,
It's valid to create thinvolume snapshot of thinvolume which is also
used as an old-style snapshot. In this case we need to check -real
is suspended.
When adding origin_only - add only layer thin volume.
(in case it's also old-snapshot add only -real device)
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 2 +-
lib/thin/thin.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index deb0338..008fdf7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Properly use snapshot layer for origin which is also thin volume.
Avoid generating metadata backup when calling update_pool_lv().
Send thin messages also for active thin pool and inactive thin volume.
Add activation/auto_set_activation_skip to control activation skip flagging.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 724742d..986e696 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1681,7 +1681,7 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
if (origin_only && lv_is_thin_volume(lv)) {
- if (!_add_dev_to_dtree(dm, dtree, lv, NULL))
+ if (!_add_dev_to_dtree(dm, dtree, lv, lv_layer(lv)))
return_0;
#if 0
/* ? Use origin_only to avoid 'deep' thin pool suspend ? */
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 1867ef9..9bc9e4d 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -298,7 +298,7 @@ static int _thin_pool_add_target_line(struct dev_manager *dm,
case DM_THIN_MESSAGE_CREATE_THIN:
origin = first_seg(lmsg->u.lv)->origin;
/* Check if the origin is suspended */
- if (origin && lv_info(cmd, origin, 0, &info, 0, 0) &&
+ if (origin && lv_info(cmd, origin, 1, &info, 0, 0) &&
info.exists && !info.suspended) {
/* Origin is not suspended, but the transaction may have been
* already transfered, so test for transaction_id and
10 years, 9 months
master - thin: write back when command successfully finished
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=925701d9f37e14...
Commit: 925701d9f37e149a738aa4875f2933bee42ca8d0
Parent: 42881c887777257de42acf695aa3da7693af33d5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:39:03 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:48:32 2013 +0200
thin: write back when command successfully finished
Remove backup() call from update_pool_lv() as it's been there
duplicated and preperly order backup() call after lvresize,
so there is just one such call.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 4 ++--
lib/metadata/thin_manip.c | 2 --
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4c662c1..deb0338 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Avoid generating metadata backup when calling update_pool_lv().
Send thin messages also for active thin pool and inactive thin volume.
Add activation/auto_set_activation_skip to control activation skip flagging.
Add 's(k)ip activation' bit to lvs -o lv_attr to indicate skip flag attached.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 87f30f7..5ec2bd0 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4053,8 +4053,6 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
if (!monitor_dev_for_events(cmd, lv, 0, 0))
stack;
- backup(vg);
-
/*
* Update lvm pool metadata (drop messages) if the pool has been
* resumed and do a pool active/deactivate in other case.
@@ -4067,6 +4065,8 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
!update_pool_lv(lv, !lv_is_active(lv)))
return_0;
+ backup(vg);
+
log_print_unless_silent("Logical volume %s successfully resized", lp->lv_name);
if (lp->resizefs && (lp->resize == LV_EXTEND) &&
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 5b1b440..4f6e2ec 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -558,8 +558,6 @@ int update_pool_lv(struct logical_volume *lv, int activate)
if (!vg_write(lv->vg) || !vg_commit(lv->vg))
return_0;
- backup(lv->vg);
-
return 1;
}
10 years, 9 months
master - thin: send messages to active pool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=42881c88777725...
Commit: 42881c887777257de42acf695aa3da7693af33d5
Parent: 5658ec2bdc9e5ea816a1dd227ffbb74d6cbfb8f5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:27:57 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:47:25 2013 +0200
thin: send messages to active pool
If the thin pool is known to be active, messages can be passed
to the pool even when the created thin volume is not going to be
activated.
So we do not need to stack large list of message and validate
and catch creation errors earlier in this case.
Replace the test for valid activation combination with simpler list of
deactivation combinations.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 11 +++++------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1f1a984..4c662c1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Send thin messages also for active thin pool and inactive thin volume.
Add activation/auto_set_activation_skip to control activation skip flagging.
Add 's(k)ip activation' bit to lvs -o lv_attr to indicate skip flag attached.
Add --ignoreactivationskip to lvcreate/vgchange/lvchange to ignore skip flag.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fa63b78..87f30f7 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5548,18 +5548,17 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
}
}
- if (seg_is_thin_volume(lp) &&
- ((lp->activate == CHANGE_AY) ||
- (lp->activate == CHANGE_AE) ||
- (lp->activate == CHANGE_ALY))) {
+ if (seg_is_thin_volume(lp)) {
/* Ensure all stacked messages are submitted */
if (!(lvl = find_lv_in_vg(vg, lp->pool))) {
log_error("Unable to find existing pool LV %s in VG %s.",
lp->pool, vg->name);
return NULL;
}
- if (!update_pool_lv(lvl->lv, 1))
- return_NULL;
+ if (lv_is_active(lvl->lv) ||
+ ((lp->activate != CHANGE_AN) && (lp->activate != CHANGE_ALN)))
+ if (!update_pool_lv(lvl->lv, 1))
+ return_NULL;
}
if (vg_is_clustered(vg) && segtype_is_raid(lp->segtype)) {
10 years, 9 months
master - libdm: thin pool target sends messages once
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5658ec2bdc9e5e...
Commit: 5658ec2bdc9e5ea816a1dd227ffbb74d6cbfb8f5
Parent: e5c30061fc5652846a61fcd460c6a1636d346a7c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:53:30 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:45:28 2013 +0200
libdm: thin pool target sends messages once
Clear send_messages flag when they have been delivered successfully.
There is no need to validate it for all other activations of the same
node in the dm_tree.
Also add extra debug message which shows the reason for skipping
sending of messages because the transaction_id has already the matching
value.
---
WHATS_NEW_DM | 1 +
libdm/libdm-deptree.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index e784ada..b269f55 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Process thin messages once to active thin pool target for dm_tree.
Optimize out setting the same value or read_ahead.
Add DM_ARRAY_SIZE public macro.
Move syslog code out of signal handle in dmeventd.
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index fae9445..34cd960 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1484,8 +1484,12 @@ static int _node_send_messages(struct dm_tree_node *dnode,
if (!_thin_pool_status_transaction_id(dnode, &trans_id))
goto_bad;
- if (trans_id == seg->transaction_id)
+ if (trans_id == seg->transaction_id) {
+ if (!dm_list_empty(&seg->thin_messages))
+ log_debug_activation("Thin pool transaction_id matches %" PRIu64
+ ", skipping messages.", trans_id);
return 1; /* In sync - skip messages */
+ }
if (trans_id != (seg->transaction_id - 1)) {
log_error("Thin pool transaction_id=%" PRIu64 ", while expected: %" PRIu64 ".",
@@ -1784,9 +1788,12 @@ int dm_tree_activate_children(struct dm_tree_node *dnode,
* resume should continue further, just whole command
* has to report failure.
*/
- if (r && dnode->props.send_messages &&
- !(r = _node_send_messages(dnode, uuid_prefix, uuid_prefix_len)))
- stack;
+ if (r && dnode->props.send_messages) {
+ if (!(r = _node_send_messages(dnode, uuid_prefix, uuid_prefix_len)))
+ stack;
+ else
+ dnode->props.send_messages = 0; /* messages posted */
+ }
handle = NULL;
10 years, 9 months
master - libdm: remove unneeded read_ahead settings
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e5c30061fc5652...
Commit: e5c30061fc5652846a61fcd460c6a1636d346a7c
Parent: 55d90b64207739ddee710f40cab8b71fc45d9849
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 11:41:07 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:43:28 2013 +0200
libdm: remove unneeded read_ahead settings
Skip settings are read_ahead value which is already set in kernel.
---
WHATS_NEW_DM | 1 +
libdm/libdm-common.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 2fc454b..e784ada 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Optimize out setting the same value or read_ahead.
Add DM_ARRAY_SIZE public macro.
Move syslog code out of signal handle in dmeventd.
Add DM_TO_STRING public macro.
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index d18de9c..8d5eca8 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1221,7 +1221,7 @@ static int _set_dev_node_read_ahead(const char *dev_name,
if (!get_dev_node_read_ahead(dev_name, major, minor, ¤t_read_ahead))
return_0;
- if (current_read_ahead > read_ahead) {
+ if (current_read_ahead >= read_ahead) {
log_debug_activation("%s: retaining kernel read ahead of %" PRIu32
" (requested %" PRIu32 ")",
dev_name, current_read_ahead, read_ahead);
10 years, 9 months
master - cleanup: update commented-out code part
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55d90b64207739...
Commit: 55d90b64207739ddee710f40cab8b71fc45d9849
Parent: 9ba77833504fb08456db1fab8a4061b689f7922c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 15 13:05:15 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:40:46 2013 +0200
cleanup: update commented-out code part
Just make it in-sync with latest proposal.
---
lib/activate/dev_manager.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 74afaac..724742d 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1685,11 +1685,11 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
return_0;
#if 0
/* ? Use origin_only to avoid 'deep' thin pool suspend ? */
- /* FIXME Implement dm_tree_node_skip_children optimisation */
- if (!(uuid = build_dm_uuid(dm->mem, lv->lvid.s, lv_lauer(lv))))
+ /* FIXME Implement dm_tree_node_skip_childrens optimisation */
+ if (!(uuid = build_dm_uuid(dm->mem, lv->lvid.s, lv_layer(lv))))
return_0;
if ((thin_node = dm_tree_find_node_by_uuid(dtree, uuid)))
- dm_tree_node_skip_children(thin_node, 1);
+ dm_tree_node_skip_childrens(thin_node, 1);
#endif
}
10 years, 9 months
master - cleanup: update comments
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9ba77833504fb0...
Commit: 9ba77833504fb08456db1fab8a4061b689f7922c
Parent: a9dbe2c4fa5a9fa18fa1e0223a622708693be27a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 6 11:04:19 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 15 15:40:46 2013 +0200
cleanup: update comments
Add and indent.
---
lib/display/display.c | 2 +-
lib/metadata/lv_manip.c | 2 +-
tools/lvcreate.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/display/display.c b/lib/display/display.c
index e2b0f76..3f7f360 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -928,7 +928,7 @@ char yes_no_prompt(const char *prompt, ...)
}
if ((c = getchar()) == EOF) {
- ret = 'n';
+ ret = 'n'; /* SIGINT */
break;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ee65332..fa63b78 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5655,7 +5655,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
}
if (lv_is_active(org) && !lv_is_external_origin(org)) {
log_error("Cannot use active LV for the external origin.");
- return 0; // We can't be sure device it is read-only
+ return 0; // We can't be sure device is read-only
}
if (!attach_thin_external_origin(first_seg(lv), org)) {
stack;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index f69c084..d9578aa 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -634,7 +634,7 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex
else
lp->read_ahead = (lp->read_ahead / pagesize) * pagesize;
log_warn("WARNING: Overriding readahead to %u sectors, a multiple "
- "of %uK page size.", lp->read_ahead, pagesize >> 1);
+ "of %uK page size.", lp->read_ahead, pagesize >> 1);
}
/*
10 years, 9 months
master - fix: apply profile and then get the config path + auto_set_activation not profilable
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a9dbe2c4fa5a9f...
Commit: a9dbe2c4fa5a9fa18fa1e0223a622708693be27a
Parent: eaa1f0eb15737e130a0a501905871400b66f68ff
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jul 15 13:33:14 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jul 15 13:33:14 2013 +0200
fix: apply profile and then get the config path + auto_set_activation not profilable
cfg_def_get_path uses a global static var to store the result (for efficiency).
So we need to apply the profile first and then get the path for the config item
when calling find_config_tree_* fns.
Also activation/auto_set_activation is not profilable (at least not now,
maybe later if we need that).
---
lib/config/config.c | 58 +++++++++++++++++++++++++----------------
lib/config/config_settings.h | 2 +-
2 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 7e79dd7..2c2d9a3 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -813,16 +813,18 @@ const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- const char *path = cfg_def_get_path(item);
+ const char *path;
int profile_applied = 0;
const char *str;
- if (item->type != CFG_TYPE_STRING)
- log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
-
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
+ path = cfg_def_get_path(item);
+
+ if (item->type != CFG_TYPE_STRING)
+ log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
+
str = dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
if (profile_applied)
@@ -834,18 +836,20 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- const char *path = cfg_def_get_path(item);
+ const char *path;
int profile_applied = 0;
const char *str;
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ path = cfg_def_get_path(item);
+
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
if (!(item->flags & CFG_ALLOW_EMPTY))
log_error(INTERNAL_ERROR "%s cfg tree element not declared to allow empty values.", path);
- if (profile && !cmd->profile_params->global_profile)
- profile_applied = override_config_tree_from_profile(cmd, profile);
-
str = dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
if (profile_applied)
@@ -857,16 +861,18 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- const char *path = cfg_def_get_path(item);
+ const char *path;
int profile_applied = 0;
int i;
- if (item->type != CFG_TYPE_INT)
- log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
-
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
+ path = cfg_def_get_path(item);
+
+ if (item->type != CFG_TYPE_INT)
+ log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
+
i = dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
if (profile_applied)
@@ -878,16 +884,18 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profil
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- const char *path = cfg_def_get_path(item);
+ const char *path;
int profile_applied = 0;
int i64;
- if (item->type != CFG_TYPE_INT)
- log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
-
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
+ path = cfg_def_get_path(item);
+
+ if (item->type != CFG_TYPE_INT)
+ log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
+
i64 = dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
if (profile_applied)
@@ -899,16 +907,18 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
- const char *path = cfg_def_get_path(item);
+ const char *path;
int profile_applied = 0;
float f;
- if (item->type != CFG_TYPE_FLOAT)
- log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
-
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
+ path = cfg_def_get_path(item);
+
+ if (item->type != CFG_TYPE_FLOAT)
+ log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
+
f = dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_FLOAT));
if (profile_applied)
@@ -924,12 +934,14 @@ int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profi
int profile_applied = 0;
int b;
- if (item->type != CFG_TYPE_BOOL)
- log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
-
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
+ path = cfg_def_get_path(item);
+
+ if (item->type != CFG_TYPE_BOOL)
+ log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
+
b = dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_BOOL));
if (profile_applied)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index d2a6765..4d124c8 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -185,7 +185,7 @@ cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, 0
cfg(activation_use_mlockall_CFG, "use_mlockall", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_MLOCKALL, vsn(2, 2, 62), NULL)
cfg(activation_monitoring_CFG, "monitoring", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DMEVENTD_MONITOR, vsn(2, 2, 63), NULL)
cfg(activation_polling_interval_CFG, "polling_interval", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_INTERVAL, vsn(2, 2, 63), NULL)
-cfg(activation_auto_set_activation_skip_CFG, "auto_set_activation_skip", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_AUTO_SET_ACTIVATION_SKIP, vsn(2,2,99), NULL)
+cfg(activation_auto_set_activation_skip_CFG, "auto_set_activation_skip", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_AUTO_SET_ACTIVATION_SKIP, vsn(2,2,99), NULL)
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL)
cfg(metadata_vgmetadatacopies_CFG, "vgmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_VGMETADATACOPIES, vsn(2, 2, 69), NULL)
10 years, 9 months