From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18627 invoked by alias); 2 Sep 2009 21:39:51 -0000 Received: (qmail 18613 invoked by uid 9657); 2 Sep 2009 21:39:50 -0000 Date: Wed, 02 Sep 2009 21:39:00 -0000 Message-ID: <20090902213950.18611.qmail@sourceware.org> From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/metadata metadata.c Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00027.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2009-09-02 21:39:49 Modified files: lib/metadata : metadata.c Log message: Update vg_remove_single_* functions to use the removed_pvs list. Now that we've split vg_remove_single into two routines, in the first routine that only manipulates memory, we move the PVs from the vg->pvs list to the vg->removed_pvs list. Then later, we iterate through this list to write the removed PVs to disk, which removes them from the volume group and places them into the internal ORPHAN VG. Signed-off-by: Dave Wysochanski Author: Dave Wysochanski Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.281&r2=1.282 --- LVM2/lib/metadata/metadata.c 2009/09/02 21:39:29 1.281 +++ LVM2/lib/metadata/metadata.c 2009/09/02 21:39:49 1.282 @@ -471,6 +471,7 @@ int vg_remove_check(struct volume_group *vg) { unsigned lv_count; + struct pv_list *pvl, *tpvl; if (vg_read_error(vg) || vg_missing_pv_count(vg)) { log_error("Volume group \"%s\" not found, is inconsistent " @@ -494,6 +495,10 @@ if (!archive(vg)) return 0; + dm_list_iterate_items_safe(pvl, tpvl, &vg->pvs) { + dm_list_del(&pvl->list); + dm_list_add(&vg->removed_pvs, &pvl->list); + } return 1; } @@ -515,7 +520,7 @@ } /* init physical volumes */ - dm_list_iterate_items(pvl, &vg->pvs) { + dm_list_iterate_items(pvl, &vg->removed_pvs) { pv = pvl->pv; log_verbose("Removing physical volume \"%s\" from " "volume group \"%s\"", pv_dev_name(pv), vg->name);