LVM2/lib config/defaults.h metadata/lv.c metad ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-01-19 15:34:33
Modified files:
lib/config : defaults.h lib/metadata : lv.c lv.h lib/report : columns.h properties.c report.c
Log message:
Thin add new display field for lvs
New field Data% is able to display info about thin_pool, thin, snapshot and has generic meaning here.
Simple Time/Host field are here to display host and time creation.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.92&r2=1.93
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv.h.diff?cvsroot=lvm2&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.48&r2=1.49
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/properties.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.147&r2=1.148
lib/config/defaults.h +3 -3
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -148,13 +148,13 @@#define DEFAULT_REP_QUOTED 1#define DEFAULT_REP_SEPARATOR " " -#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,thin_pool,origin,snap_percent,move_pv,mirror_log,copy_percent,convert_lv" +#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv"#define DEFAULT_VGS_COLS "vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"#define DEFAULT_PVS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"#define DEFAULT_SEGS_COLS "lv_name,vg_name,lv_attr,stripes,segtype,seg_size"#define DEFAULT_PVSEGS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size" -#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,thin_pool,origin,snap_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid" +#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid"#define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid"#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"#define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
lib/metadata/lv.c +21 -1
@@ -1,6 +1,6 @@/* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. -* Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved. +* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -129,8 +129,11 @@if (lv_is_cow (seg->lv)) size = (uint64_t )find_cow (seg->lv)->chunk_size; +else if (lv_is_thin_pool (seg->lv)) + size = (uint64_t ) seg->data_block_size;else size =UINT64_C (0 ); +return size; }
@@ -203,6 +206,18 @@return NULL ; } +char *lv_data_lv_dup (struct dm_pool *mem,const struct logical_volume *lv) +{ +return lv_is_thin_pool (lv) ? +dm_pool_strdup (mem,seg_lv (first_seg (lv),0 )->name) :NULL ; +} + +char *lv_metadata_lv_dup (struct dm_pool *mem,const struct logical_volume *lv) +{ +return lv_is_thin_pool (lv) ? +dm_pool_strdup (mem,first_seg (lv)->metadata_lv->name) :NULL ; +} +int lv_kernel_minor (const struct logical_volume *lv) {struct lvinfo info;
@@ -255,6 +270,11 @@return 0 ; } +uint64_t lv_metadata_size (const struct logical_volume *lv) +{ +return lv_is_thin_pool (lv) ?first_seg (lv)->metadata_lv->size :0 ; +} +char *lv_path_dup (struct dm_pool *mem,const struct logical_volume *lv) {char *repstr;
lib/metadata/lv.h +3 -0
@@ -52,6 +52,7 @@ };uint64_t lv_size (const struct logical_volume *lv); +uint64_t lv_metadata_size (const struct logical_volume *lv);char *lv_attr_dup (struct dm_pool *mem,const struct logical_volume *lv);char *lv_uuid_dup (const struct logical_volume *lv);char *lv_tags_dup (const struct logical_volume *lv);
@@ -62,6 +63,8 @@int lv_kernel_major (const struct logical_volume *lv);int lv_kernel_minor (const struct logical_volume *lv);char *lv_mirror_log_dup (struct dm_pool *mem,const struct logical_volume *lv); +char *lv_data_lv_dup (struct dm_pool *mem,const struct logical_volume *lv); +char *lv_metadata_lv_dup (struct dm_pool *mem,const struct logical_volume *lv);char *lv_pool_lv_dup (struct dm_pool *mem,const struct logical_volume *lv);char *lv_modules_dup (struct dm_pool *mem,const struct logical_volume *lv);char *lv_name_dup (struct dm_pool *mem,const struct logical_volume *lv);
lib/report/columns.h +12 -2
@@ -71,16 +71,23 @@ FIELD(LVS, lv, STR, "KMin", lvid, 4, lvkmin, lv_kernel_minor, "Currently assigned minor number or -1 if LV is not active.", 0) FIELD(LVS, lv, NUM, "KRahead", lvid, 7, lvkreadahead, lv_kernel_read_ahead, "Currently-in-use read ahead setting in current units.", 0) FIELD(LVS, lv, NUM, "LSize", size, 5, size64, lv_size, "Size of LV in current units.", 0) +FIELD(LVS, lv, NUM, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thin pools, the size of the LV that holds the metadata.", 0) FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments in LV.", 0) FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, origin, "For snapshots, the origin device of this LV.", 0) FIELD(LVS, lv, NUM, "OSize", lvid, 5, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0) +FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) +FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, copy_percent, "For mirrors and pvmove, current percentage in-sync.", 0) FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0) FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0) -FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0) FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0) -FIELD(LVS, lv, STR, "Pool", lvid, 4, poollv, thin_pool, "For thinly-provisioned devices, the pool LV holding the data.", 0) +FIELD(LVS, lv, STR, "Data", lvid, 4, datalv, data_lv, "For thin pools, the LV holding the associated data.", 0) +FIELD(LVS, lv, STR, "Meta", lvid, 4, metadatalv, metadata_lv, "For thin pools, the LV holding the associated metadata.", 0) +FIELD(LVS, lv, STR, "Pool", lvid, 4, poollv, pool_lv, "For thin volumes, the thin pool LV for this volume.", 0) +FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0) +FIELD(LVS, lv, STR, "Time", lvid, 26, lvtime, lv_time, "Creation time of the LV, if known", 0) +FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) FIELD(LVS, lv, STR, "Modules", lvid, 7, modules, modules, "Kernel device-mapper modules required for this LV.", 0)FIELD (LABEL , pv,STR ,"Fmt" , id,3 , pvfmt, pv_fmt,"Type of metadata." ,0 )
@@ -132,6 +139,9 @@ FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, region_size, "For mirrors, the unit of data copied when synchronising devices.", 0) FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, chunksize, "For snapshots, the unit of data used when tracking changes.", 0) FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, chunk_size, "For snapshots, the unit of data used when tracking changes.", 0) +FIELD(SEGS, seg, NUM, "#Thins", list, 4, thincount, thin_count, "For thin pools, the number of thin volumes in this pool.", 0) +FIELD(SEGS, seg, NUM, "Zero", list, 4, thinzero, zero, "For thin pools, if zeroing is enabled.", 0) +FIELD(SEGS, seg, NUM, "TransId", list, 4, transactionid, transaction_id, "For thin pools, the transaction id.", 0) FIELD(SEGS, seg, NUM, "Start", list, 5, segstart, seg_start, "Offset within the LV to the start of the segment in current units.", 0) FIELD(SEGS, seg, NUM, "Start", list, 5, segstartpe, seg_start_pe, "Offset within the LV to the start of the segment in physical extents.", 0)FIELD (SEGS , seg,NUM ,"SSize" , list,5 , segsize, seg_size,"Size of segment in current units." ,0 )
lib/report/properties.c +37 -3
@@ -1,5 +1,5 @@/* -* Copyright (C) 2010 Red Hat, Inc. All rights reserved. +* Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. *
@@ -100,6 +100,20 @@return perc; } +static percent_t _data_percent (const struct logical_volume *lv) +{ +percent_t perc; + +return lv_thin_pool_percent (lv,0 , &perc) ? perc :PERCENT_INVALID ; +} + +static percent_t _metadata_percent (const struct logical_volume *lv) +{ +percent_t perc; + +return lv_thin_pool_percent (lv,1 , &perc) ? perc :PERCENT_INVALID ; +} +/* PV */ GET_PV_STR_PROPERTY_FN(pv_fmt, pv_fmt_dup(pv))#define _pv_fmt_set _not_implemented_set
@@ -175,10 +189,24 @@#define _lv_tags_set _not_implemented_set GET_LV_STR_PROPERTY_FN(mirror_log, lv_mirror_log_dup(lv->vg->vgmem, lv))#define _mirror_log_set _not_implemented_set -GET_LV_STR_PROPERTY_FN(thin_pool, lv_pool_lv_dup(lv->vg->vgmem, lv)) -#define _thin_pool_set _not_implemented_set GET_LV_STR_PROPERTY_FN(modules, lv_modules_dup(lv->vg->vgmem, lv))#define _modules_set _not_implemented_set +GET_LV_STR_PROPERTY_FN(data_lv, lv_data_lv_dup(lv->vg->vgmem, lv)) +#define _data_lv_set _not_implemented_set +GET_LV_STR_PROPERTY_FN(metadata_lv, lv_metadata_lv_dup(lv->vg->vgmem, lv)) +#define _metadata_lv_set _not_implemented_set +GET_LV_STR_PROPERTY_FN(pool_lv, lv_pool_lv_dup(lv->vg->vgmem, lv)) +#define _pool_lv_set _not_implemented_set +GET_LV_NUM_PROPERTY_FN(data_percent, _data_percent(lv)) +#define _data_percent_set _not_implemented_set +GET_LV_NUM_PROPERTY_FN(metadata_percent, _metadata_percent(lv)) +#define _metadata_percent_set _not_implemented_set +GET_LV_NUM_PROPERTY_FN(lv_metadata_size, lv_metadata_size(lv) * SECTOR_SIZE) +#define _lv_metadata_size_set _not_implemented_set +GET_LV_STR_PROPERTY_FN(lv_time, lv_time_dup(lv->vg->vgmem, lv)) +#define _lv_time_set _not_implemented_set +GET_LV_STR_PROPERTY_FN(lv_host, lv_host_dup(lv->vg->vgmem, lv)) +#define _lv_host_set _not_implemented_set/* VG */ GET_VG_STR_PROPERTY_FN (vg_fmt,vg_fmt_dup (vg))
@@ -243,6 +271,12 @@#define _chunksize_set _not_implemented_set GET_LVSEG_NUM_PROPERTY_FN(chunk_size, lvseg_chunksize(lvseg))#define _chunk_size_set _not_implemented_set +GET_LVSEG_NUM_PROPERTY_FN(thin_count, dm_list_size(&lvseg->lv->segs_using_this_lv)) +#define _thin_count_set _not_implemented_set +GET_LVSEG_NUM_PROPERTY_FN(zero, lvseg->zero_new_blocks) +#define _zero_set _not_implemented_set +GET_LVSEG_NUM_PROPERTY_FN(transaction_id, lvseg->transaction_id) +#define _transaction_id_set _not_implemented_set GET_LVSEG_NUM_PROPERTY_FN(seg_start, lvseg_start(lvseg))#define _seg_start_set _not_implemented_setGET_LVSEG_NUM_PROPERTY_FN (seg_start_pe, lvseg->le)
lib/report/report.c +240 -28
309 lines not on this page · raw message