diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 2bfacbac0f4c..55242363de64 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -945,6 +945,23 @@ sector_t map_swap_page(struct swap_info_struct *sis, pgoff_t offset) | |||
945 | } | 945 | } |
946 | } | 946 | } |
947 | 947 | ||
948 | #ifdef CONFIG_SOFTWARE_SUSPEND | ||
949 | /* | ||
950 | * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev | ||
951 | * corresponding to given index in swap_info (swap type). | ||
952 | */ | ||
953 | sector_t swapdev_block(int swap_type, pgoff_t offset) | ||
954 | { | ||
955 | struct swap_info_struct *sis; | ||
956 | |||
957 | if (swap_type >= nr_swapfiles) | ||
958 | return 0; | ||
959 | |||
960 | sis = swap_info + swap_type; | ||
961 | return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0; | ||
962 | } | ||
963 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | ||
964 | |||
948 | /* | 965 | /* |
949 | * Free all of a swapdev's extent information | 966 | * Free all of a swapdev's extent information |
950 | */ | 967 | */ |