From: Alasdair Kergon Date: Fri, 23 Sep 2005 17:06:01 +0000 (+0000) Subject: Fix chunksize field in reports. X-Git-Tag: v2_02_91~4762 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=88d2bdc66857402fd7ed024ca3c88cf2e0486ba2;p=lvm2.git Fix chunksize field in reports. --- diff --git a/WHATS_NEW b/WHATS_NEW index 95d7ec454..286d3cb48 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.01.15 - ================================= + Fix chunksize field in reports. Don't hide snapshots from default 'lvs' output. Add is_dm_major() for use in duplicate device detection in lvmcache_add(). Really switch device number in lvmcache when it says it is doing so. diff --git a/lib/report/columns.h b/lib/report/columns.h index 3207f78d0..9ff748e91 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -49,7 +49,7 @@ FIELD(PVS, pv, STR, "PV Tags", tags, 7, tags, "pv_tags") FIELD(VGS, vg, STR, "Fmt", cmd, 3, vgfmt, "vg_fmt") FIELD(VGS, vg, STR, "VG UUID", id, 38, uuid, "vg_uuid") FIELD(VGS, vg, STR, "VG", name, 4, string, "vg_name") -FIELD(VGS, vg, STR, "Attr", cmd, 6, vgstatus, "vg_attr") +FIELD(VGS, vg, STR, "Attr", cmd, 5, vgstatus, "vg_attr") FIELD(VGS, vg, NUM, "VSize", cmd, 5, vgsize, "vg_size") FIELD(VGS, vg, NUM, "VFree", cmd, 5, vgfree, "vg_free") FIELD(VGS, vg, STR, "SYS ID", system_id, 6, string, "vg_sysid") @@ -67,7 +67,7 @@ FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags") FIELD(SEGS, seg, STR, "Type", list, 4, segtype, "segtype") FIELD(SEGS, seg, NUM, "#Str", area_count, 4, uint32, "stripes") FIELD(SEGS, seg, NUM, "Stripe", stripe_size, 6, size32, "stripesize") -FIELD(SEGS, seg, NUM, "Chunk", chunk_size, 5, size32, "chunksize") +FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, "chunksize") FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, "regionsize") FIELD(SEGS, seg, NUM, "Start", list, 5, segstart, "seg_start") FIELD(SEGS, seg, NUM, "SSize", list, 5, segsize, "seg_size") diff --git a/lib/report/report.c b/lib/report/report.c index d4f6129f5..2e9206c89 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -660,6 +660,21 @@ static int _segsize_disp(struct report_handle *rh, struct field *field, return _size64_disp(rh, field, &size); } +static int _chunksize_disp(struct report_handle *rh, struct field *field, + const void *data) +{ + const struct lv_segment *seg = (const struct lv_segment *) data; + struct lv_segment *snap_seg; + uint64_t size; + + if ((snap_seg = find_cow(seg->lv))) + size = (uint64_t) snap_seg->chunk_size; + else + size = 0; + + return _size64_disp(rh, field, &size); +} + static int _pvused_disp(struct report_handle *rh, struct field *field, const void *data) { diff --git a/tools/reporter.c b/tools/reporter.c index 4cee509cc..d7ab9ccf7 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -83,7 +83,9 @@ static int _pvsegs_sub_single(struct cmd_context *cmd, struct volume_group *vg, static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle) { - if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV)) + /* FIXME Avoid snapshot special-case */ + if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) && + !(lv_is_cow(lv))) return ECMD_PROCESSED; return process_each_segment_in_lv(cmd, lv, handle, _segs_single);