Skip to contentSkip to conversation

master - writecache: cachesettings in lvchange and lvs

PATCH David Teigland 1 participant 1 message Jun 10, 2020

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1ee42f13915d852008b1e7b777edee766413ef89
Commit:        1ee42f13915d852008b1e7b777edee766413ef89
Parent:        ce772bfab976d89f6a35a442434d1a49ceb634c7
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Feb 26 14:47:29 2020 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jun 10 12:14:00 2020 -0500

writecache: cachesettings in lvchange and lvs

lvchange --cachesettings
lvs -o+cache_settings

---
 lib/metadata/metadata-exported.h |   1 +
 lib/metadata/writecache_manip.c  |  70 ++++++++++++++++++
 lib/report/report.c              |  10 +++
 tools/command-lines.in           |   2 +-
 tools/lvchange.c                 |  75 +++++++++++++++++++
 tools/lvconvert.c                | 153 +--------------------------------------
 tools/toollib.c                  | 150 ++++++++++++++++++++++++++++++++++++++
 tools/toollib.h                  |   3 +
 8 files changed, 311 insertions(+), 153 deletions(-)
lib/metadata/metadata-exported.h +1 -0
index 9de088437..0d6be136b 100644
@@ -1096,6 +1096,7 @@ int lv_is_cow(const struct logical_volume *lv);
 int lv_is_cache_origin(const struct logical_volume *lv);
 int lv_is_writecache_origin(const struct logical_volume *lv);
 int lv_is_writecache_cachevol(const struct logical_volume *lv);
+int writecache_settings_to_str_list(struct writecache_settings *settings, struct dm_list *result, struct dm_pool *mem);
 
 int lv_is_integrity_origin(const struct logical_volume *lv);
 
lib/metadata/writecache_manip.c +70 -0

79 lines not on this page · raw message

lib/report/report.c +10 -0
index e1c630576..268bed61b 100644
@@ -1430,6 +1430,16 @@ static int _cache_settings_disp(struct dm_report *rh, struct dm_pool *mem,
 	struct _str_list_append_baton baton;
 	struct dm_list dummy_list; /* dummy list to display "nothing" */
 
+	if (seg_is_writecache(seg)) {
+		if (!(result = str_list_create(mem)))
+			return_0;
+
+		if (!writecache_settings_to_str_list(&seg->writecache_settings, result, mem))
+			return_0;
+
+		return _field_set_string_list(rh, field, result, private, 0, NULL);
+	}
+
 	if (seg_is_cache(seg) && lv_is_cache_vol(seg->pool_lv))
 		setting_seg = seg;
 
tools/command-lines.in +1 -1
index ed3d0413a..98044a918 100644
@@ -247,7 +247,7 @@ RULE: --profile not --detachprofile
 RULE: --metadataprofile not --detachprofile
 RULE: --minrecoveryrate --maxrecoveryrate and LV_raid
 RULE: --writebehind --writemostly and LV_raid1
-RULE: --cachemode --cachepolicy --cachesettings and LV_cache LV_cachepool
+RULE: --cachemode --cachepolicy --cachesettings and LV_cache LV_cachepool LV_writecache
 RULE: --errorwhenfull --discards --zero and LV_thinpool
 RULE: --permission not lv_is_external_origin lv_is_raid_metadata lv_is_raid_image LV_thinpool
 RULE: --alloc --contiguous --metadataprofile --permission --persistent --profile --readahead not lv_is_thick_origin
tools/lvchange.c +75 -0

87 lines not on this page · raw message

tools/lvconvert.c +1 -152

165 lines not on this page · raw message

tools/toollib.c +150 -0

156 lines not on this page · raw message

tools/toollib.h +3 -0
index 53a5e5b4f..f3a60fbc4 100644
@@ -217,6 +217,9 @@ int get_cache_params(struct cmd_context *cmd,
 		     const char **name,
 		     struct dm_config_tree **settings);
 
+int get_writecache_settings(struct cmd_context *cmd, struct writecache_settings *settings,
+                            uint32_t *block_size_sectors);
+
 int change_tag(struct cmd_context *cmd, struct volume_group *vg,
 	       struct logical_volume *lv, struct physical_volume *pv, int arg);