lkml.org 
[lkml]   [2009]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/3] radix-tree: add radix_tree_prev_hole()
    On Sun, 12 Apr 2009 15:19:51 +0800 Wu Fengguang <fengguang.wu@intel.com> wrote:

    > +unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
    > + unsigned long index, unsigned long max_scan)
    > +{
    > + unsigned long i;
    > +
    > + for (i = 0; i < max_scan; i++) {
    > + if (!radix_tree_lookup(root, index))
    > + break;
    > + index--;
    > + if (index == LONG_MAX)
    > + break;
    > + }
    > +
    > + return index;
    > +}

    argh. This is about as inefficient as we could possibly make it :(

    Really, this function should dive into radix-tree internals and walk
    individual radix_tree_node.slots[] arrays. And heck, it can peek at
    radix_tree_node.count and _bypass_ entire nodes, too.



    \
     
     \ /
      Last update: 2009-04-12 19:35    [W:0.046 / U:0.016 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site