mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
swap: rework map_swap_page() again
Seems that page_io.c doesn't really need to know that page_private(page) is the swp_entry 'val'. Rework map_swap_page() to do what its name says and map a page to a page offset in the swap space. The only other caller of map_swap_page() is internal to mm/swapfile.c and it does want to map a swap entry to the 'sector'. So rename map_swap_page() to map_swap_entry(), make it 'static' and and implement map_swap_page() as a wrapper around that. Signed-off-by: Lee Schermerhorn <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
7509765a29
commit
d4906e1aa5
3 changed files with 18 additions and 8 deletions
|
|
@ -38,6 +38,7 @@
|
|||
static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
|
||||
unsigned char);
|
||||
static void free_swap_count_continuations(struct swap_info_struct *);
|
||||
static sector_t map_swap_entry(swp_entry_t, struct block_device**);
|
||||
|
||||
static DEFINE_SPINLOCK(swap_lock);
|
||||
static unsigned int nr_swapfiles;
|
||||
|
|
@ -782,7 +783,7 @@ sector_t swapdev_block(int type, pgoff_t offset)
|
|||
return 0;
|
||||
if (!(swap_info[type]->flags & SWP_WRITEOK))
|
||||
return 0;
|
||||
return map_swap_page(swp_entry(type, offset), &bdev);
|
||||
return map_swap_entry(swp_entry(type, offset), &bdev);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1249,10 +1250,11 @@ static void drain_mmlist(void)
|
|||
|
||||
/*
|
||||
* Use this swapdev's extent info to locate the (PAGE_SIZE) block which
|
||||
* corresponds to page offset `offset'. Note that the type of this function
|
||||
* is sector_t, but it returns page offset into the bdev, not sector offset.
|
||||
* corresponds to page offset for the specified swap entry.
|
||||
* Note that the type of this function is sector_t, but it returns page offset
|
||||
* into the bdev, not sector offset.
|
||||
*/
|
||||
sector_t map_swap_page(swp_entry_t entry, struct block_device **bdev)
|
||||
static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev)
|
||||
{
|
||||
struct swap_info_struct *sis;
|
||||
struct swap_extent *start_se;
|
||||
|
|
@ -1280,6 +1282,16 @@ sector_t map_swap_page(swp_entry_t entry, struct block_device **bdev)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the page offset into bdev for the specified page's swap entry.
|
||||
*/
|
||||
sector_t map_swap_page(struct page *page, struct block_device **bdev)
|
||||
{
|
||||
swp_entry_t entry;
|
||||
entry.val = page_private(page);
|
||||
return map_swap_entry(entry, bdev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free all of a swapdev's extent information
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue