mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-07 05:58:00 +03:00
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:-)