1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +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 -
================================
Internal snapshot restructuring.
Allow offline extension of snapshot volumes.
Move from 2-step to 3-step on-disk metadata commit.
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);
_inc_indent(f);
if (!id_write_format(&snap->id, buffer, sizeof(buffer))) {
if (!id_write_format(&snap->lvid.id[1], buffer, sizeof(buffer))) {
stack;
return 0;
}

View File

@ -258,7 +258,7 @@ struct logical_volume {
};
struct snapshot {
struct id id;
union lvid lvid;
int persistent; /* boolean */
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);
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);
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 persistent, struct id *id, uint32_t extent_count,
int persistent, union lvid *lvid, uint32_t extent_count,
uint32_t chunk_size)
{
struct snapshot *s;
@ -131,9 +131,9 @@ int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow,
s->origin = origin;
s->cow = cow;
if (id)
s->id = *id;
else if (!id_create(&s->id)) {
if (lvid)
s->lvid = *lvid;
else if (!lvid_create(&s->lvid, &origin->vg->id)) {
log_error("Random UUID creation failed for snapshot %s.",
cow->name);
return 0;

View File

@ -70,7 +70,7 @@ static int _text_import(struct lv_segment *seg, const struct config_node *sn,
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)) {
stack;
return 0;