1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

metadata: Add cache_policy to lvcreate_params and honour it.

This commit is contained in:
Petr Rockai 2014-11-27 20:20:48 +01:00
parent 9290854163
commit 2c3db52356
2 changed files with 12 additions and 0 deletions

View File

@ -7143,6 +7143,13 @@ 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) {
@ -7161,6 +7168,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
}
lv = tmp_lv;
if (lp->cache_policy && !lv_cache_setpolicy(lv, lp->cache_policy))
return NULL; /* revert? */
if (!lv_update_and_reload(lv)) {
/* FIXME Do a better revert */
log_error("Aborting. Manual intervention required.");

View File

@ -854,6 +854,7 @@ struct lvcreate_params {
uint32_t max_recovery_rate; /* RAID */
uint64_t feature_flags; /* cache */
struct dm_config_tree *cache_policy; /* cache */
const struct segment_type *segtype; /* all */
unsigned target_attr; /* all */