Version 2.02.46 -
================================
+ Fix pvs report for orphan PVs when segment attributes are requested.
Fix pvs -a output to not read volume groups from non-PV devices.
Add MMC (mmcblk) device type to filters.
Introduce memory pools per volume group (to reduce memory for large VGs).
pvs --noheadings|tee out
test $(wc -l <out) -eq 5
+#COMM pvs with segment attributes works even for orphans
+pvs --noheadings -o seg_all,pv_all,lv_all,vg_all | tee out
+test $(wc -l <out) -eq 5
+
vgcreate -c n $vg $devs
#COMM pvs and vgs report mda_count, mda_free (bz202886, bz247444)
return ECMD_PROCESSED;
}
-static int _pvsegs_sub_single(struct cmd_context *cmd __attribute((unused)),
+static int _pvsegs_sub_single(struct cmd_context *cmd,
struct volume_group *vg,
struct pv_segment *pvseg, void *handle)
{
int ret = ECMD_PROCESSED;
struct lv_segment *seg = pvseg->lvseg;
+ struct volume_group _free_vg = {
+ .cmd = cmd,
+ .name = (char *)"",
+ };
+
struct logical_volume _free_logical_volume = {
- .vg = vg,
+ .vg = vg ?: &_free_vg,
.name = (char *) "",
.snapshot = NULL,
.status = VISIBLE_LV,
_free_lv_segment.segtype = get_segtype_from_string(cmd, "free");
_free_lv_segment.len = pvseg->len;
+ dm_list_init(&_free_vg.pvs);
+ dm_list_init(&_free_vg.lvs);
+ dm_list_init(&_free_vg.tags);
dm_list_init(&_free_lv_segment.tags);
dm_list_init(&_free_lv_segment.origin_list);
dm_list_init(&_free_logical_volume.tags);
int ret_max = ECMD_PROCESSED;
int ret;
struct volume_group *old_vg = vg;
+ struct pv_segment _free_pv_segment = { .pv = pv };
if (is_pv(pv) && !vg && !is_orphan(pv)) {
vg_name = pv_vg_name(pv);
pv = pvl->pv;
}
- dm_list_iterate_items(pvseg, &pv->segments) {
- ret = process_single(cmd, vg, pvseg, handle);
+ if (dm_list_empty(&pv->segments)) {
+ ret = process_single(cmd, NULL, &_free_pv_segment, handle);
if (ret > ret_max)
ret_max = ret;
- if (sigint_caught())
- break;
- }
+ } else
+ dm_list_iterate_items(pvseg, &pv->segments) {
+ ret = process_single(cmd, vg, pvseg, handle);
+ if (ret > ret_max)
+ ret_max = ret;
+ if (sigint_caught())
+ break;
+ }
if (vg_name)
unlock_vg(cmd, vg_name);