1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cache: add kernel_cache_policy option

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'.
This commit is contained in:
Zdenek Kabelac 2016-03-02 11:12:46 +01:00
parent 3d610fabbd
commit 88ce15004e
4 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.145 - Version 2.02.145 -
===================================== =====================================
Add kernel_cache_policy lvs field.
Display [unknown] instead of 'unknown device' in pvs output. Display [unknown] instead of 'unknown device' in pvs output.
Fix error path when pvcreate allocation fails (2.02.144). Fix error path when pvcreate allocation fails (2.02.144).
Display [unknown] instead of blank for unknown VG names in pvs output. Display [unknown] instead of blank for unknown VG names in pvs output.

View 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, "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, 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_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, "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, 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) FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools, whether metadata check is needed.", 0)

View 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 _cache_settings_set prop_not_implemented_set
#define _kernel_cache_settings_get prop_not_implemented_get #define _kernel_cache_settings_get prop_not_implemented_get
#define _kernel_cache_settings_set prop_not_implemented_set #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 */ /* PVSEG */
GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe) GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe)

View File

@ -1499,6 +1499,20 @@ out:
return r; 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, static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field, struct dm_report_field *field,
const void *data, void *private) const void *data, void *private)