diff options
author | Hugh Dickins <hugh.dickins@tiscali.co.uk> | 2009-12-14 20:58:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 11:53:13 -0500 |
commit | f29ad6a99b596b8169744d107bf088e8be9e8d0d (patch) | |
tree | e138bf9eeb751defd358eb5aca8113e2645ded3d /mm/page_io.c | |
parent | 976d6dfbb0175d136fc098854bbce0c028a3924b (diff) |
swap_info: private to swapfile.c
The swap_info_struct is mostly private to mm/swapfile.c, with only
one other in-tree user: get_swap_bio(). Adjust its interface to
map_swap_page(), so that we can then remove get_swap_info_struct().
But there is a popular user out-of-tree, TuxOnIce: so leave the
declaration of swap_info_struct in linux/swap.h.
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Nigel Cunningham <ncunningham@crca.org.au>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_io.c')
-rw-r--r-- | mm/page_io.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index c6f3e5071de3..afeed89a0a5d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -19,20 +19,17 @@ | |||
19 | #include <linux/writeback.h> | 19 | #include <linux/writeback.h> |
20 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
21 | 21 | ||
22 | static struct bio *get_swap_bio(gfp_t gfp_flags, pgoff_t index, | 22 | static struct bio *get_swap_bio(gfp_t gfp_flags, |
23 | struct page *page, bio_end_io_t end_io) | 23 | struct page *page, bio_end_io_t end_io) |
24 | { | 24 | { |
25 | struct bio *bio; | 25 | struct bio *bio; |
26 | 26 | ||
27 | bio = bio_alloc(gfp_flags, 1); | 27 | bio = bio_alloc(gfp_flags, 1); |
28 | if (bio) { | 28 | if (bio) { |
29 | struct swap_info_struct *sis; | 29 | swp_entry_t entry; |
30 | swp_entry_t entry = { .val = index, }; | 30 | entry.val = page_private(page); |
31 | 31 | bio->bi_sector = map_swap_page(entry, &bio->bi_bdev); | |
32 | sis = get_swap_info_struct(swp_type(entry)); | 32 | bio->bi_sector <<= PAGE_SHIFT - 9; |
33 | bio->bi_sector = map_swap_page(sis, swp_offset(entry)) * | ||
34 | (PAGE_SIZE >> 9); | ||
35 | bio->bi_bdev = sis->bdev; | ||
36 | bio->bi_io_vec[0].bv_page = page; | 33 | bio->bi_io_vec[0].bv_page = page; |
37 | bio->bi_io_vec[0].bv_len = PAGE_SIZE; | 34 | bio->bi_io_vec[0].bv_len = PAGE_SIZE; |
38 | bio->bi_io_vec[0].bv_offset = 0; | 35 | bio->bi_io_vec[0].bv_offset = 0; |
@@ -102,8 +99,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) | |||
102 | unlock_page(page); | 99 | unlock_page(page); |
103 | goto out; | 100 | goto out; |
104 | } | 101 | } |
105 | bio = get_swap_bio(GFP_NOIO, page_private(page), page, | 102 | bio = get_swap_bio(GFP_NOIO, page, end_swap_bio_write); |
106 | end_swap_bio_write); | ||
107 | if (bio == NULL) { | 103 | if (bio == NULL) { |
108 | set_page_dirty(page); | 104 | set_page_dirty(page); |
109 | unlock_page(page); | 105 | unlock_page(page); |
@@ -127,8 +123,7 @@ int swap_readpage(struct page *page) | |||
127 | 123 | ||
128 | VM_BUG_ON(!PageLocked(page)); | 124 | VM_BUG_ON(!PageLocked(page)); |
129 | VM_BUG_ON(PageUptodate(page)); | 125 | VM_BUG_ON(PageUptodate(page)); |
130 | bio = get_swap_bio(GFP_KERNEL, page_private(page), page, | 126 | bio = get_swap_bio(GFP_KERNEL, page, end_swap_bio_read); |
131 | end_swap_bio_read); | ||
132 | if (bio == NULL) { | 127 | if (bio == NULL) { |
133 | unlock_page(page); | 128 | unlock_page(page); |
134 | ret = -ENOMEM; | 129 | ret = -ENOMEM; |