Commit 7d196748 authored by Andrew Morton's avatar Andrew Morton Committed by Jens Axboe

[PATCH] radix_tree_gang_lookup fix

When performing lookups against very sparse trees
radix_tree_gang_lookup fails to find nodes "far" to the right of the
start point.  Because it only understands sparseness in the leaf nodes,
not the intermediate nodes.

Nobody noticed this because all callers are incrementing the start
index as they walk the tree.

Change it to terminate the search when it really has inspected the last
possible node for the current tree's height.
parent f5046231
......@@ -282,17 +282,9 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
break;
nr_found = __lookup(root, results + ret, cur_index,
max_items - ret, &next_index, max_index);
if (nr_found == 0) {
if (!(cur_index & RADIX_TREE_MAP_MASK))
break;
/*
* It could be that there simply were no items to the
* right of `cur_index' in the leaf node. So we still
* need to search for additional nodes to the right of
* this one.
*/
}
ret += nr_found;
if (next_index == max_index)
break;
cur_index = next_index;
}
out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment