mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: use UNSELECTED enum
Switch from _UNDEFINED to _UNSELECTED which is more describing its value 0, while value -1 is better match for UNDEFINED.
This commit is contained in:
parent
b8cd0f4808
commit
4184331965
@ -52,7 +52,7 @@ static void _fix_missing_defaults(struct lv_segment *cpool_seg)
|
|||||||
cpool_seg->policy_name);
|
cpool_seg->policy_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpool_seg->cache_mode == CACHE_MODE_UNDEFINED) {
|
if (cpool_seg->cache_mode == CACHE_MODE_UNSELECTED) {
|
||||||
cpool_seg->cache_mode = CACHE_MODE_WHEN_MISSING;
|
cpool_seg->cache_mode = CACHE_MODE_WHEN_MISSING;
|
||||||
log_verbose("Cache pool %s is missing cache mode, using %s.",
|
log_verbose("Cache pool %s is missing cache mode, using %s.",
|
||||||
display_lvname(cpool_seg->lv),
|
display_lvname(cpool_seg->lv),
|
||||||
@ -169,7 +169,7 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
|
|||||||
* but not worth to break backward compatibility, by shifting
|
* but not worth to break backward compatibility, by shifting
|
||||||
* content to cache segment
|
* content to cache segment
|
||||||
*/
|
*/
|
||||||
if (seg->cache_mode != CACHE_MODE_UNDEFINED) {
|
if (seg->cache_mode != CACHE_MODE_UNSELECTED) {
|
||||||
if (!(cache_mode = get_cache_mode_name(seg)))
|
if (!(cache_mode = get_cache_mode_name(seg)))
|
||||||
return_0;
|
return_0;
|
||||||
outf(f, "cache_mode = \"%s\"", cache_mode);
|
outf(f, "cache_mode = \"%s\"", cache_mode);
|
||||||
|
@ -35,7 +35,7 @@ const char *display_cache_mode(const struct lv_segment *seg)
|
|||||||
seg = first_seg(seg->pool_lv);
|
seg = first_seg(seg->pool_lv);
|
||||||
|
|
||||||
if (!seg_is_cache_pool(seg) ||
|
if (!seg_is_cache_pool(seg) ||
|
||||||
(seg->cache_mode == CACHE_MODE_UNDEFINED))
|
(seg->cache_mode == CACHE_MODE_UNSELECTED))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return get_cache_mode_name(seg);
|
return get_cache_mode_name(seg);
|
||||||
@ -83,7 +83,7 @@ int cache_set_cache_mode(struct lv_segment *seg, cache_mode_t mode)
|
|||||||
if (seg_is_cache(seg))
|
if (seg_is_cache(seg))
|
||||||
seg = first_seg(seg->pool_lv);
|
seg = first_seg(seg->pool_lv);
|
||||||
else if (seg_is_cache_pool(seg)) {
|
else if (seg_is_cache_pool(seg)) {
|
||||||
if (mode == CACHE_MODE_UNDEFINED)
|
if (mode == CACHE_MODE_UNSELECTED)
|
||||||
return 1; /* Defaults only for cache */
|
return 1; /* Defaults only for cache */
|
||||||
} else {
|
} else {
|
||||||
log_error(INTERNAL_ERROR "Cannot set cache mode for non cache volume %s.",
|
log_error(INTERNAL_ERROR "Cannot set cache mode for non cache volume %s.",
|
||||||
@ -91,12 +91,12 @@ int cache_set_cache_mode(struct lv_segment *seg, cache_mode_t mode)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode != CACHE_MODE_UNDEFINED) {
|
if (mode != CACHE_MODE_UNSELECTED) {
|
||||||
seg->cache_mode = mode;
|
seg->cache_mode = mode;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seg->cache_mode != CACHE_MODE_UNDEFINED)
|
if (seg->cache_mode != CACHE_MODE_UNSELECTED)
|
||||||
return 1; /* Default already set in cache pool */
|
return 1; /* Default already set in cache pool */
|
||||||
|
|
||||||
/* Figure default settings from config/profiles */
|
/* Figure default settings from config/profiles */
|
||||||
|
@ -288,7 +288,7 @@ typedef enum {
|
|||||||
} thin_discards_t;
|
} thin_discards_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CACHE_MODE_UNDEFINED = 0,
|
CACHE_MODE_UNSELECTED = 0,
|
||||||
CACHE_MODE_WRITETHROUGH,
|
CACHE_MODE_WRITETHROUGH,
|
||||||
CACHE_MODE_WRITEBACK,
|
CACHE_MODE_WRITEBACK,
|
||||||
CACHE_MODE_PASSTHROUGH,
|
CACHE_MODE_PASSTHROUGH,
|
||||||
|
@ -634,7 +634,7 @@ static int _lvchange_cache(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
if (!get_cache_params(cmd, &mode, &name, &settings))
|
if (!get_cache_params(cmd, &mode, &name, &settings))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
if ((mode != CACHE_MODE_UNDEFINED) &&
|
if ((mode != CACHE_MODE_UNSELECTED) &&
|
||||||
(mode != pool_seg->cache_mode) &&
|
(mode != pool_seg->cache_mode) &&
|
||||||
lv_is_cache(lv)) {
|
lv_is_cache(lv)) {
|
||||||
if (!lv_cache_wait_for_clean(lv, &is_clean))
|
if (!lv_cache_wait_for_clean(lv, &is_clean))
|
||||||
|
@ -1358,7 +1358,7 @@ int get_cache_params(struct cmd_context *cmd,
|
|||||||
int ok = 0;
|
int ok = 0;
|
||||||
|
|
||||||
if (cache_mode)
|
if (cache_mode)
|
||||||
*cache_mode = (cache_mode_t) arg_uint_value(cmd, cachemode_ARG, CACHE_MODE_UNDEFINED);
|
*cache_mode = (cache_mode_t) arg_uint_value(cmd, cachemode_ARG, CACHE_MODE_UNSELECTED);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
*name = arg_str_value(cmd, cachepolicy_ARG, NULL);
|
*name = arg_str_value(cmd, cachepolicy_ARG, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user