Ejemplo n.º 1
0
void init_snapshot_merge(struct lv_segment *snap_seg,
			 struct logical_volume *origin)
{
	snap_seg->status |= MERGING;
	origin->snapshot = snap_seg;
	origin->status |= MERGING;

	if (seg_is_thin_volume(snap_seg)) {
		snap_seg->merge_lv = origin;
		/* Making thin LV invisible with regular log */
		lv_set_hidden(snap_seg->lv);
		return;
	}

	/*
	 * Even though lv_is_visible(snap_seg->lv) returns 0,
	 * the snap_seg->lv (name: snapshotX) is _not_ hidden;
	 * this is part of the lvm2 snapshot fiction.  Must
	 * clear VISIBLE_LV directly (lv_set_visible can't)
	 * - snap_seg->lv->status is used to control whether 'lv'
	 *   (with user provided snapshot LV name) is visible
	 * - this also enables vg_validate() to succeed with
	 *   merge metadata (snap_seg->lv is now "internal")
	 */
	snap_seg->lv->status &= ~VISIBLE_LV;
}
Ejemplo n.º 2
0
static int attach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
{
	struct cmd_context *cmd = seg->lv->vg->cmd;
	struct lv_list *lvl, *tmp;

	if (seg_is_raid(seg)) {
		dm_list_iterate_items_safe(lvl, tmp, list) {
			lv_set_hidden(lvl->lv);
			dm_pool_free(cmd->mem, lvl);
		}
		return 1;
	}
Ejemplo n.º 3
0
void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
		       struct logical_volume *cow, uint32_t chunk_size)
{
	seg->chunk_size = chunk_size;
	seg->origin = origin;
	seg->cow = cow;

	lv_set_hidden(cow);

	cow->snapshot = seg;

	origin->origin_count++;

	/* FIXME Assumes an invisible origin belongs to a sparse device */
	if (!lv_is_visible(origin))
		origin->status |= VIRTUAL_ORIGIN;

	seg->lv->status |= (SNAPSHOT | VIRTUAL);

	dm_list_add(&origin->snapshot_segs, &seg->origin_list);
}