]> sourceware.org Git - lvm2.git/commitdiff
raid: Tell lib whether stripesize was specified
authorAlasdair G Kergon <agk@redhat.com>
Fri, 5 Aug 2016 13:28:14 +0000 (14:28 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 5 Aug 2016 13:28:14 +0000 (14:28 +0100)
lib/metadata/metadata-exported.h
lib/metadata/raid_manip.c
tools/lvconvert.c

index e61802d71adeaae0aee3e3290e659b5d1ab06957..e1a353813f40d6ad06af41ca94b2c5ca9d445dbb 100644 (file)
@@ -1200,6 +1200,7 @@ int lv_raid_convert(struct logical_volume *lv,
                    const struct segment_type *new_segtype,
                    int yes, int force,
                    const unsigned stripes,
+                   const unsigned new_stripe_size_supplied,
                    const unsigned new_stripe_size,
                    const uint32_t new_region_size,
                    struct dm_list *allocate_pvs);
index 2cc48e183e5b13be0e900799cbd6296e068a3032..a2bf832c9010e7d695d9624046990826b073f017 100644 (file)
@@ -2744,6 +2744,7 @@ int lv_raid_convert(struct logical_volume *lv,
                    const struct segment_type *new_segtype,
                    int yes, int force,
                    const unsigned new_stripes,
+                   const unsigned new_stripe_size_supplied,
                    const unsigned new_stripe_size,
                    const uint32_t new_region_size,
                    struct dm_list *allocate_pvs)
@@ -2758,7 +2759,11 @@ int lv_raid_convert(struct logical_volume *lv,
                return 0;
        }
 
-       stripes = new_stripes ?: _data_rimages_count(seg, seg->area_count);
+       stripes = new_stripes ? : _data_rimages_count(seg, seg->area_count);
+
+       /* FIXME Ensure caller does *not* set wrong default value! */
+       /* Define new stripe size if not passed in */
+       stripe_size = new_stripe_size ? : seg->stripe_size;
 
        if (segtype_is_striped(new_segtype))
                new_image_count = stripes;
@@ -2766,10 +2771,6 @@ int lv_raid_convert(struct logical_volume *lv,
        if (segtype_is_raid(new_segtype) && !_check_max_raid_devices(new_image_count))
                return_0;
 
-       /* FIXME Ensure caller does *not* set wrong default value! */
-       /* Define new stripe size if not passed in */
-       stripe_size = new_stripe_size ?: seg->stripe_size;
-
        takeover_fn = _get_takeover_fn(first_seg(lv), new_segtype, new_image_count);
 
        /* Exit without doing activation checks if the combination isn't possible */
index 5731558a5ec4a81c850852ecc552c8cba252e0c3..8c3bf05d4d0effbd5ad37eef1aa06310b6082175 100644 (file)
@@ -86,6 +86,7 @@ struct lvconvert_params {
        sign_t mirrors_sign;
        uint32_t stripes;
        uint32_t stripe_size;
+       uint32_t stripe_size_supplied;
        uint32_t read_ahead;
        cache_mode_t cache_mode; /* cache */
        const char *policy_name; /* cache */
@@ -1905,7 +1906,7 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l
                        log_error("RAID module does not support RAID0.");
                        return 0;
                }
-               if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size,
+               if (!lv_raid_convert(lv, lp->segtype, lp->yes, lp->force, lp->stripes, lp->stripe_size_supplied, lp->stripe_size,
                                     lp->region_size, lp->pvh))
                        return_0;
                log_print_unless_silent("Logical volume %s successfully converted.",
@@ -4405,6 +4406,8 @@ static int _lvconvert(struct cmd_context *cmd, struct logical_volume *lv,
            _striped_type_requested(lp->type_str) || lp->repair || lp->mirrorlog || lp->corelog) {
                if (!get_stripe_params(cmd, lp->segtype, &lp->stripes, &lp->stripe_size))
                        return_0;
+               /* FIXME Move this into the get function */
+               lp->stripe_size_supplied = arg_is_set(cmd, stripesize_ARG);
 
                if (_raid0_type_requested(lp->type_str) || _striped_type_requested(lp->type_str))
                        /* FIXME Shouldn't need to override get_stripe_params which defaults to 1 stripe (i.e. linear)! */
This page took 0.056888 seconds and 5 git commands to generate.