From ece1fe835cc2982813b168d17687069e9b03baaf Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 11 Oct 2001 13:05:55 +0000 Subject: [PATCH] o vg->pv_act --- lib/format1/disk-rep.h | 1 + lib/format1/format1.c | 2 ++ lib/format1/import-export.c | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h index 7882c5fa4..42b44dd56 100644 --- a/lib/format1/disk-rep.h +++ b/lib/format1/disk-rep.h @@ -218,5 +218,6 @@ int export_uuids(struct disk_list *dl, struct volume_group *vg); void export_numbers(struct list_head *pvs, struct volume_group *vg); +void export_pv_act(struct list_head *pvs); #endif diff --git a/lib/format1/format1.c b/lib/format1/format1.c index 2fccbc3c4..ba94d6fce 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -151,6 +151,8 @@ static int _flatten_vg(struct pool *mem, struct volume_group *vg, } export_numbers(pvs, vg); + export_pv_act(pvs); + return 1; } diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c index 73c520dac..189dcf020 100644 --- a/lib/format1/import-export.c +++ b/lib/format1/import-export.c @@ -231,8 +231,6 @@ int export_vg(struct vg_disk *vgd, struct volume_group *vg) vgd->pv_max = vg->max_pv; vgd->pv_cur = vg->pv_count; - //vgd->pv_act = ???; - vgd->pe_size = vg->extent_size; vgd->pe_total = vg->extent_count; vgd->pe_allocated = vg->extent_count - vg->free_count; @@ -566,3 +564,24 @@ void export_numbers(struct list_head *pvs, struct volume_group *vg) } } } + +/* + * Calculate vg_disk->pv_act. + */ +void export_pv_act(struct list_head *pvs) +{ + struct list_head *tmp; + struct disk_list *dl; + int act = 0; + + list_for_each (tmp, pvs) { + dl = list_entry(tmp, struct disk_list, list); + if (dl->pv.pv_status & PV_ACTIVE) + act++; + } + + list_for_each (tmp, pvs) { + dl = list_entry(tmp, struct disk_list, list); + dl->vg.pv_act = act; + } +} -- 2.43.5