aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-12-06 23:34:10 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:27 -0500
commit3aef83e0ef1ffb8ea3bea97be46821a45c952173 (patch)
treef73878eb2ecce804c9eea6fbb13603907b3674b4 /kernel/power/swsusp.c
parent3fc6b34f4803b959c1e30c15247e2180cd529115 (diff)
[PATCH] swsusp: use block device offsets to identify swap locations
Make swsusp use block device offsets instead of swap offsets to identify swap locations and make it use the same code paths for writing as well as for reading data. This allows us to use the same code for handling swap files and swap partitions and to simplify the code, eg. by dropping rw_swap_page_sync(). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 0b66659dc516..4147a756a8c7 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -134,18 +134,18 @@ static int bitmap_set(struct bitmap_page *bitmap, unsigned long bit)
134 return 0; 134 return 0;
135} 135}
136 136
137unsigned long alloc_swap_page(int swap, struct bitmap_page *bitmap) 137sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap)
138{ 138{
139 unsigned long offset; 139 unsigned long offset;
140 140
141 offset = swp_offset(get_swap_page_of_type(swap)); 141 offset = swp_offset(get_swap_page_of_type(swap));
142 if (offset) { 142 if (offset) {
143 if (bitmap_set(bitmap, offset)) { 143 if (bitmap_set(bitmap, offset))
144 swap_free(swp_entry(swap, offset)); 144 swap_free(swp_entry(swap, offset));
145 offset = 0; 145 else
146 } 146 return swapdev_block(swap, offset);
147 } 147 }
148 return offset; 148 return 0;
149} 149}
150 150
151void free_all_swap_pages(int swap, struct bitmap_page *bitmap) 151void free_all_swap_pages(int swap, struct bitmap_page *bitmap)