From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5343 invoked by alias); 29 Feb 2008 00:13:48 -0000 Received: (qmail 5328 invoked by uid 9657); 29 Feb 2008 00:13:48 -0000 Date: Fri, 29 Feb 2008 00:13:00 -0000 Message-ID: <20080229001348.5326.qmail@sourceware.org> From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/tools vgsplit.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: 2008-02/txt/msg00018.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2008-02-29 00:13:48 Modified files: tools : vgsplit.c Log message: Refactor _move_pv() in vgsplit. Should be no functional change. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51 --- LVM2/tools/vgsplit.c 2008/01/30 14:00:02 1.50 +++ LVM2/tools/vgsplit.c 2008/02/29 00:13:48 1.51 @@ -15,18 +15,11 @@ #include "tools.h" -static int _move_pv(struct volume_group *vg_from, struct volume_group *vg_to, - char *pv_name) +static void _move_pv(struct volume_group *vg_from, struct volume_group *vg_to, + struct pv_list *pvl) { - struct pv_list *pvl; struct physical_volume *pv; - if (!(pvl = find_pv_in_vg(vg_from, pv_name))) { - log_error("Physical volume %s not in volume group %s", - pv_name, vg_from->name); - return 0; - } - list_del(&pvl->list); list_add(&vg_to->pvs, &pvl->list); @@ -40,8 +33,6 @@ vg_from->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv); vg_to->free_count += pv_pe_count(pv) - pv_pe_alloc_count(pv); - - return 1; } /* FIXME Why not (lv->vg == vg) ? */ @@ -230,6 +221,7 @@ int opt; int active; int existing_vg; + struct pv_list *pvl; if (argc < 3) { log_error("Existing VG, new VG and physical volumes required."); @@ -312,8 +304,13 @@ /* Move PVs across to new structure */ for (opt = 0; opt < argc; opt++) { - if (!_move_pv(vg_from, vg_to, argv[opt])) + if (!(pvl = find_pv_in_vg(vg_from, argv[opt]))) { + log_error("Physical volume %s not in volume group %s", + argv[opt], vg_from->name); goto error; + } + + _move_pv(vg_from, vg_to, pvl); } /* Move required LVs across, checking consistency */