mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cachepool: skip wipe for nonzeroeable segments
Avoid activation when going to skip zeroing of 'error' segtype (so it's not erroring out). Also skip zeroing for 'zero' segtype LV (already being zero).
This commit is contained in:
parent
558890ad0e
commit
9bbbc1b265
@ -1249,6 +1249,7 @@ int cache_set_params(struct lv_segment *seg,
|
|||||||
int wipe_cache_pool(struct logical_volume *cache_pool_lv)
|
int wipe_cache_pool(struct logical_volume *cache_pool_lv)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
struct logical_volume *cache_data_lv;
|
||||||
|
|
||||||
/* Only unused cache-pool could be activated and wiped */
|
/* Only unused cache-pool could be activated and wiped */
|
||||||
if (lv_is_used_cache_pool(cache_pool_lv) || lv_is_cache_vol(cache_pool_lv)) {
|
if (lv_is_used_cache_pool(cache_pool_lv) || lv_is_cache_vol(cache_pool_lv)) {
|
||||||
@ -1257,6 +1258,16 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cache_data_lv = (lv_is_cache_pool(cache_pool_lv)) ?
|
||||||
|
seg_lv(first_seg(cache_pool_lv), 0) : cache_pool_lv;
|
||||||
|
|
||||||
|
if (cache_data_lv && seg_cannot_be_zeroed(first_seg(cache_data_lv))) {
|
||||||
|
log_debug("Skipping wipe of %s volume with %s segtype.",
|
||||||
|
display_lvname(cache_data_lv),
|
||||||
|
first_seg(cache_data_lv)->segtype->name);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
cache_pool_lv->status |= LV_TEMPORARY;
|
cache_pool_lv->status |= LV_TEMPORARY;
|
||||||
if (!activate_lv(cache_pool_lv->vg->cmd, cache_pool_lv)) {
|
if (!activate_lv(cache_pool_lv->vg->cmd, cache_pool_lv)) {
|
||||||
log_error("Aborting. Failed to activate cache pool %s.",
|
log_error("Aborting. Failed to activate cache pool %s.",
|
||||||
|
Loading…
Reference in New Issue
Block a user