1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-08 08:58:50 +03:00

cache: enhance lv_cache_wait_for_clean

Handle passthrough mode when checking cache mode state explicitely.
This commit is contained in:
Zdenek Kabelac 2016-05-27 14:19:29 +02:00
parent 0424277c00
commit 1c07e67462
2 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.155 -
================================
Support passthrough cache mode when waiting for clean cache.
Check cache status only for 'in-use' cache pools.
Extend setup_task() to preset flushing for dm_task object.
When checking LV is a merging COW, validate its a COW LV first.

View File

@ -425,8 +425,11 @@ int lv_cache_remove(struct logical_volume *cache_lv)
log_error("Cannot deactivate remotely active cache lv.");
return 0;
}
/* For inactive writethrough just drop cache layer */
if (first_seg(cache_seg->pool_lv)->cache_mode == CACHE_MODE_WRITETHROUGH) {
switch (first_seg(cache_seg->pool_lv)->cache_mode) {
case CACHE_MODE_WRITETHROUGH:
case CACHE_MODE_PASSTHROUGH:
/* For inactive pass/writethrough just drop cache layer */
corigin_lv = seg_lv(cache_seg, 0);
if (!detach_pool_lv(cache_seg))
return_0;
@ -435,17 +438,17 @@ int lv_cache_remove(struct logical_volume *cache_lv)
if (!lv_remove(corigin_lv))
return_0;
return 1;
default:
/* Otherwise localy activate volume to sync dirty blocks */
cache_lv->status |= LV_TEMPORARY;
if (!activate_lv_excl_local(cache_lv->vg->cmd, cache_lv) ||
!lv_is_active_locally(cache_lv)) {
log_error("Failed to active cache locally %s.",
display_lvname(cache_lv));
return 0;
}
cache_lv->status &= ~LV_TEMPORARY;
}
/* Otherwise localy active volume is need to sync dirty blocks */
cache_lv->status |= LV_TEMPORARY;
if (!activate_lv_excl_local(cache_lv->vg->cmd, cache_lv) ||
!lv_is_active_locally(cache_lv)) {
log_error("Failed to active cache locally %s.",
display_lvname(cache_lv));
return 0;
}
cache_lv->status &= ~LV_TEMPORARY;
}
/*