struct dm_list segments;
struct dm_list tags;
struct dm_list segs_using_this_lv;
+ struct dm_list indirect_glvs; /* For keeping track of historical LVs in ancestry chain */
+
+ /*
+ * this_glv variable is used as a helper for handling historical LVs.
+ * If this LVs has no role at all in keeping track of historical LVs,
+ * the this_glv variable is NULL. See also comments for struct
+ * generic_logical_volume and struct historical_logical_volume below.
+ */
+ struct generic_logical_volume *this_glv;
uint64_t timestamp;
unsigned new_lock_args:1;
const char *lock_args;
};
+/*
+ * With the introduction of tracking historical LVs, we need to make
+ * a difference between live LV (struct logical_volume) and historical LV
+ * (struct historical_logical_volume). To minimize the impact of this change
+ * and to minimize the changes needed in the existing code, we use a
+ * little trick here - when processing LVs (e.g. while reporting LV
+ * properties), each historical LV is represented as dummy LV which is
+ * an instance of struct logical_volume with all its properties set to
+ * blank (hence "dummy LV") and with this_glv pointing to the struct
+ * historical_logical_volume. This way all the existing code working with
+ * struct logical_volume will see this historical LV as dummy live LV while
+ * the code that needs to recognize between live and historical LV will
+ * check this_glv first and then it will work either with the live
+ * or historical LV properties appropriately.
+ */
+struct generic_logical_volume;
+
+/*
+ * historical logical volume is an LV that has been removed already.
+ * This is used to keep track of LV history.
+ */
+struct historical_logical_volume {
+ union lvid lvid;
+ const char *name;
+ struct volume_group *vg;
+ uint64_t timestamp;
+ uint64_t timestamp_removed;
+ struct generic_logical_volume *indirect_origin;
+ struct dm_list indirect_glvs; /* list of struct generic_logical_volume */
+};
+
+struct generic_logical_volume {
+ int is_historical;
+ union {
+ struct logical_volume *live; /* is_historical=0 */
+ struct historical_logical_volume *historical; /* is_historical=1 */
+ };
+};
+
struct lv_with_info_and_seg_status;
/* LV dependencies */
dm_list_init(&lv->segments);
dm_list_init(&lv->tags);
dm_list_init(&lv->segs_using_this_lv);
+ dm_list_init(&lv->indirect_glvs);
dm_list_init(&lv->rsites);
return lv;
uint32_t chunk_size; /* For snapshots/thin_pool. In sectors. */
/* For thin_pool, 128..2097152. */
struct logical_volume *origin; /* snap and thin */
+ struct generic_logical_volume *indirect_origin;
struct logical_volume *merge_lv; /* thin, merge descendent lv into this ancestor */
struct logical_volume *cow;
struct dm_list origin_list;
struct logical_volume *lv;
};
+struct glv_list {
+ struct dm_list list;
+ struct generic_logical_volume *glv;
+};
+
struct vg_list {
struct dm_list list;
struct volume_group *vg;
dm_list_init(&vg->pv_write_list);
dm_list_init(&vg->pvs_outdated);
dm_list_init(&vg->lvs);
+ dm_list_init(&vg->historical_lvs);
dm_list_init(&vg->tags);
dm_list_init(&vg->removed_lvs);
dm_list_init(&vg->removed_pvs);
* - one for the user-visible mirror LV
*/
struct dm_list lvs;
+ struct dm_list historical_lvs;
struct dm_list tags;
.lvm1_system_id = (char *) "",
.pvs = DM_LIST_HEAD_INIT(_dummy_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_dummy_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_dummy_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_dummy_vg.tags),
};
.lvm1_system_id = (char *) "",
.pvs = DM_LIST_HEAD_INIT(_unknown_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_unknown_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_unknown_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_unknown_vg.tags),
};
.name = "",
.pvs = DM_LIST_HEAD_INIT(_free_vg.pvs),
.lvs = DM_LIST_HEAD_INIT(_free_vg.lvs),
+ .historical_lvs = DM_LIST_HEAD_INIT(_free_vg.historical_lvs),
.tags = DM_LIST_HEAD_INIT(_free_vg.tags),
};
.tags = DM_LIST_HEAD_INIT(_free_logical_volume.tags),
.segments = DM_LIST_HEAD_INIT(_free_logical_volume.segments),
.segs_using_this_lv = DM_LIST_HEAD_INIT(_free_logical_volume.segs_using_this_lv),
+ .indirect_glvs = DM_LIST_HEAD_INIT(_free_logical_volume.indirect_glvs),
.snapshot_segs = DM_LIST_HEAD_INIT(_free_logical_volume.snapshot_segs),
};