mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
make list_move consistent with other list fns
This commit is contained in:
parent
8618c271cf
commit
456e42257c
@ -65,6 +65,15 @@ void list_del(struct list *elem)
|
||||
elem->p->n = elem->n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove an element from existing list and insert before 'head'.
|
||||
*/
|
||||
void list_move(struct list *head, struct list *elem)
|
||||
{
|
||||
list_del(elem);
|
||||
list_add(head, elem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the list empty?
|
||||
*/
|
||||
|
@ -55,14 +55,9 @@ void list_add_h(struct list *head, struct list *elem);
|
||||
void list_del(struct list *elem);
|
||||
|
||||
/*
|
||||
* Move an element from an existing list to list 'head'.
|
||||
* Insert the element before 'head'.
|
||||
* Remove an element from existing list and insert before 'head'.
|
||||
*/
|
||||
static inline void list_move(struct list *item, struct list *head)
|
||||
{
|
||||
list_del(item);
|
||||
list_add(head, item);
|
||||
}
|
||||
void list_move(struct list *head, struct list *elem);
|
||||
|
||||
/*
|
||||
* Is the list empty?
|
||||
|
@ -716,7 +716,7 @@ int vg_split_mdas(struct cmd_context *cmd __attribute((unused)),
|
||||
if (is_orphan_vg(vg_to->name))
|
||||
list_del(&mda->list);
|
||||
else
|
||||
list_move(&mda->list, mdas_to);
|
||||
list_move(mdas_to, &mda->list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,15 @@ void list_del(struct list *elem)
|
||||
elem->p->n = elem->n;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove an element from existing list and insert before 'head'.
|
||||
*/
|
||||
void list_move(struct list *head, struct list *elem)
|
||||
{
|
||||
list_del(elem);
|
||||
list_add(head, elem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Is the list empty?
|
||||
*/
|
||||
|
@ -55,14 +55,9 @@ void list_add_h(struct list *head, struct list *elem);
|
||||
void list_del(struct list *elem);
|
||||
|
||||
/*
|
||||
* Move an element from an existing list to list 'head'.
|
||||
* Insert the element before 'head'.
|
||||
* Remove an element from existing list and insert before 'head'.
|
||||
*/
|
||||
static inline void list_move(struct list *item, struct list *head)
|
||||
{
|
||||
list_del(item);
|
||||
list_add(head, item);
|
||||
}
|
||||
void list_move(struct list *head, struct list *elem);
|
||||
|
||||
/*
|
||||
* Is the list empty?
|
||||
|
@ -54,7 +54,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
||||
struct list *pvh = vg_from->pvs.n;
|
||||
struct physical_volume *pv;
|
||||
|
||||
list_move(pvh, &vg_to->pvs);
|
||||
list_move(&vg_to->pvs, pvh);
|
||||
|
||||
pv = list_item(pvh, struct pv_list)->pv;
|
||||
pv->vg_name = dm_pool_strdup(cmd->mem, vg_to->name);
|
||||
@ -89,13 +89,13 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
|
||||
while (!list_empty(&vg_from->lvs)) {
|
||||
struct list *lvh = vg_from->lvs.n;
|
||||
|
||||
list_move(lvh, &vg_to->lvs);
|
||||
list_move(&vg_to->lvs, lvh);
|
||||
}
|
||||
|
||||
while (!list_empty(&vg_from->fid->metadata_areas)) {
|
||||
struct list *mdah = vg_from->fid->metadata_areas.n;
|
||||
|
||||
list_move(mdah, &vg_to->fid->metadata_areas);
|
||||
list_move(&vg_to->fid->metadata_areas, mdah);
|
||||
}
|
||||
|
||||
vg_to->lv_count += vg_from->lv_count;
|
||||
|
@ -28,7 +28,7 @@ static int _move_pv(struct volume_group *vg_from, struct volume_group *vg_to,
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_move(&pvl->list, &vg_to->pvs);
|
||||
list_move(&vg_to->pvs, &pvl->list);
|
||||
|
||||
vg_from->pv_count--;
|
||||
vg_to->pv_count++;
|
||||
@ -100,7 +100,7 @@ static int _move_one_lv(struct volume_group *vg_from,
|
||||
struct logical_volume *lv;
|
||||
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
list_move(lvh, &vg_to->lvs);
|
||||
list_move(&vg_to->lvs, lvh);
|
||||
|
||||
if (lv->status & SNAPSHOT) {
|
||||
vg_from->snapshot_count--;
|
||||
|
Loading…
Reference in New Issue
Block a user