1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cache: move setting of cache policy

Set policy before saving 1st. metadata and avoid unnecessary reload.
Fixes problem when we stored cache-pool without cache-policy set.
This commit is contained in:
Zdenek Kabelac 2015-07-14 09:57:34 +02:00
parent 4a33d57143
commit 86a4d47215
2 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.126 -
================================
Set cache policy before with the first lvm2 cache pool metadata commit.
Fix detection of thin-pool overprovisioning (2.02.124).
Fix lvmpolld segfaults on 32 bit architectures.
Fix ignored --startstopservices option if running lvmconf with systemd.

View File

@ -7245,6 +7245,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (seg_is_cache_pool(lp) || seg_is_cache(lp)) {
pool_lv = pool_lv ? : lv;
if (!lv_cache_setpolicy(pool_lv, lp->cache_policy))
return_NULL; /* revert? */
first_seg(pool_lv)->chunk_size = lp->chunk_size;
first_seg(pool_lv)->feature_flags = lp->feature_flags;
/* TODO: some calc_policy solution for cache ? */
@ -7437,13 +7439,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
if (lv_is_cache_pool(lv) && !origin_lv) {
if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
return NULL; /* revert? */
if (!lv_update_and_reload(lv))
return NULL; /* FIXME: revert */
}
if (seg_is_cache(lp) || (origin_lv && lv_is_cache_pool(lv))) {
/* Finish cache conversion magic */
if (origin_lv) {