Skip to contentSkip to conversation

master - vdo_manip: parsing status of VDO device

PATCH Zdenek Kabelac 1 participant 1 message Jul 9, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0dafd159a862aa76a950a3568eba32a73c0422cc
Commit:        0dafd159a862aa76a950a3568eba32a73c0422cc
Parent:        aa63dfbe39860f04d8965e2afc4959cd20988411
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Jul 2 17:20:30 2018 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Jul 9 15:28:35 2018 +0200

vdo_manip: parsing status of VDO device

---
 lib/activate/activate.h          |    2 +
 lib/activate/dev_manager.c       |    4 ++
 lib/metadata/metadata-exported.h |   10 +++++
 lib/metadata/vdo_manip.c         |   83 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 0 deletions(-)
lib/activate/activate.h +2 -0
index 09cd688..6d70f64 100644
@@ -37,6 +37,7 @@ typedef enum {
 	SEG_STATUS_SNAPSHOT,
 	SEG_STATUS_THIN,
 	SEG_STATUS_THIN_POOL,
+	SEG_STATUS_VDO_POOL,
 	SEG_STATUS_UNKNOWN
 } lv_seg_status_type_t;
 
@@ -50,6 +51,7 @@ struct lv_seg_status {
 		struct dm_status_snapshot *snapshot;
 		struct dm_status_thin *thin;
 		struct dm_status_thin_pool *thin_pool;
+		struct lv_status_vdo vdo_pool;
 	};
 };
 
lib/activate/dev_manager.c +4 -0
index 07fc93e..25d5e69 100644
@@ -209,6 +209,10 @@ static int _get_segment_status_from_target_params(const char *target_name,
 		if (!dm_get_status_snapshot(seg_status->mem, params, &seg_status->snapshot))
 			return_0;
 		seg_status->type = SEG_STATUS_SNAPSHOT;
+	} else if (segtype_is_vdo_pool(segtype)) {
+		if (!parse_vdo_pool_status(seg_status->mem, seg->lv, params, &seg_status->vdo_pool))
+			return_0;
+		seg_status->type = SEG_STATUS_VDO_POOL;
 	} else
 		/*
 		 * TODO: Add support for other segment types too!
lib/metadata/metadata-exported.h +10 -0
index b221139..b6ac4cb 100644
@@ -1250,11 +1250,21 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv);
 
 
 /* ++  metadata/vdo_manip.c */
+struct lv_status_vdo {
+	struct dm_pool *mem;
+	struct dm_vdo_status *vdo;
+	uint64_t data_blocks_used;	/* grabbed from /sys/kvdo */
+	uint64_t logical_blocks_used;	/* grabbed from /sys/kvdo */
+	dm_percent_t usage;
+	dm_percent_t saving;
+};
 
 const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state);
 const char *get_vdo_index_state_name(enum dm_vdo_index_state state);
 const char *get_vdo_operating_mode_name(enum dm_vdo_operating_mode mode);
 uint64_t get_vdo_pool_virtual_size(const struct lv_segment *vdo_pool_seg);
+int parse_vdo_pool_status(struct dm_pool *mem, const struct logical_volume *vdo_pool_lv,
+			  const char *params, struct lv_status_vdo *status);
 struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv,
 					   const struct dm_vdo_target_params *vtp,
 					   uint32_t *virtual_extents);
lib/metadata/vdo_manip.c +83 -0

89 lines not on this page · raw message