]> sourceware.org Git - lvm2.git/commit
Optimise PV segments search.
authorMilan Broz <mbroz@redhat.com>
Wed, 31 Mar 2010 17:21:40 +0000 (17:21 +0000)
committerMilan Broz <mbroz@redhat.com>
Wed, 31 Mar 2010 17:21:40 +0000 (17:21 +0000)
commita0074aa07e1b749736eaaf9704a3427d8ef6b6b5
tree56aa2517bc8a82eaa3800dc8d9940da29a6f54f3
parent4e8859d851cc94bf013925b23060346a0fde9cb7
Optimise PV segments search.

The function find_peg_by_pe is incredibly inefficient
for Pvs with many segments.

In shiny future there should be binary (or interval) tree
instead of sorted linked list (volunteers?).

Anyway, for now, we can use dirty trick here to optimise this case:

 - Allocations are usually applied from the beginning
 of PV (we have no alloocation policy which allocates areas
 "backwards")

 - The only user of find_peg_by_pe is pv_split_segment()
 call. In *most* cases it need to split *last* PV segment.

So if we search sorted pv segment list backwards, we
hit the requested segment immediatelly.

This patch applies this tiny change.
(and saves >30% of processing time when >3000LVs segments are on one PV!)

To discourage using this inefficient function from other code,
it is moved to pv_manip.c and used static for now:-)
WHATS_NEW
lib/metadata/metadata.c
lib/metadata/metadata.h
lib/metadata/pv_manip.c
This page took 0.035363 seconds and 5 git commands to generate.