main - writecache: display block size from lvs
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ac1f4bbbfd4c5f1387c3e0607f7d556409e7a4b4 Commit: ac1f4bbbfd4c5f1387c3e0607f7d556409e7a4b4 Parent: 6144dac897728a4857294d70645df8ed7a5ff11f Author: David Teigland <[email protected]> AuthorDate: Mon Feb 21 16:09:57 2022 -0600 Committer: David Teigland <[email protected]> CommitterDate: Mon Feb 21 16:11:13 2022 -0600
writecache: display block size from lvs
lvs was missing the ability to display writecache block size. now possible with lvs -o writecache_block_size
--- lib/report/columns.h | 1 + lib/report/properties.c | 2 ++ lib/report/report.c | 20 ++++++++++++++++++++ man/lvmcache.7_main | 4 ++++ test/shell/writecache-cache-blocksize.sh | 2 ++ 5 files changed, 29 insertions(+)
lib/report/columns.h +1 -0
@@ -108,6 +108,7 @@ FIELD(LVS, lv, TIM, "RTime", lvid, 26, lvtimeremoved, lv_time_removed, "Removal FIELD(LVS, lv, STR, "Host", lvid, 10, lvhost, lv_host, "Creation host of the LV, if known.", 0) FIELD(LVS, lv, STR_LIST, "Modules", lvid, 0, modules, lv_modules, "Kernel device-mapper modules required for this LV.", 0) FIELD(LVS, lv, BIN, "Historical", lvid, 0, lvhistorical, lv_historical, "Set if the LV is historical.", 0) +FIELD (LVS , lv,NUM ,"WCacheBlkSize" , lvid,0 , writecache_block_size, writecache_block_size,"The writecache block size" ,0 )/* * End of LVS type fields */
lib/report/properties.c +2 -0
@@ -353,6 +353,8 @@ GET_PV_STR_PROPERTY_FN(pv_device_id_type, pv->device_id_type)#define _writecache_writeback_blocks_get prop_not_implemented_get#define _writecache_error_set prop_not_implemented_set#define _writecache_error_get prop_not_implemented_get +#define _writecache_block_size_set prop_not_implemented_set +#define _writecache_block_size_get prop_not_implemented_get#define _vdo_operating_mode_set prop_not_implemented_set#define _vdo_operating_mode_get prop_not_implemented_get
lib/report/report.c +20 -0
@@ -3346,6 +3346,26 @@ static int _integritymismatches_disp(struct dm_report *rh __attribute__((unused)return _field_set_value (field,"" , &GET_TYPE_RESERVED_VALUE (num_undef_64)); } +static int _writecache_block_size_disp (struct dm_report *rh __attribute__((unused)), +struct dm_pool *mem, +struct dm_report_field *field, +const void *data, +void *private __attribute__((unused))) +{ +struct logical_volume *lv = (struct logical_volume *) data; +uint32_t bs =0 ; + +if (lv_is_writecache (lv)) { +struct lv_segment *seg =first_seg (lv); + bs = seg->writecache_block_size; + } + +if (!bs) +return dm_report_field_int32 (rh, field, &GET_TYPE_RESERVED_VALUE (num_undef_32)); + +return dm_report_field_uint32 (rh, field, &bs); +} +static int _datapercent_disp (struct dm_report *rh,struct dm_pool *mem,struct dm_report_field *field,const void *data,void *private)
man/lvmcache.7_main +4 -0
@@ -241,6 +241,10 @@ It is also possible to specify a sector size of 4096 to mkfs.xfs when creating the file system. In this case the writecache block size of 4096 can be used. .P +The writecache block size is displayed by the command: +.br +lvs -o writecacheblocksize VG/LV +.P .SS dm-writecache memory usage .P The amount of main system memory used by dm-writecache can be a factor
test/shell/writecache-cache-blocksize.sh +2 -0
@@ -222,6 +222,8 @@ vgextend $vg "$dev2" lvcreate -n $lv1 -l 8 -an $vg "$dev1" lvcreate -n $lv2 -l 4 -an $vg "$dev2" lvconvert --yes --type writecache --cachevol $lv2 --cachesettings "block_size=4096" $vg/$lv1 +lvs -o writecacheblocksize $vg/$lv1 |tee out +grep 4096 out lvchange -ay $vg/$lv1 mkfs.xfs -f "$DM_DEV_DIR/$vg/$lv1" |tee out grep "sectsz=4096" out