/* Return the prealloc space that have minimal distance from the goal block. @cpa is the prealloc space that is having currently known minimal distance from the goal block.  */
static struct ext4_prealloc_space* ext4_mb_check_group_pa(ext4_fsblk_t goal_block, struct ext4_prealloc_space *pa, struct ext4_prealloc_space *cpa)
/* Return the prealloc space that have minimal distance from the goal block. @cpa is the prealloc space that is having currently known minimal distance from the goal block.  */
static struct ext4_prealloc_space* ext4_mb_check_group_pa(ext4_fsblk_t goal_block, struct ext4_prealloc_space *pa, struct ext4_prealloc_space *cpa)
{
	ext4_fsblk_t cur_distance, new_distance;
	if (cpa == NULL) {
		atomic_inc(&pa->pa_count);
		return pa;
	}
	cur_distance = abs(goal_block - cpa->pa_pstart);
	new_distance = abs(goal_block - pa->pa_pstart);
	if (cur_distance < new_distance)
		return cpa;
	atomic_dec(&cpa->pa_count);
	atomic_inc(&pa->pa_count);
	return pa;
}