swapfile.c (39fe5434cb9de5da40510028b17b96bc4eb312b3) | swapfile.c (b0cb1a19d05b8ea8611a9ef48a17fe417f1832e6) |
---|---|
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> --- 411 unchanged lines hidden (view full) --- 420 delete_from_swap_cache(page); 421 SetPageDirty(page); 422 } 423 unlock_page(page); 424 page_cache_release(page); 425 } 426} 427 | 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> --- 411 unchanged lines hidden (view full) --- 420 delete_from_swap_cache(page); 421 SetPageDirty(page); 422 } 423 unlock_page(page); 424 page_cache_release(page); 425 } 426} 427 |
428#ifdef CONFIG_SOFTWARE_SUSPEND | 428#ifdef CONFIG_HIBERNATION |
429/* 430 * Find the swap type that corresponds to given device (if any). 431 * 432 * @offset - number of the PAGE_SIZE-sized block of the device, starting 433 * from 0, in which the swap header is expected to be located. 434 * 435 * This is needed for the suspend to disk (aka swsusp). 436 */ --- 509 unchanged lines hidden (view full) --- 946 if (lh == &sis->extent_list) 947 lh = lh->next; 948 se = list_entry(lh, struct swap_extent, list); 949 sis->curr_swap_extent = se; 950 BUG_ON(se == start_se); /* It *must* be present */ 951 } 952} 953 | 429/* 430 * Find the swap type that corresponds to given device (if any). 431 * 432 * @offset - number of the PAGE_SIZE-sized block of the device, starting 433 * from 0, in which the swap header is expected to be located. 434 * 435 * This is needed for the suspend to disk (aka swsusp). 436 */ --- 509 unchanged lines hidden (view full) --- 946 if (lh == &sis->extent_list) 947 lh = lh->next; 948 se = list_entry(lh, struct swap_extent, list); 949 sis->curr_swap_extent = se; 950 BUG_ON(se == start_se); /* It *must* be present */ 951 } 952} 953 |
954#ifdef CONFIG_SOFTWARE_SUSPEND | 954#ifdef CONFIG_HIBERNATION |
955/* 956 * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev 957 * corresponding to given index in swap_info (swap type). 958 */ 959sector_t swapdev_block(int swap_type, pgoff_t offset) 960{ 961 struct swap_info_struct *sis; 962 963 if (swap_type >= nr_swapfiles) 964 return 0; 965 966 sis = swap_info + swap_type; 967 return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0; 968} | 955/* 956 * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev 957 * corresponding to given index in swap_info (swap type). 958 */ 959sector_t swapdev_block(int swap_type, pgoff_t offset) 960{ 961 struct swap_info_struct *sis; 962 963 if (swap_type >= nr_swapfiles) 964 return 0; 965 966 sis = swap_info + swap_type; 967 return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0; 968} |
969#endif /* CONFIG_SOFTWARE_SUSPEND */ | 969#endif /* CONFIG_HIBERNATION */ |
970 971/* 972 * Free all of a swapdev's extent information 973 */ 974static void destroy_swap_extents(struct swap_info_struct *sis) 975{ 976 while (!list_empty(&sis->extent_list)) { 977 struct swap_extent *se; --- 821 unchanged lines hidden --- | 970 971/* 972 * Free all of a swapdev's extent information 973 */ 974static void destroy_swap_extents(struct swap_info_struct *sis) 975{ 976 while (!list_empty(&sis->extent_list)) { 977 struct swap_extent *se; --- 821 unchanged lines hidden --- |