/* alloc_swapdev_block - allocate a swap page and register that it has been allocated, so that it can be freed in case of an error.  */
sector_t alloc_swapdev_block(int swap)
/* alloc_swapdev_block - allocate a swap page and register that it has been allocated, so that it can be freed in case of an error.  */
sector_t alloc_swapdev_block(int swap)
{
	unsigned long offset;
	offset = swp_offset(get_swap_page_of_type(swap));
	if (offset) {
		if (swsusp_extents_insert(offset))
			swap_free(swp_entry(swap, offset));
		else
			return swapdev_block(swap, offset);
	}
	return 0;
}