Commit fcbab9ea authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

make space_recycle non-blocking and don't clear the cells before returning them.

parent 3bdd372a
......@@ -1602,25 +1602,15 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) {
*/
void space_recycle(struct space *s, struct cell *c) {
/* Lock the space. */
lock_lock(&s->lock);
/* Clear the cell. */
if (lock_destroy(&c->lock) != 0) error("Failed to destroy spinlock.");
/* Clear this cell's sort arrays. */
if (c->sort != NULL) free(c->sort);
/* Clear the cell data. */
bzero(c, sizeof(struct cell));
/* Hook this cell into the buffer. */
c->next = s->cells_sub;
s->cells_sub = c;
s->tot_cells -= 1;
/* Unlock the space. */
lock_unlock_blind(&s->lock);
c->next = atomic_swap(&s->cells_sub, c);
atomic_dec(&s->tot_cells);
}
/**
......
Supports Markdown
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