/* free_all_swap_pages - free swap pages allocated for saving image data. It also frees the extents used to register which swap entres had been allocated.  */
void free_all_swap_pages(int swap)
/* free_all_swap_pages - free swap pages allocated for saving image data. It also frees the extents used to register which swap entres had been allocated.  */
void free_all_swap_pages(int swap)
{
	struct rb_node *node;
	while ((node = swsusp_extents.rb_node)) {
		struct swsusp_extent *ext;
		unsigned long offset;
		ext = container_of(node, struct swsusp_extent, node);
		rb_erase(node, &swsusp_extents);
		for (offset = ext->start; offset <= ext->end; offset++)
			swap_free(swp_entry(swap, offset));
		kfree(ext);
	}
}