+static void report_lv_utilization(lv_t lv, char const *vg_name,
+ char const *lv_name, uint64_t lv_size,
+ char const *used_percent_property)
+{
+ uint64_t used_percent_unscaled;
+ uint64_t used_bytes;
+ char plugin_instance[DATA_MAX_NAME_LEN];
+
+ used_percent_unscaled = get_lv_property_int(lv, used_percent_property);
+ if (used_percent_unscaled == NO_VALUE)
+ return;
+ used_bytes = lv_size * (used_percent_unscaled * PERCENT_SCALE_FACTOR);
+
+ ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-%s",
+ vg_name, lv_name);
+ lvm_submit(plugin_instance, "used", used_bytes);
+ lvm_submit(plugin_instance, "free", lv_size - used_bytes);
+}
+
+static void report_thin_pool_utilization(lv_t lv, char const *vg_name,
+ uint64_t lv_size)
+{
+ char const *data_lv;
+ char const *metadata_lv;
+ uint64_t metadata_size;
+
+ data_lv = get_lv_property_string(lv, "data_lv");
+ metadata_lv = get_lv_property_string(lv, "metadata_lv");
+ metadata_size = get_lv_property_int(lv, "lv_metadata_size");
+ if (data_lv == NULL || metadata_lv == NULL || metadata_size == NO_VALUE)
+ return;
+
+ report_lv_utilization(lv, vg_name, data_lv, lv_size, "data_percent");
+ report_lv_utilization(lv, vg_name, metadata_lv, metadata_size,
+ "metadata_percent");
+}
+
+static void vg_read(vg_t vg, char const *vg_name)