1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

snapshot: revert and move check to lvconvert

Revert 4777eb6872 which put
target_present check into init_snapshot_merge(). However
this function is also used when parsing metadata. So we would
get this present test performed even when target is not really
needed. So move this target_present test directly into lvconvert.
This commit is contained in:
Zdenek Kabelac 2013-11-22 14:52:35 +01:00
parent 3d3b8bfd1c
commit 6d196410fc
4 changed files with 10 additions and 13 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.105 - Version 2.02.105 -
===================================== =====================================
Move test for target present from init_snapshot_merge() to lvconvert.
Check for failure of lvmcache_add_mda() when writing pv. Check for failure of lvmcache_add_mda() when writing pv.
Check for failure of dev_get_size() when reporting device size. Check for failure of dev_get_size() when reporting device size.
Drop extra unneeded '/' when scanning sysfs directory. Drop extra unneeded '/' when scanning sysfs directory.

View File

@ -880,7 +880,7 @@ struct logical_volume *origin_from_cow(const struct logical_volume *lv);
void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
struct logical_volume *cow, uint32_t chunk_size, int merge); struct logical_volume *cow, uint32_t chunk_size, int merge);
int init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin); void init_snapshot_merge(struct lv_segment *snap_seg, struct logical_volume *origin);
void clear_snapshot_merge(struct logical_volume *origin); void clear_snapshot_merge(struct logical_volume *origin);

View File

@ -19,7 +19,6 @@
#include "toolcontext.h" #include "toolcontext.h"
#include "lv_alloc.h" #include "lv_alloc.h"
#include "activate.h" #include "activate.h"
#include "segtype.h"
int lv_is_origin(const struct logical_volume *lv) int lv_is_origin(const struct logical_volume *lv)
{ {
@ -152,8 +151,8 @@ void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
dm_list_add(&origin->snapshot_segs, &seg->origin_list); dm_list_add(&origin->snapshot_segs, &seg->origin_list);
} }
int init_snapshot_merge(struct lv_segment *snap_seg, void init_snapshot_merge(struct lv_segment *snap_seg,
struct logical_volume *origin) struct logical_volume *origin)
{ {
/* /*
* Even though lv_is_visible(snap_seg->lv) returns 0, * Even though lv_is_visible(snap_seg->lv) returns 0,
@ -169,13 +168,6 @@ int init_snapshot_merge(struct lv_segment *snap_seg,
snap_seg->status |= MERGING; snap_seg->status |= MERGING;
origin->snapshot = snap_seg; origin->snapshot = snap_seg;
origin->status |= MERGING; origin->status |= MERGING;
if (snap_seg->segtype->ops->target_present &&
!snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd,
snap_seg, NULL))
return 0;
return 1;
} }
void clear_snapshot_merge(struct logical_volume *origin) void clear_snapshot_merge(struct logical_volume *origin)

View File

@ -1919,10 +1919,14 @@ static int lvconvert_merge(struct cmd_context *cmd,
} }
} }
if (!init_snapshot_merge(snap_seg, origin)) { init_snapshot_merge(snap_seg, origin);
if (snap_seg->segtype->ops->target_present &&
!snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd,
snap_seg, NULL)) {
log_error("Can't initialize snapshot merge. " log_error("Can't initialize snapshot merge. "
"Missing support in kernel?"); "Missing support in kernel?");
return_0; return 0;
} }
/* store vg on disk(s) */ /* store vg on disk(s) */