struct ext2fs_rb_private {
struct rb_root root;
- struct bmap_rb_extent **wcursor;
- struct bmap_rb_extent **rcursor;
+ struct bmap_rb_extent *wcursor;
+ struct bmap_rb_extent *rcursor;
#ifdef BMAP_STATS_OPS
__u64 mark_hit;
__u64 test_hit;
static void rb_free_extent(struct ext2fs_rb_private *bp,
struct bmap_rb_extent *ext)
{
- if (*bp->wcursor == ext)
- *bp->wcursor = NULL;
- if (*bp->rcursor == ext)
- *bp->rcursor = NULL;
+ if (bp->wcursor == ext)
+ bp->wcursor = NULL;
+ if (bp->rcursor == ext)
+ bp->rcursor = NULL;
ext2fs_free_mem(&ext);
}
return retval;
bp->root = RB_ROOT;
- retval = ext2fs_get_mem(sizeof(struct bmap_rb_extent *), &bp->rcursor);
- if (retval)
- return retval;
- retval = ext2fs_get_mem(sizeof(struct bmap_rb_extent *), &bp->wcursor);
- if (retval)
- return retval;
- *bp->rcursor = NULL;
- *bp->wcursor = NULL;
+ bp->rcursor = NULL;
+ bp->wcursor = NULL;
#ifdef BMAP_STATS_OPS
bp->test_hit = 0;
bp = (struct ext2fs_rb_private *) bitmap->private;
rb_free_tree(&bp->root);
- ext2fs_free_mem(&bp->rcursor);
- ext2fs_free_mem(&bp->wcursor);
ext2fs_free_mem(&bp);
bp = 0;
}
src_bp = (struct ext2fs_rb_private *) src->private;
dest_bp = (struct ext2fs_rb_private *) dest->private;
- *src_bp->rcursor = NULL;
- *dest_bp->rcursor = NULL;
+ src_bp->rcursor = NULL;
+ dest_bp->rcursor = NULL;
src_node = ext2fs_rb_first(&src_bp->root);
while (src_node) {
}
bp = (struct ext2fs_rb_private *) bmap->private;
- *bp->rcursor = NULL;
- *bp->wcursor = NULL;
+ bp->rcursor = NULL;
+ bp->wcursor = NULL;
/* truncate tree to new_real_end size */
rb_truncate(new_real_end, &bp->root);
struct rb_node **n = &bp->root.rb_node;
struct bmap_rb_extent *ext;
- rcursor = *bp->rcursor;
+ rcursor = bp->rcursor;
if (!rcursor)
goto search_tree;
}
}
- rcursor = *bp->wcursor;
+ rcursor = bp->wcursor;
if (!rcursor)
goto search_tree;
else if (bit >= (ext->start + ext->count))
n = &(*n)->rb_right;
else {
- *bp->rcursor = ext;
+ bp->rcursor = ext;
return 1;
}
}
struct bmap_rb_extent *ext;
int retval = 0;
- ext = *bp->wcursor;
+ ext = bp->wcursor;
if (ext) {
if (start >= ext->start &&
start <= (ext->start + ext->count)) {
new_node = &new_ext->node;
ext2fs_rb_link_node(new_node, parent, n);
ext2fs_rb_insert_color(new_node, root);
- *bp->wcursor = new_ext;
+ bp->wcursor = new_ext;
node = ext2fs_rb_prev(new_node);
if (node) {
bp = (struct ext2fs_rb_private *) bitmap->private;
rb_free_tree(&bp->root);
- *bp->rcursor = NULL;
- *bp->wcursor = NULL;
+ bp->rcursor = NULL;
+ bp->wcursor = NULL;
}
#ifdef BMAP_STATS