Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e1e986f16d27e468…
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),
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97d36d5750924029…
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
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=42881c887777257d…
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)) {
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5658ec2bdc9e5ea8…
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;