mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
o Similar changes for lv_list.
This commit is contained in:
parent
b926605531
commit
f868d63582
@ -374,8 +374,7 @@ int activate_lvs_in_vg(struct volume_group *vg)
|
||||
int count = 0;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
count += (!lv_active(lv) && lv_activate(lv));
|
||||
}
|
||||
|
||||
@ -405,8 +404,7 @@ int deactivate_lvs_in_vg(struct volume_group *vg)
|
||||
int count = 0;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
count += ((lv_active(lv) == 1) && lv_deactivate(lv));
|
||||
}
|
||||
|
||||
@ -420,8 +418,7 @@ int lvs_in_vg_activated(struct volume_group *vg)
|
||||
int count = 0;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
count += (lv_active(lv) == 1);
|
||||
}
|
||||
|
||||
@ -435,8 +432,7 @@ int lvs_in_vg_opened(struct volume_group *vg)
|
||||
int count = 0;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
count += (lv_open_count(lv) == 1);
|
||||
}
|
||||
|
||||
|
@ -341,16 +341,17 @@ static struct logical_volume *_add_lv(struct pool *mem,
|
||||
struct volume_group *vg,
|
||||
struct lv_disk *lvd)
|
||||
{
|
||||
struct lv_list *ll = pool_zalloc(mem, sizeof(*ll));
|
||||
struct lv_list *ll;
|
||||
struct logical_volume *lv;
|
||||
|
||||
if (!ll) {
|
||||
if (!(ll = pool_zalloc(mem, sizeof(*ll))) ||
|
||||
!(ll->lv = pool_zalloc(mem, sizeof(*ll->lv)))) {
|
||||
stack;
|
||||
return NULL;
|
||||
}
|
||||
lv = &ll->lv;
|
||||
lv = ll->lv;
|
||||
|
||||
if (!import_lv(mem, &ll->lv, lvd)) {
|
||||
if (!import_lv(mem, lv, lvd)) {
|
||||
stack;
|
||||
return NULL;
|
||||
}
|
||||
@ -413,9 +414,9 @@ int export_lvs(struct disk_list *dl, struct volume_group *vg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
export_lv(&lvdl->lvd, vg, &ll->lv, dev_dir);
|
||||
export_lv(&lvdl->lvd, vg, ll->lv, dev_dir);
|
||||
lvdl->lvd.lv_number = lv_num;
|
||||
if (!export_extents(dl, lv_num + 1, &ll->lv, pv)) {
|
||||
if (!export_extents(dl, lv_num + 1, ll->lv, pv)) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ static struct hash_table *_create_lv_maps(struct pool *mem,
|
||||
goto bad;
|
||||
}
|
||||
|
||||
lvm->lv = &ll->lv;
|
||||
lvm->lv = ll->lv;
|
||||
if (!(lvm->map = pool_zalloc(mem, sizeof(*lvm->map)
|
||||
* ll->lv.le_count))) {
|
||||
* ll->lv->le_count))) {
|
||||
stack;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if (!hash_insert(maps, ll->lv.name, lvm)) {
|
||||
if (!hash_insert(maps, ll->lv->name, lvm)) {
|
||||
stack;
|
||||
goto bad;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ static int _print_lvs(struct formatter *f, struct volume_group *vg)
|
||||
_inc_indent(f);
|
||||
|
||||
list_iterate (lvh, &vg->lvs) {
|
||||
lv = &list_item(lvh, struct lv_list)->lv;
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
|
||||
_out(f, "%s {", lv->name);
|
||||
_inc_indent(f);
|
||||
|
@ -339,12 +339,13 @@ static int _read_lv(struct pool *mem,
|
||||
struct lv_list *lvl;
|
||||
struct config_node *cn;
|
||||
|
||||
if (!(lvl = pool_zalloc(mem, sizeof(*lvl)))) {
|
||||
if (!(lvl = pool_zalloc(mem, sizeof(*lvl))) ||
|
||||
!(lvl->lv = pool_zalloc(mem, sizeof(*lvl->lv)))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv = &lvl->lv;
|
||||
lv = lvl->lv;
|
||||
|
||||
if (!(lv->name = pool_strdup(mem, lvn->key))) {
|
||||
stack;
|
||||
|
@ -345,7 +345,7 @@ static char *_generate_lv_name(struct volume_group *vg,
|
||||
int high = -1, i;
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
lv = (list_item(lvh, struct lv_list)->lv);
|
||||
|
||||
if (sscanf(lv->name, "lvol%d", &i) != 1)
|
||||
continue;
|
||||
@ -413,7 +413,7 @@ struct logical_volume *lv_create(const char *name,
|
||||
|
||||
list_init(&ll->list);
|
||||
|
||||
lv = &ll->lv;
|
||||
lv = ll->lv;
|
||||
|
||||
strcpy(lv->id.uuid, "");
|
||||
|
||||
|
@ -262,7 +262,7 @@ struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name)
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lvl = list_item(lvh, struct lv_list);
|
||||
if (!strcmp(lvl->lv.name, ptr))
|
||||
if (!strcmp(lvl->lv->name, ptr))
|
||||
return lvl;
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name)
|
||||
struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name)
|
||||
{
|
||||
struct lv_list *lvl = find_lv_in_vg(vg, lv_name);
|
||||
return lvl ? &lvl->lv : NULL;
|
||||
return lvl ? lvl->lv : NULL;
|
||||
}
|
||||
|
||||
struct physical_volume *find_pv(struct volume_group *vg, struct device *dev)
|
||||
|
@ -140,7 +140,7 @@ struct pv_list {
|
||||
|
||||
struct lv_list {
|
||||
struct list list;
|
||||
struct logical_volume lv;
|
||||
struct logical_volume *lv;
|
||||
};
|
||||
|
||||
struct cmd_context {
|
||||
|
@ -92,7 +92,7 @@ static int _fill_bitsets(struct volume_group *vg, struct list *maps)
|
||||
|
||||
/* iterate through all the lv's setting bit's for used pe's */
|
||||
list_iterate (lvh, &vg->lvs) {
|
||||
lv = &(list_item(lvh, struct lv_list)->lv);
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
|
||||
list_iterate (segh, &lv->segments) {
|
||||
seg = list_item(segh, struct stripe_segment);
|
||||
|
@ -24,7 +24,6 @@ int lvcreate(int argc, char **argv)
|
||||
struct volume_group *vg;
|
||||
struct logical_volume *lv;
|
||||
struct list *pvh;
|
||||
struct pv_list *pvl;
|
||||
char *lv_name = NULL;
|
||||
char *vg_name;
|
||||
char *st;
|
||||
|
@ -102,7 +102,7 @@ int lvrename(int argc, char **argv)
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
lv = &lvl->lv;
|
||||
lv = lvl->lv;
|
||||
|
||||
if (!archive(lv->vg))
|
||||
return ECMD_FAILED;
|
||||
|
@ -114,7 +114,7 @@ int lvresize(int argc, char **argv)
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
lv = &lvl->lv;
|
||||
lv = lvl->lv;
|
||||
|
||||
if (size) {
|
||||
/* No of 512-byte sectors */
|
||||
|
@ -46,7 +46,7 @@ int process_each_lv_in_vg(struct volume_group *vg,
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = &list_item(lvh, struct lv_list)->lv;
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
ret = process_single(lv);
|
||||
if (ret > ret_max)
|
||||
ret_max = ret;
|
||||
@ -101,7 +101,7 @@ int process_each_lv(int argc, char **argv,
|
||||
continue;
|
||||
}
|
||||
|
||||
lv = &lvl->lv;
|
||||
lv = lvl->lv;
|
||||
|
||||
if ((ret = process_single(lv)) > ret_max)
|
||||
ret_max = ret;
|
||||
|
@ -70,7 +70,7 @@ int vgmerge_single(const char *vg_name_to, const char *vg_name_from)
|
||||
}
|
||||
|
||||
if ((active = lvs_in_vg_activated(vg_from))) {
|
||||
log_error("Logical volumes in %s must be inactive",
|
||||
log_error("Logical volumes in %s must be inactive",
|
||||
vg_name_from);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
@ -100,8 +100,11 @@ int vgmerge_single(const char *vg_name_to, const char *vg_name_from)
|
||||
/* Check no conflicts with LV names */
|
||||
list_iterate(lvh1, &vg_to->lvs) {
|
||||
list_iterate(lvh2, &vg_from->lvs) {
|
||||
char *name1 = list_item(lvh1, struct lv_list)->lv.name;
|
||||
char *name2 = list_item(lvh2, struct lv_list)->lv.name;
|
||||
char *name1 = list_item(lvh1,
|
||||
struct lv_list)->lv->name;
|
||||
|
||||
char *name2 = list_item(lvh2,
|
||||
struct lv_list)->lv->name;
|
||||
if (!strcmp(name1, name2)) {
|
||||
log_error("Duplicate logical volume name %s "
|
||||
"in %s and %s", name1, vg_to->name,
|
||||
|
Loading…
Reference in New Issue
Block a user