]> sourceware.org Git - lvm2.git/commitdiff
cache: add kernel_cache_policy option
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 2 Mar 2016 10:12:46 +0000 (11:12 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 3 Mar 2016 09:14:23 +0000 (10:14 +0100)
Pair kernel_cache_settings with kernel_cache_policy.
There is very small chance in error case that the value in table
might be differnet from the value stored in metadata
so make it 'checkable'.

WHATS_NEW
lib/report/columns.h
lib/report/properties.c
lib/report/report.c

index 7602fa4355928086c7d7f7c1b3e7812ea68efba7..668e8a43e14f06f38ff66cc9b4cd18ed31dc2bc9 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.145 - 
 =====================================
+  Add kernel_cache_policy lvs field.
   Display [unknown] instead of 'unknown device' in pvs output.
   Fix error path when pvcreate allocation fails (2.02.144).
   Display [unknown] instead of blank for unknown VG names in pvs output.
index 040caf303ce7a7fc0ca2ac60af54c2d7e7ea8eee..56a8628709c43af476e3f456fdb324cc7327dfbd 100644 (file)
@@ -113,6 +113,7 @@ FIELD(LVSSTATUS, lv, NUM, "CacheReadMisses", lvid, 16, cache_read_misses, cache_
 FIELD(LVSSTATUS, lv, NUM, "CacheWriteHits", lvid, 16, cache_write_hits, cache_write_hits, "Cache write hits.", 0)
 FIELD(LVSSTATUS, lv, NUM, "CacheWriteMisses", lvid, 16, cache_write_misses, cache_write_misses, "Cache write misses.", 0)
 FIELD(LVSSTATUS, lv, STR_LIST, "KCache Settings", lvid, 18, kernel_cache_settings, kernel_cache_settings, "Cache settings/parameters as set in kernel, including default values (cached segments only).", 0)
+FIELD(LVSSTATUS, lv, STR, "KCache Policy", lvid, 18, kernel_cache_policy, kernel_cache_policy, "Cache policy used in kernel.", 0)
 FIELD(LVSSTATUS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
 FIELD(LVSSTATUS, lv, STR, "KDiscards", lvid, 8, kdiscards, kernel_discards, "For thin pools, how discards are handled in kernel.", 0)
 FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools, whether metadata check is needed.", 0)
index 024919ca2f8c9685a36e89f1d5c2b37915699c5b..76a72be6f29d26d9deb258fddf9891fdb035e4a8 100644 (file)
@@ -489,6 +489,8 @@ GET_LVSEG_STR_PROPERTY_FN(seg_monitor, lvseg_monitor_dup(lvseg->lv->vg->vgmem, l
 #define _cache_settings_set prop_not_implemented_set
 #define _kernel_cache_settings_get prop_not_implemented_get
 #define _kernel_cache_settings_set prop_not_implemented_set
+#define _kernel_cache_policy_get prop_not_implemented_get
+#define _kernel_cache_policy_set prop_not_implemented_set
 
 /* PVSEG */
 GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe)
index 39dbb673154dafdab2618696457ba693070b54d8..ff54cc4f31f8444b97d9ff644eef345721fd6720 100644 (file)
@@ -1499,6 +1499,20 @@ out:
        return r;
 }
 
+static int _kernel_cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
+                                    struct dm_report_field *field,
+                                    const void *data, void *private)
+{
+       const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
+
+       if ((lvdm->seg_status.type == SEG_STATUS_CACHE) &&
+           lvdm->seg_status.cache->policy_name)
+               return _string_disp(rh, mem, field, &lvdm->seg_status.cache->policy_name, NULL);
+
+       return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
+                               GET_FIELD_RESERVED_VALUE(cache_policy_undef));
+}
+
 static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
                              struct dm_report_field *field,
                              const void *data, void *private)
This page took 0.05309 seconds and 5 git commands to generate.