]> sourceware.org Git - lvm2.git/commitdiff
metadata: Add cache_policy to lvcreate_params and honour it.
authorPetr Rockai <prockai@redhat.com>
Thu, 27 Nov 2014 19:20:48 +0000 (20:20 +0100)
committerPetr Rockai <prockai@redhat.com>
Thu, 27 Nov 2014 19:20:48 +0000 (20:20 +0100)
lib/metadata/lv_manip.c
lib/metadata/metadata-exported.h

index 879cd51f250a00e1e9b85eb068a05ead862b0f0c..b00e11ba0f4e32382f7dac6d53ee4e9daec0d36f 100644 (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.");
index d960e1fbfaf62ff11b17457b7ab852e7e46b286b..d70602d801b98e23fa96a5c221ea165a57a12c07 100644 (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 */
This page took 0.052283 seconds and 5 git commands to generate.