master - snapshot: move virtsnap code from tool to lib
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=81504ba70caec0adaa63cb4a074b7296d109e807 Commit: 81504ba70caec0adaa63cb4a074b7296d109e807 Parent: 6b35c70e8b17b09691d2db6ea2eadba2ee2d095d Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Oct 11 22:42:34 2013 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Sat Oct 12 00:14:52 2013 +0200
snapshot: move virtsnap code from tool to lib
Move code for removal dependency from tool's remove.c into lib's manipulation code.
Same code then works with lvm2app.
--- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 6 +++++- tools/lvremove.c | 8 -------- 3 files changed, 6 insertions(+), 9 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.104 =================================== + Move code to remove virtual snapshot from tools to lib for lvm2app. Fix possible race during daemon worker thread creation (lvmetad). Fix possible deadlock while clearing lvmetad cache for full rescan. Fix possible race while creating/destroying memory pools.
lib/metadata/lv_manip.c +5 -1
@@ -4685,6 +4685,7 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *struct dm_list *snh, *snht;struct lv_list *lvl;struct lvinfo info; +struct logical_volume *origin;int is_last_pool;if (lv_is_cow (lv)) {
@@ -4713,7 +4714,10 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *return 0 ; } } - } + }else if (!level &&lv_is_virtual_origin (origin =origin_from_cow (lv))) +/* If this is a sparse device, remove its origin too. */ +/* Stacking is not supported */ + lv = origin; }if (lv_is_origin (lv)) {
tools/lvremove.c +0 -8
@@ -18,14 +18,6 @@static int lvremove_single (struct cmd_context *cmd,struct logical_volume *lv,void *handle __attribute__((unused))) { -struct logical_volume *origin; - -/* -* If this is a sparse device, remove its origin too. -*/ -if (lv_is_cow (lv) &&lv_is_virtual_origin (origin =origin_from_cow (lv))) - lv = origin; -if (!lv_remove_with_dependencies (cmd, lv, (force_t )arg_count (cmd, force_ARG),0 )) return_ECMD_FAILED;