1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-28 05:57:49 +03:00

Add add_pvl_to_vgs() - helper function to add a pv to a vg list.

Small refactor of main places in the code where a pv is added to a
vg into a small function which adds the pv to the list and updates
the vg counts.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-04-06 14:04:54 +00:00
parent 4eae19ed75
commit ae2353caf8
4 changed files with 11 additions and 7 deletions

View File

@ -437,8 +437,7 @@ int import_pvs(const struct format_type *fmt, struct dm_pool *mem,
return_0;
pvl->pv->fmt = fmt;
dm_list_add(&vg->pvs, &pvl->list);
vg->pv_count++;
add_pvl_to_vgs(vg, pvl);
}
return 1;

View File

@ -271,8 +271,7 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
vg->extent_count += pv->pe_count;
vg->free_count += pv->pe_count;
vg->pv_count++;
dm_list_add(&vg->pvs, &pvl->list);
add_pvl_to_vgs(vg, pvl);
return 1;
}

View File

@ -136,6 +136,13 @@ out:
return pv->pe_align_offset;
}
void add_pvl_to_vgs(struct volume_group *vg, struct pv_list *pvl)
{
dm_list_add(&vg->pvs, &pvl->list);
vg->pv_count++;
}
/**
* add_pv_to_vg - Add a physical volume to a volume group
* @vg - volume group to add to
@ -230,9 +237,7 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
}
pvl->pv = pv;
dm_list_add(&vg->pvs, &pvl->list);
vg->pv_count++;
add_pvl_to_vgs(vg, pvl);
vg->extent_count += pv->pe_count;
vg->free_count += pv->pe_count;

View File

@ -377,5 +377,6 @@ struct id pv_vgid(const struct physical_volume *pv);
struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name);
int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
struct physical_volume *pv);
void add_pvl_to_vgs(struct volume_group *vg, struct pv_list *pvl);
#endif