swapfile.c (f0d7a4b3ed46816f5097d521850a8ab7a0d40f3c) swapfile.c (2509ef26db4699a5d9fa876e90ddfc107afcab84)
1/*
2 * linux/mm/swapfile.c
3 *
4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
5 * Swap reorganised 29.12.95, Stephen Tweedie
6 */
7
8#include <linux/mm.h>

--- 557 unchanged lines hidden (view full) ---

566 SetPageDirty(page);
567 return 1;
568}
569
570/*
571 * Free the swap entry like above, but also try to
572 * free the page cache entry if it is the last user.
573 */
1/*
2 * linux/mm/swapfile.c
3 *
4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
5 * Swap reorganised 29.12.95, Stephen Tweedie
6 */
7
8#include <linux/mm.h>

--- 557 unchanged lines hidden (view full) ---

566 SetPageDirty(page);
567 return 1;
568}
569
570/*
571 * Free the swap entry like above, but also try to
572 * free the page cache entry if it is the last user.
573 */
574void free_swap_and_cache(swp_entry_t entry)
574int free_swap_and_cache(swp_entry_t entry)
575{
575{
576 struct swap_info_struct * p;
576 struct swap_info_struct *p;
577 struct page *page = NULL;
578
579 if (is_migration_entry(entry))
577 struct page *page = NULL;
578
579 if (is_migration_entry(entry))
580 return;
580 return 1;
581
582 p = swap_info_get(entry);
583 if (p) {
584 if (swap_entry_free(p, swp_offset(entry)) == 1) {
585 page = find_get_page(&swapper_space, entry.val);
586 if (page && !trylock_page(page)) {
587 page_cache_release(page);
588 page = NULL;

--- 9 unchanged lines hidden (view full) ---

598 if (PageSwapCache(page) && !PageWriteback(page) &&
599 (!page_mapped(page) || vm_swap_full())) {
600 delete_from_swap_cache(page);
601 SetPageDirty(page);
602 }
603 unlock_page(page);
604 page_cache_release(page);
605 }
581
582 p = swap_info_get(entry);
583 if (p) {
584 if (swap_entry_free(p, swp_offset(entry)) == 1) {
585 page = find_get_page(&swapper_space, entry.val);
586 if (page && !trylock_page(page)) {
587 page_cache_release(page);
588 page = NULL;

--- 9 unchanged lines hidden (view full) ---

598 if (PageSwapCache(page) && !PageWriteback(page) &&
599 (!page_mapped(page) || vm_swap_full())) {
600 delete_from_swap_cache(page);
601 SetPageDirty(page);
602 }
603 unlock_page(page);
604 page_cache_release(page);
605 }
606 return p != NULL;
606}
607
608#ifdef CONFIG_HIBERNATION
609/*
610 * Find the swap type that corresponds to given device (if any).
611 *
612 * @offset - number of the PAGE_SIZE-sized block of the device, starting
613 * from 0, in which the swap header is expected to be located.

--- 1427 unchanged lines hidden ---
607}
608
609#ifdef CONFIG_HIBERNATION
610/*
611 * Find the swap type that corresponds to given device (if any).
612 *
613 * @offset - number of the PAGE_SIZE-sized block of the device, starting
614 * from 0, in which the swap header is expected to be located.

--- 1427 unchanged lines hidden ---