1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-04 09:18:36 +03:00

store snapshot id as lvid internally

This commit is contained in:
Alasdair Kergon 2005-04-07 12:24:48 +00:00
parent 864de9cee1
commit 90395b8d53
5 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 2.01.10 - Version 2.01.10 -
================================ ================================
Internal snapshot restructuring.
Allow offline extension of snapshot volumes. Allow offline extension of snapshot volumes.
Move from 2-step to 3-step on-disk metadata commit. Move from 2-step to 3-step on-disk metadata commit.
Scan ramdisks too and allow non-O_DIRECT fallback. Scan ramdisks too and allow non-O_DIRECT fallback.

View File

@ -488,7 +488,7 @@ static int _print_snapshot(struct formatter *f, struct snapshot *snap,
outf(f, "snapshot%u {", count); outf(f, "snapshot%u {", count);
_inc_indent(f); _inc_indent(f);
if (!id_write_format(&snap->id, buffer, sizeof(buffer))) { if (!id_write_format(&snap->lvid.id[1], buffer, sizeof(buffer))) {
stack; stack;
return 0; return 0;
} }

View File

@ -258,7 +258,7 @@ struct logical_volume {
}; };
struct snapshot { struct snapshot {
struct id id; union lvid lvid;
int persistent; /* boolean */ int persistent; /* boolean */
uint32_t chunk_size; /* in 512 byte sectors */ uint32_t chunk_size; /* in 512 byte sectors */
@ -508,7 +508,7 @@ struct snapshot *find_origin(const struct logical_volume *lv);
struct list *find_snapshots(const struct logical_volume *lv); struct list *find_snapshots(const struct logical_volume *lv);
int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow,
int persistent, struct id *id, uint32_t extent_count, int persistent, union lvid *lvid, uint32_t extent_count,
uint32_t chunk_size); uint32_t chunk_size);
int vg_remove_snapshot(struct volume_group *vg, struct logical_volume *cow); int vg_remove_snapshot(struct volume_group *vg, struct logical_volume *cow);

View File

@ -105,7 +105,7 @@ struct list *find_snapshots(const struct logical_volume *lv)
} }
int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow,
int persistent, struct id *id, uint32_t extent_count, int persistent, union lvid *lvid, uint32_t extent_count,
uint32_t chunk_size) uint32_t chunk_size)
{ {
struct snapshot *s; struct snapshot *s;
@ -131,9 +131,9 @@ int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow,
s->origin = origin; s->origin = origin;
s->cow = cow; s->cow = cow;
if (id) if (lvid)
s->id = *id; s->lvid = *lvid;
else if (!id_create(&s->id)) { else if (!lvid_create(&s->lvid, &origin->vg->id)) {
log_error("Random UUID creation failed for snapshot %s.", log_error("Random UUID creation failed for snapshot %s.",
cow->name); cow->name);
return 0; return 0;

View File

@ -70,7 +70,7 @@ static int _text_import(struct lv_segment *seg, const struct config_node *sn,
return 0; return 0;
} }
if (!vg_add_snapshot(org, cow, 1, &seg->lv->lvid.id[1], seg->len, if (!vg_add_snapshot(org, cow, 1, &seg->lv->lvid, seg->len,
chunk_size)) { chunk_size)) {
stack; stack;
return 0; return 0;