mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: better code to enforce writethrough
Better code to enforce writethrough caching for cleaner policy. Only check for cleaner when DM_CACHE_FEATURE_PASSTHROUGH or DM_CACHE_FEATURE_WRITEBACK is set.
This commit is contained in:
parent
edf5e43f9a
commit
bf79fb1a33
@ -1,5 +1,6 @@
|
||||
Version 1.02.138 -
|
||||
=====================================
|
||||
Improve code to handle mode mask for cache nodes.
|
||||
Cache status check for passthrough also require trailing space.
|
||||
Add extra memory page when limiting pthread stack size in dmeventd.
|
||||
Avoids immediate resume when preloaded device is smaller.
|
||||
|
@ -3398,14 +3398,21 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
|
||||
{
|
||||
struct dm_config_node *cn;
|
||||
struct load_segment *seg;
|
||||
|
||||
switch (feature_flags &
|
||||
(DM_CACHE_FEATURE_PASSTHROUGH |
|
||||
static const uint64_t _modemask =
|
||||
DM_CACHE_FEATURE_PASSTHROUGH |
|
||||
DM_CACHE_FEATURE_WRITETHROUGH |
|
||||
DM_CACHE_FEATURE_WRITEBACK)) {
|
||||
DM_CACHE_FEATURE_WRITEBACK;
|
||||
|
||||
switch (feature_flags & _modemask) {
|
||||
case DM_CACHE_FEATURE_PASSTHROUGH:
|
||||
case DM_CACHE_FEATURE_WRITETHROUGH:
|
||||
case DM_CACHE_FEATURE_WRITEBACK:
|
||||
if (strcmp(policy_name, "cleaner") == 0) {
|
||||
/* Enforce writethrough mode for cleaner policy */
|
||||
feature_flags = ~_modemask;
|
||||
feature_flags |= DM_CACHE_FEATURE_WRITETHROUGH;
|
||||
}
|
||||
/* Fall through */
|
||||
case DM_CACHE_FEATURE_WRITETHROUGH:
|
||||
break;
|
||||
default:
|
||||
log_error("Invalid cache's feature flag " FMTu64 ".",
|
||||
@ -3456,8 +3463,7 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
|
||||
return_0;
|
||||
|
||||
seg->data_block_size = data_block_size;
|
||||
/* Enforce WriteThough mode for cleaner policy */
|
||||
seg->flags = (strcmp(policy_name, "cleaner") == 0) ? DM_CACHE_FEATURE_WRITETHROUGH : feature_flags;
|
||||
seg->flags = feature_flags;
|
||||
seg->policy_name = policy_name;
|
||||
|
||||
/* FIXME: better validation missing */
|
||||
|
Loading…
Reference in New Issue
Block a user