mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lv: add lv_set_vg
To keep vg->lv_names up-to-date also for merge & split, add function lv_set_vg() the will update also radix tree reference for a VG.
This commit is contained in:
parent
73c7dac1a8
commit
c27d6695c1
@ -1601,6 +1601,22 @@ int lv_set_name(struct logical_volume *lv, const char *lv_name)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lv_set_vg(struct logical_volume *lv, struct volume_group *vg)
|
||||||
|
{
|
||||||
|
const char *lv_name;
|
||||||
|
|
||||||
|
if (lv->vg != vg) {
|
||||||
|
lv_name = lv->name;
|
||||||
|
if (!lv_set_name(lv, NULL))
|
||||||
|
return_0; /* drop from existing VG radix_tree */
|
||||||
|
lv->vg = vg;
|
||||||
|
if (!lv_set_name(lv, lv_name))
|
||||||
|
return_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static char *_time_dup(struct cmd_context *cmd, struct dm_pool *mem,
|
static char *_time_dup(struct cmd_context *cmd, struct dm_pool *mem,
|
||||||
time_t ts, int iso_mode)
|
time_t ts, int iso_mode)
|
||||||
{
|
{
|
||||||
|
@ -154,6 +154,7 @@ char *lvseg_kernel_discards_dup(struct dm_pool *mem, const struct lv_segment *se
|
|||||||
int lv_set_creation(struct logical_volume *lv,
|
int lv_set_creation(struct logical_volume *lv,
|
||||||
const char *hostname, uint64_t timestamp);
|
const char *hostname, uint64_t timestamp);
|
||||||
int lv_set_name(struct logical_volume *lv, const char *lv_name);
|
int lv_set_name(struct logical_volume *lv, const char *lv_name);
|
||||||
|
int lv_set_vg(struct logical_volume *lv, struct volume_group *vg);
|
||||||
int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
|
int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv,
|
||||||
enum activation_change activate);
|
enum activation_change activate);
|
||||||
|
|
||||||
|
@ -156,7 +156,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
|||||||
}
|
}
|
||||||
|
|
||||||
dm_list_iterate_items(lvl1, &vg_from->lvs) {
|
dm_list_iterate_items(lvl1, &vg_from->lvs) {
|
||||||
lvl1->lv->vg = vg_to;
|
if (!lv_set_vg(lvl1->lv, vg_to))
|
||||||
|
goto_bad;
|
||||||
lvl1->lv->lvid.id[0] = lvl1->lv->vg->id;
|
lvl1->lv->lvid.id[0] = lvl1->lv->vg->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ static int _lv_tree_move(struct dm_list *lvh,
|
|||||||
*lvht = dm_list_next(lvh, lvh);
|
*lvht = dm_list_next(lvh, lvh);
|
||||||
|
|
||||||
dm_list_move(&vg_to->lvs, lvh);
|
dm_list_move(&vg_to->lvs, lvh);
|
||||||
lv->vg = vg_to;
|
if (!lv_set_vg(lv, vg_to))
|
||||||
|
return_0;
|
||||||
lv->lvid.id[0] = lv->vg->id;
|
lv->lvid.id[0] = lv->vg->id;
|
||||||
|
|
||||||
if (seg)
|
if (seg)
|
||||||
|
Loading…
Reference in New Issue
Block a user