From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19768 invoked by alias); 31 Mar 2010 20:26:05 -0000 Received: (qmail 19747 invoked by uid 9447); 31 Mar 2010 20:26:04 -0000 Date: Wed, 31 Mar 2010 20:26:00 -0000 Message-ID: <20100331202604.19745.qmail@sourceware.org> From: agk@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/lib/metadata lv_manip.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: 2010-03/txt/msg00115.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2010-03-31 20:26:04 Modified files: lib/metadata : lv_manip.c Log message: Attempt to fix non-ALLOC_ANYWHERE allocation code after recent changes broke The preference given to the PVs with the largest free areas. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.219&r2=1.220 --- LVM2/lib/metadata/lv_manip.c 2010/03/31 17:23:19 1.219 +++ LVM2/lib/metadata/lv_manip.c 2010/03/31 20:26:04 1.220 @@ -877,8 +877,8 @@ static int _comp_area(const void *l, const void *r) { - const struct pv_area_used *lhs = *((const struct pv_area_used * const *) l); - const struct pv_area_used *rhs = *((const struct pv_area_used * const *) r); + const struct pv_area_used *lhs = (const struct pv_area_used *) l; + const struct pv_area_used *rhs = (const struct pv_area_used *) r; if (lhs->used < rhs->used) return 1; @@ -1166,10 +1166,7 @@ already_found_one = 1; } - if (ix + ix_offset - 1 < ah->area_count) - required = (max_parallel - *allocated) / ah->area_multiple; - else - required = ah->log_len; + required = (max_parallel - *allocated) / ah->area_multiple; if (alloc == ALLOC_ANYWHERE) { /* @@ -1177,6 +1174,8 @@ * into two or more parts. If the whole stripe doesn't fit, * reduce amount we're looking for. */ + if (ix + ix_offset - 1 >= ah->area_count) + required = ah->log_len; if (required >= pva->unreserved) { required = pva->unreserved; pva->unreserved = 0; @@ -1200,7 +1199,8 @@ (alloc == ALLOC_ANYWHERE) ? pva->unreserved : pva->count - required); } next_pv: - if (ix + ix_offset >= ah->area_count + (log_needs_allocating ? ah->log_area_count : 0)) + if (alloc == ALLOC_ANYWHERE && + ix + ix_offset >= ah->area_count + (log_needs_allocating ? ah->log_area_count : 0)) break; } } while (alloc == ALLOC_ANYWHERE && last_ix != ix && ix < ah->area_count + (log_needs_allocating ? ah->log_area_count : 0));