/* IMPROVE: It would be best to choose the block with the most deleted sectors, because if we fill that one up first it'll have the most chance of having the least live sectors at reclaim.  */
static int find_free_block(struct partition *part)
/* IMPROVE: It would be best to choose the block with the most deleted sectors, because if we fill that one up first it'll have the most chance of having the least live sectors at reclaim.  */
static int find_free_block(struct partition *part)
{
	int block, stop;
	block = part->current_block == -1 ?
			jiffies % part->total_blocks : part->current_block;
	stop = block;
	do {
		if (part->blocks[block].free_sectors &&
				block != part->reserved_block)
			return block;
		if (part->blocks[block].state == BLOCK_UNUSED)
			erase_block(part, block);
		if (++block >= part->total_blocks)
			block = 0;
	} while (block != stop);
	return -1;
}