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