From: Joe Thornber Date: Mon, 12 Nov 2001 19:28:50 +0000 (+0000) Subject: o Stuff X-Git-Tag: v2_02_91~6063 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=d53f88d7afc5419afada11f842b46c5132b5be29;p=lvm2.git o Stuff --- diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 570c2d1f5..bf3edd939 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -322,3 +322,21 @@ int lv_extend(struct logical_volume *lv, uint32_t extents, pool_free(cmd->mem, new_map); return 0; } + +/* FIXME: I don't like the way the lvh is passed in here - EJT */ +int lv_remove(struct volume_group *vg, struct list *lvh) +{ + int i; + struct logical_volume *lv; + + lv = &list_item(lvh, struct lv_list)->lv; + for (i = 0; i < lv->le_count; i++) + lv->map[i].pv->pe_allocated--; + + vg->lv_count--; + vg->free_count += lv->le_count; + + list_del(lvh); + + return 1; +} diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 4ad5ab2ed..24be027f5 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -288,19 +288,3 @@ struct physical_volume *_find_pv(struct volume_group *vg, struct device *dev) } return NULL; } - -int lv_remove(struct volume_group *vg, struct list *lvh) -{ - int i; - struct logical_volume *lv; - - lv = &list_item(lvh, struct lv_list)->lv; - for (i = 0; i < lv->le_count; i++) { - lv->map[i].pv->pe_allocated--; - } - - list_del(lvh); - vg->lv_count--; - - return 1; -} diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index a708421d0..cee821793 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -33,11 +33,14 @@ #define CLUSTERED 0x00000400 /* VG */ #define SHARED 0x00000800 /* VG */ -#define ALLOC_SIMPLE 0x00001000 /* LVM */ +/* FIXME: This should be an enum rather than a bitset, + remove from status - EJT */ +#define ALLOC_SIMPLE 0x00001000 /* LV */ #define ALLOC_STRICT 0x00002000 /* LV */ #define ALLOC_CONTIGUOUS 0x00004000 /* LV */ -#define SNAPSHOT 0x00008000 /* LV */ -#define SNAPSHOT_ORG 0x00010000 /* LV */ + +#define SNAPSHOT 0x00010000 /* LV */ +#define SNAPSHOT_ORG 0x00020000 /* LV */ #define EXPORTED_TAG "PV_EXP" /* Identifier of exported PV */ @@ -244,6 +247,8 @@ int lv_reduce(struct logical_volume *lv, uint32_t extents); int lv_extend(struct logical_volume *lv, uint32_t extents, struct list *allocatable_pvs); +int lv_remove(struct volume_group *vg, struct list *lvh); + /* FIXME: Move to other files */ int id_eq(struct id *op1, struct id *op2); @@ -254,8 +259,6 @@ int pv_remove(struct volume_group *vg, struct physical_volume *pv); struct physical_volume *pv_find(struct volume_group *vg, const char *pv_name); -/* Remove an LV from a given VG */ -int lv_remove(struct volume_group *vg, struct list *lvh); /* Find a PV within a given VG */ struct list *find_pv_in_vg(struct volume_group *vg, const char *pv_name); diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 641144d71..04d77c243 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -44,6 +44,8 @@ int lvcreate(int argc, char **argv) if (strcmp(arg_str_value(contiguous_ARG, "n"), "n")) status |= ALLOC_CONTIGUOUS; + else + status |= ALLOC_SIMPLE; zero = strcmp(arg_str_value(zero_ARG, "y"), "n"); @@ -84,7 +86,7 @@ int lvcreate(int argc, char **argv) "using -n"); return EINVALID_CMD_LINE; } - + /* If VG not on command line, try -n arg and then environment */ if (!argc) { if (!(vg_name = extract_vgname(fid, lv_name))) { @@ -225,7 +227,7 @@ int lvcreate(int argc, char **argv) log_verbose("Creating logical volume %s", lv_name); - if (!(lv = lv_create(lv_name, status, stripes, stripesize, + if (!(lv = lv_create(lv_name, status, stripes, stripesize, extents, vg, pvh))) return ECMD_FAILED;