diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-12-06 23:34:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:27 -0500 |
commit | 3aef83e0ef1ffb8ea3bea97be46821a45c952173 (patch) | |
tree | f73878eb2ecce804c9eea6fbb13603907b3674b4 /kernel/power/user.c | |
parent | 3fc6b34f4803b959c1e30c15247e2180cd529115 (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/user.c')
-rw-r--r-- | kernel/power/user.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c index a327b18a5ffd..f0b7ef8bdd74 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -126,7 +126,8 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
126 | { | 126 | { |
127 | int error = 0; | 127 | int error = 0; |
128 | struct snapshot_data *data; | 128 | struct snapshot_data *data; |
129 | loff_t offset, avail; | 129 | loff_t avail; |
130 | sector_t offset; | ||
130 | 131 | ||
131 | if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) | 132 | if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) |
132 | return -ENOTTY; | 133 | return -ENOTTY; |
@@ -240,10 +241,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
240 | break; | 241 | break; |
241 | } | 242 | } |
242 | } | 243 | } |
243 | offset = alloc_swap_page(data->swap, data->bitmap); | 244 | offset = alloc_swapdev_block(data->swap, data->bitmap); |
244 | if (offset) { | 245 | if (offset) { |
245 | offset <<= PAGE_SHIFT; | 246 | offset <<= PAGE_SHIFT; |
246 | error = put_user(offset, (loff_t __user *)arg); | 247 | error = put_user(offset, (sector_t __user *)arg); |
247 | } else { | 248 | } else { |
248 | error = -ENOSPC; | 249 | error = -ENOSPC; |
249 | } | 250 | } |