summaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-12-06 20:34:10 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 08:39:27 -0800
commit3aef83e0ef1ffb8ea3bea97be46821a45c952173 (patch)
treef73878eb2ecce804c9eea6fbb13603907b3674b4 /kernel/power/swsusp.c
parent3fc6b34f4803b959c1e30c15247e2180cd529115 (diff)
downloadop-kernel-dev-3aef83e0ef1ffb8ea3bea97be46821a45c952173.zip
op-kernel-dev-3aef83e0ef1ffb8ea3bea97be46821a45c952173.tar.gz
[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 0b66659..4147a75 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)
return 0;
}
-unsigned long alloc_swap_page(int swap, struct bitmap_page *bitmap)
+sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap)
{
unsigned long offset;
offset = swp_offset(get_swap_page_of_type(swap));
if (offset) {
- if (bitmap_set(bitmap, offset)) {
+ if (bitmap_set(bitmap, offset))
swap_free(swp_entry(swap, offset));
- offset = 0;
- }
+ else
+ return swapdev_block(swap, offset);
}
- return offset;
+ return 0;
}
void free_all_swap_pages(int swap, struct bitmap_page *bitmap)
OpenPOWER on IntegriCloud