summaryrefslogtreecommitdiffstats
path: root/tools/lvcreate.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2008-07-17 15:19:42 +0000
committerDave Wysochanski <dwysocha@redhat.com>2008-07-17 15:19:42 +0000
commit2b6589c0d7ca18fac98d2aef15e90ff94779002c (patch)
tree6747fe137885dc22b55b9af8a2ce5602fcdc8692 /tools/lvcreate.c
parentfa53d359d5a4b670f77ea1cd27093b6213dc0d58 (diff)
downloadlvm2-2b6589c0d7ca18fac98d2aef15e90ff94779002c.tar.gz
lvm2-2b6589c0d7ca18fac98d2aef15e90ff94779002c.tar.xz
lvm2-2b6589c0d7ca18fac98d2aef15e90ff94779002c.zip
Refactor _lvcreate() - no functional change.
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r--tools/lvcreate.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index f966c0a1..00fc344d 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -523,8 +523,6 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
struct lvinfo info;
uint32_t pv_extent_count;
- status |= lp->permission | VISIBLE_LV;
-
if (lp->lv_name && find_lv_in_vg(vg, lp->lv_name)) {
log_error("Logical volume \"%s\" already exists in "
"volume group \"%s\"", lp->lv_name, lp->vg_name);
@@ -544,16 +542,6 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- /*
- * Create the pv list.
- */
- if (lp->pv_count) {
- if (!(pvh = create_pv_list(cmd->mem, vg,
- lp->pv_count, lp->pvs, 1)))
- return_0;
- } else
- pvh = &vg->pvs;
-
if (lp->stripe_size > vg->extent_size) {
log_error("Reducing requested stripe size %s to maximum, "
"physical extent size %s",
@@ -594,6 +582,16 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
lp->extents = (uint64_t) tmp_size / vg->extent_size;
}
+ /*
+ * Create the pv list.
+ */
+ if (lp->pv_count) {
+ if (!(pvh = create_pv_list(cmd->mem, vg,
+ lp->pv_count, lp->pvs, 1)))
+ return_0;
+ } else
+ pvh = &vg->pvs;
+
switch(lp->percent) {
case PERCENT_VG:
lp->extents = lp->extents * vg->extent_count / 100;
@@ -631,6 +629,8 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
+ status |= lp->permission | VISIBLE_LV;
+
if (lp->snapshot) {
if (!activation()) {
log_error("Can't create snapshot without using "