Version 2.02.169 -
=====================================
+ Avoid shifting by one number of blocks when clearing dirty cache volume.
Extend metadata validation of external origin LV use count.
Fix dm table when the last user of active external origin is removed.
Improve reported lvs status for active external origin volume.
const struct logical_volume *lock_lv = lv_lock_holder(cache_lv);
struct lv_segment *cache_seg = first_seg(cache_lv);
struct lv_status_cache *status;
- int cleaner_policy;
+ int cleaner_policy, writeback;
uint64_t dirty_blocks;
*is_clean = 0;
cleaner_policy = !strcmp(status->cache->policy_name, "cleaner");
dirty_blocks = status->cache->dirty_blocks;
-
- /* No clear policy and writeback mode means dirty */
- if (!cleaner_policy &&
- (status->cache->feature_flags & DM_CACHE_FEATURE_WRITEBACK))
- dirty_blocks++;
+ writeback = (status->cache->feature_flags & DM_CACHE_FEATURE_WRITEBACK);
dm_pool_destroy(status->mem);
- if (!dirty_blocks)
+ /* Only clear when policy is Clear or mode != writeback */
+ if (!dirty_blocks && (cleaner_policy || !writeback))
break;
log_print_unless_silent("Flushing " FMTu64 " blocks for cache %s.",
continue;
}
+ if (!(cache_lv->status & LVM_WRITE)) {
+ log_warn("WARNING: Dirty blocks found on read-only cache volume %s.",
+ display_lvname(cache_lv));
+ /* TODO: can we actually clean something? */
+ }
+
/* Switch to cleaner policy to flush the cache */
cache_seg->cleaner_policy = 1;
/* Reaload kernel with "cleaner" policy */