Enable/disable inactive/active segments only

This commit is contained in:
Martin Willi
2010-04-07 13:55:14 +02:00
committed by Martin Willi
parent 310498f3de
commit 9fdf5f712e
@@ -126,16 +126,22 @@ static void enable_disable(private_ha_sync_segments_t *this, u_int segment,
for (i = segment; i < limit; i++) for (i = segment; i < limit; i++)
{ {
if (enable) if (enable)
{
if (!(this->active & SEGMENTS_BIT(i)))
{ {
this->active |= SEGMENTS_BIT(i); this->active |= SEGMENTS_BIT(i);
this->kernel->activate(this->kernel, i); this->kernel->activate(this->kernel, i);
} }
}
else else
{
if (this->active & SEGMENTS_BIT(i))
{ {
this->active &= ~SEGMENTS_BIT(i); this->active &= ~SEGMENTS_BIT(i);
this->kernel->deactivate(this->kernel, i); this->kernel->deactivate(this->kernel, i);
} }
} }
}
log_segments(this, enable, segment); log_segments(this, enable, segment);
} }