diff options
author | Alasdair Kergon <agk@redhat.com> | 2004-05-04 21:25:57 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2004-05-04 21:25:57 +0000 |
commit | 4922197a3394d5482387efdf34aa89843da516c4 (patch) | |
tree | 291208c3ad46d660f99555db537336c0a5c1b961 /tools | |
parent | 6ec69941076b37d6528984ee2f42628cfa7b42ef (diff) | |
download | lvm2-4922197a3394d5482387efdf34aa89843da516c4.tar.gz lvm2-4922197a3394d5482387efdf34aa89843da516c4.tar.xz lvm2-4922197a3394d5482387efdf34aa89843da516c4.zip |
Begin to separate out segment types.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lvcreate.c | 14 | ||||
-rw-r--r-- | tools/lvmcmdline.c | 1 | ||||
-rw-r--r-- | tools/lvresize.c | 16 | ||||
-rw-r--r-- | tools/tools.h | 1 | ||||
-rw-r--r-- | tools/vgchange.c | 3 |
5 files changed, 26 insertions, 9 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index afe4f0a0..9385ea40 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -33,6 +33,10 @@ struct lvcreate_params { uint32_t stripe_size; uint32_t chunk_size; + uint32_t mirrors; + + struct segment_type *segtype; + /* size */ uint32_t extents; uint64_t size; @@ -188,6 +192,11 @@ static int _read_stripe_params(struct lvcreate_params *lp, lp->stripes = arg_uint_value(cmd, stripes_ARG, 1); if (lp->stripes == 1) log_print("Redundant stripes argument: default is 1"); + else if (!(lp->segtype = get_segtype_from_string(cmd, + "striped"))) { + stack; + return 0; + } } if (arg_count(cmd, stripesize_ARG)) { @@ -466,8 +475,9 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp) status |= LVM_WRITE; } - if (!(lv = lv_create(vg->fid, lp->lv_name, status, alloc, lp->stripes, - lp->stripe_size, lp->extents, vg, pvh))) + if (!(lv = lv_create(vg->fid, lp->lv_name, status, alloc, lp->segtype, + lp->stripes, lp->stripe_size, lp->mirrors, + lp->extents, vg, pvh))) return 0; if (lp->read_ahead) { diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 4efef72c..168e5738 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1,6 +1,7 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. * Copyright (C) 2004 Red Hat, Inc. All rights reserved. + * * This file is part of LVM2. * * This copyrighted material is made available to anyone wishing to use, diff --git a/tools/lvresize.c b/tools/lvresize.c index a4c0b19d..f818c887 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -39,6 +39,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv) struct lv_segment *seg; uint32_t seg_extents; uint32_t sz, str; + struct segment_type *segtype; enum { LV_ANY = 0, @@ -196,8 +197,8 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv) /* If extending, find stripes, stripesize & size of last segment */ if (extents > lv->le_count && !(stripes == 1 || (stripes > 1 && ssize))) { list_iterate_items(seg, &lv->segments) { - if (seg->type != SEG_STRIPED) - continue; + if (strcmp(seg->segtype->ops->name(seg), "striped")) + continue; /* Not striped */ sz = seg->stripe_size; str = seg->area_count; @@ -243,7 +244,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv) list_iterate_items(seg, &lv->segments) { seg_extents = seg->len; - if (seg->type == SEG_STRIPED) { + if (seg->segtype->flags & SEG_AREAS_STRIPED) { seg_stripesize = seg->stripe_size; seg_stripes = seg->area_count; } @@ -354,9 +355,14 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv) display_size(cmd, (uint64_t) extents * (vg->extent_size / 2), SIZE_SHORT)); + if (!(segtype = get_segtype_from_string(lv->vg->cmd, + "striped"))) { + stack; + return 0; + } - if (!lv_extend(vg->fid, lv, stripes, ssize, - extents - lv->le_count, pvh)) + if (!lv_extend(vg->fid, lv, segtype, stripes, ssize, 0u, + extents - lv->le_count, NULL, 0u, 0u, pvh)) goto error; } diff --git a/tools/tools.h b/tools/tools.h index a68d9cc6..9e447e90 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -43,6 +43,7 @@ #include "lvm-file.h" #include "lvm-string.h" #include "pool.h" +#include "segtypes.h" #include "str_list.h" #include "toolcontext.h" #include "toollib.h" diff --git a/tools/vgchange.c b/tools/vgchange.c index a298c64d..a8f7cff0 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -51,8 +51,7 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, return count; } -static int _vgchange_available(struct cmd_context *cmd, - struct volume_group *vg) +static int _vgchange_available(struct cmd_context *cmd, struct volume_group *vg) { int lv_open, active; int available = !strcmp(arg_str_value(cmd, available_ARG, "n"), "y"); |