diff options
author | David Teigland <teigland@redhat.com> | 2022-02-21 16:09:57 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2022-02-21 16:11:13 -0600 |
commit | ac1f4bbbfd4c5f1387c3e0607f7d556409e7a4b4 (patch) | |
tree | 187f0b45766f39f5bd684467fbfcc82f8554e6da /lib/report | |
parent | 6144dac897728a4857294d70645df8ed7a5ff11f (diff) | |
download | lvm2-ac1f4bbbfd4c5f1387c3e0607f7d556409e7a4b4.tar.gz |
writecache: display block size from lvs
lvs was missing the ability to display writecache block size.
now possible with lvs -o writecache_block_size
Diffstat (limited to 'lib/report')
-rw-r--r-- | lib/report/columns.h | 1 | ||||
-rw-r--r-- | lib/report/properties.c | 2 | ||||
-rw-r--r-- | lib/report/report.c | 20 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/report/columns.h b/lib/report/columns.h index 12b78b766..7e450dace 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -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 */ diff --git a/lib/report/properties.c b/lib/report/properties.c index 12ea890f4..6f302360f 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -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 diff --git a/lib/report/report.c b/lib/report/report.c index 60df417a4..c06b22674 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -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) |