From d27e123310c944a8f2bf905833481fc75b4b5974 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 9 Jul 2007 15:40:43 +0000 Subject: [PATCH] Add vg_mda_count and pv_mda_count columns to reports. --- WHATS_NEW | 1 + lib/report/columns.h | 2 ++ lib/report/report.c | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index eb2cde067..6d77d12e4 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.27 - ================================ + Add vg_mda_count and pv_mda_count columns to reports. Fix dumpconfig to use log_print instead of stdout directly. Remove unused parameter 'fid' from _add_pv_to_vg. Add kernel and device-mapper targets versions to lvmdump. diff --git a/lib/report/columns.h b/lib/report/columns.h index ca43509f9..c18ce8d7f 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -47,6 +47,7 @@ FIELD(PVS, pv, STR, "Attr", status, 4, pvstatus, "pv_attr", "Various attributes FIELD(PVS, pv, NUM, "PE", pe_count, 3, uint32, "pv_pe_count", "Total number of Physical Extents.") FIELD(PVS, pv, NUM, "Alloc", pe_alloc_count, 5, uint32, "pv_pe_alloc_count", "Total number of allocated Physical Extents.") FIELD(PVS, pv, STR, "PV Tags", tags, 7, tags, "pv_tags", "Tags, if any.") +FIELD(PVS, pv, NUM, "#PMda", id, 5, pvmdas, "pv_mda_count", "Number of metadata areas on this device.") FIELD(VGS, vg, STR, "Fmt", cmd, 3, vgfmt, "vg_fmt", "Type of metadata.") FIELD(VGS, vg, STR, "VG UUID", id, 38, uuid, "vg_uuid", "Unique identifier.") @@ -65,6 +66,7 @@ FIELD(VGS, vg, NUM, "#LV", lv_count, 3, uint32, "lv_count", "Number of LVs.") FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.") FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata. Incremented whenever it changes.") FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags", "Tags, if any.") +FIELD(VGS, vg, NUM, "#VMda", cmd, 5, vgmdas, "vg_mda_count", "Number of metadata areas in use by this VG.") FIELD(SEGS, seg, STR, "Type", list, 4, segtype, "segtype", "Type of LV segment") FIELD(SEGS, seg, NUM, "#Str", area_count, 4, uint32, "stripes", "Number of stripes or mirror legs.") diff --git a/lib/report/report.c b/lib/report/report.c index 30abcf72e..021d37ca5 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -718,6 +718,31 @@ static int _int32_disp(struct dm_report *rh, struct dm_pool *mem, return dm_report_field_int32(rh, field, data); } +static int _pvmdas_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + struct lvmcache_info *info; + uint32_t count; + + info = info_from_pvid((const char *)(&((struct id *) data)->uuid)); + count = list_size(&info->mdas); + + return _uint32_disp(rh, mem, field, &count, private); +} + +static int _vgmdas_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + const struct volume_group *vg = (const struct volume_group *) data; + uint32_t count; + + count = list_size(&vg->fid->metadata_areas); + + return _uint32_disp(rh, mem, field, &count, private); +} + static int _lvsegcount_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private) -- 2.43.5