1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
This commit is contained in:
Joe Thornber 2001-11-12 19:28:50 +00:00
parent 4daacc38cb
commit d53f88d7af
4 changed files with 30 additions and 23 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;