diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-09-30 16:38:26 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-30 16:38:26 -0400 |
commit | 8c0de61a245d43cfafbdc7d3f2201934d9dbe8c6 (patch) | |
tree | 5f2e3a6c1c4fbf6222ecc5567ea1befe0a649e6a /e2fsck/ea_refcount.c | |
parent | b1c828e87590f613015185a19f8e2067a7220a05 (diff) | |
download | e2fsprogs-8c0de61a245d43cfafbdc7d3f2201934d9dbe8c6.tar.gz |
e2fsck: simplify binary search in ea_refcount.c
Remove the interpolation search in ea_refcount. The added complexity
isn't worth the speed up.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck/ea_refcount.c')
-rw-r--r-- | e2fsck/ea_refcount.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/e2fsck/ea_refcount.c b/e2fsck/ea_refcount.c index 35105e45..e66e6363 100644 --- a/e2fsck/ea_refcount.c +++ b/e2fsck/ea_refcount.c @@ -155,9 +155,7 @@ static struct ea_refcount_el *insert_refcount_el(ext2_refcount_t refcount, static struct ea_refcount_el *get_refcount_el(ext2_refcount_t refcount, blk_t blk, int create) { - float range; int low, high, mid; - blk_t lowval, highval; if (!refcount || !refcount->list) return 0; @@ -183,31 +181,7 @@ retry: printf("Non-cursor get_refcount_el: %u\n", blk); #endif while (low <= high) { -#if 0 mid = (low+high)/2; -#else - if (low == high) - mid = low; - else { - /* Interpolate for efficiency */ - lowval = refcount->list[low].ea_blk; - highval = refcount->list[high].ea_blk; - - if (blk < lowval) - range = 0; - else if (blk > highval) - range = 1; - else { - range = ((float) (blk - lowval)) / - (highval - lowval); - if (range > 0.9) - range = 0.9; - if (range < 0.1) - range = 0.1; - } - mid = low + ((int) (range * (high-low))); - } -#endif if (blk == refcount->list[mid].ea_blk) { refcount->cursor = mid+1; return &refcount->list[mid]; |