336 BUG_ON(!PageLocked(page));
337 count = page_mapcount(page);
338 if (count <= 1 && PageSwapCache(page))
339 count += page_swapcount(page);
340 return count == 1;
341}
342
343
344
345
346
347static int remove_exclusive_swap_page_count(struct page *page, int count)
348{
349 int retval;
350 struct swap_info_struct * p;
351 swp_entry_t entry;
352
353 BUG_ON(PagePrivate(page));
354 BUG_ON(!PageLocked(page));
355
356 if (!PageSwapCache(page))
357 return 0;
358 if (PageWriteback(page))
359 return 0;
360 if (page_count(page) != count)
361 return 0;
362
363 entry.val = page_private(page);
364 p = swap_info_get(entry);
365 if (!p)
366 return 0;
367
368
369 retval = 0;
370 if (p->swap_map[swp_offset(entry)] == 1) {
371
372 spin_lock_irq(&swapper_space.tree_lock);
373 if ((page_count(page) == count) && !PageWriteback(page)) {
374 __delete_from_swap_cache(page);
375 SetPageDirty(page);
376 retval = 1;