|
@@ -79,6 +79,7 @@ bool
|
|
drbd_insert_interval(struct rb_root *root, struct drbd_interval *this)
|
|
drbd_insert_interval(struct rb_root *root, struct drbd_interval *this)
|
|
{
|
|
{
|
|
struct rb_node **new = &root->rb_node, *parent = NULL;
|
|
struct rb_node **new = &root->rb_node, *parent = NULL;
|
|
|
|
+ sector_t this_end = this->sector + (this->size >> 9);
|
|
|
|
|
|
BUG_ON(!IS_ALIGNED(this->size, 512));
|
|
BUG_ON(!IS_ALIGNED(this->size, 512));
|
|
|
|
|
|
@@ -87,6 +88,8 @@ drbd_insert_interval(struct rb_root *root, struct drbd_interval *this)
|
|
rb_entry(*new, struct drbd_interval, rb);
|
|
rb_entry(*new, struct drbd_interval, rb);
|
|
|
|
|
|
parent = *new;
|
|
parent = *new;
|
|
|
|
+ if (here->end < this_end)
|
|
|
|
+ here->end = this_end;
|
|
if (this->sector < here->sector)
|
|
if (this->sector < here->sector)
|
|
new = &(*new)->rb_left;
|
|
new = &(*new)->rb_left;
|
|
else if (this->sector > here->sector)
|
|
else if (this->sector > here->sector)
|
|
@@ -99,6 +102,7 @@ drbd_insert_interval(struct rb_root *root, struct drbd_interval *this)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this->end = this_end;
|
|
rb_link_node(&this->rb, parent, new);
|
|
rb_link_node(&this->rb, parent, new);
|
|
rb_insert_augmented(&this->rb, root, &augment_callbacks);
|
|
rb_insert_augmented(&this->rb, root, &augment_callbacks);
|
|
return true;
|
|
return true;
|