diff --git a/WHATS_NEW b/WHATS_NEW index 7602fa435..668e8a43e 100644 --- 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. diff --git a/lib/report/columns.h b/lib/report/columns.h index 040caf303..56a862870 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -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) diff --git a/lib/report/properties.c b/lib/report/properties.c index 024919ca2..76a72be6f 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -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) diff --git a/lib/report/report.c b/lib/report/report.c index 39dbb6731..ff54cc4f3 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -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)