/* returns 0 on success, -ve errno on failure.  */
int __isolate_lru_page(struct page *page, int mode, int file)
/* returns 0 on success, -ve errno on failure.  */
int __isolate_lru_page(struct page *page, int mode, int file)
{
	int ret = -EINVAL;
	if (!PageLRU(page))
		return ret;
	if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
		return ret;
	if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
		return ret;
	if (PageUnevictable(page))
		return ret;
	ret = -EBUSY;
	if (likely(get_page_unless_zero(page))) {
		ClearPageLRU(page);
		ret = 0;
	}
	return ret;
}