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;
+}
}
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;
-}
#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 */
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);
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);
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");
"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))) {
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;