/* frees all zswap entries for the given swap type */
static void zswap_frontswap_invalidate_area(unsigned type)
{
	struct zswap_tree *tree = zswap_trees[type];
	struct zswap_entry *entry, *n;

	if (!tree)
		return;

	/* walk the tree and free everything */
	spin_lock(&tree->lock);
	rbtree_postorder_for_each_entry_safe(entry, n, &tree->rbroot, rbnode)
		zswap_free_entry(tree, entry);
	tree->rbroot = RB_ROOT;
	spin_unlock(&tree->lock);

	zbud_destroy_pool(tree->pool);
	kfree(tree);
	zswap_trees[type] = NULL;
}
Exemple #2
0
static void zbud_zpool_destroy(void *pool)
{
	zbud_destroy_pool(pool);
}