1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

o pv_write for orphan pv's

This commit is contained in:
Joe Thornber 2001-10-10 10:05:29 +00:00
parent 6320fd9e52
commit de9acc04f6
3 changed files with 50 additions and 2 deletions

View File

@ -400,6 +400,12 @@ static int _write_all_pv(struct disk_list *data)
return 0;
}
/*
* Stop here for orphan pv's.
*/
if (data->pv.vg_name[0] == '\0')
return 1;
if (!_write_vg(data)) {
log_err("failed to write vg data to %s", pv_name);
return 0;

View File

@ -314,8 +314,47 @@ static int _pv_setup(struct io_space *is, struct physical_volume *pv,
static int _pv_write(struct io_space *is, struct physical_volume *pv)
{
log_err("format1:pv_write not implemented.");
struct pool *mem;
struct disk_list *dl;
struct list_head pvs;
INIT_LIST_HEAD(&pvs);
if (pv->vg_name) {
log_info("pv_write should only be called for an orphan pv");
return 0;
}
if (!(mem = pool_create(1024))) {
stack;
return 0;
}
if (!(dl = pool_alloc(mem, sizeof(*dl)))) {
stack;
return 0;
}
dl->mem = mem;
dl->dev = pv->dev;
if (!export_pv(&dl->pv, pv)) {
stack;
goto bad;
}
list_add(&dl->list, &pvs);
if (!write_pvs(&pvs)) {
stack;
goto bad;
}
pool_destroy(mem);
return 1;
bad:
pool_destroy(mem);
return 0;
}

View File

@ -124,6 +124,9 @@ int export_pv(struct pv_disk *pvd, struct physical_volume *pv)
return 0;
}
memset(pvd->vg_name, 0, sizeof(pvd->vg_name));
if (pv->vg_name)
strcpy(pvd->vg_name, pv->vg_name);
//pvd->pv_major = MAJOR(pv->dev);