diff options
Diffstat (limited to 'kernel/power/swap.c')
-rw-r--r-- | kernel/power/swap.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index b18c155cbb60..e83ed9945a80 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -243,7 +243,6 @@ struct swap_map_page { | |||
243 | struct swap_map_handle { | 243 | struct swap_map_handle { |
244 | struct swap_map_page *cur; | 244 | struct swap_map_page *cur; |
245 | sector_t cur_swap; | 245 | sector_t cur_swap; |
246 | struct bitmap_page *bitmap; | ||
247 | unsigned int k; | 246 | unsigned int k; |
248 | }; | 247 | }; |
249 | 248 | ||
@@ -252,9 +251,6 @@ static void release_swap_writer(struct swap_map_handle *handle) | |||
252 | if (handle->cur) | 251 | if (handle->cur) |
253 | free_page((unsigned long)handle->cur); | 252 | free_page((unsigned long)handle->cur); |
254 | handle->cur = NULL; | 253 | handle->cur = NULL; |
255 | if (handle->bitmap) | ||
256 | free_bitmap(handle->bitmap); | ||
257 | handle->bitmap = NULL; | ||
258 | } | 254 | } |
259 | 255 | ||
260 | static int get_swap_writer(struct swap_map_handle *handle) | 256 | static int get_swap_writer(struct swap_map_handle *handle) |
@@ -262,12 +258,7 @@ static int get_swap_writer(struct swap_map_handle *handle) | |||
262 | handle->cur = (struct swap_map_page *)get_zeroed_page(GFP_KERNEL); | 258 | handle->cur = (struct swap_map_page *)get_zeroed_page(GFP_KERNEL); |
263 | if (!handle->cur) | 259 | if (!handle->cur) |
264 | return -ENOMEM; | 260 | return -ENOMEM; |
265 | handle->bitmap = alloc_bitmap(count_swap_pages(root_swap, 0)); | 261 | handle->cur_swap = alloc_swapdev_block(root_swap); |
266 | if (!handle->bitmap) { | ||
267 | release_swap_writer(handle); | ||
268 | return -ENOMEM; | ||
269 | } | ||
270 | handle->cur_swap = alloc_swapdev_block(root_swap, handle->bitmap); | ||
271 | if (!handle->cur_swap) { | 262 | if (!handle->cur_swap) { |
272 | release_swap_writer(handle); | 263 | release_swap_writer(handle); |
273 | return -ENOSPC; | 264 | return -ENOSPC; |
@@ -284,7 +275,7 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf, | |||
284 | 275 | ||
285 | if (!handle->cur) | 276 | if (!handle->cur) |
286 | return -EINVAL; | 277 | return -EINVAL; |
287 | offset = alloc_swapdev_block(root_swap, handle->bitmap); | 278 | offset = alloc_swapdev_block(root_swap); |
288 | error = write_page(buf, offset, bio_chain); | 279 | error = write_page(buf, offset, bio_chain); |
289 | if (error) | 280 | if (error) |
290 | return error; | 281 | return error; |
@@ -293,7 +284,7 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf, | |||
293 | error = wait_on_bio_chain(bio_chain); | 284 | error = wait_on_bio_chain(bio_chain); |
294 | if (error) | 285 | if (error) |
295 | goto out; | 286 | goto out; |
296 | offset = alloc_swapdev_block(root_swap, handle->bitmap); | 287 | offset = alloc_swapdev_block(root_swap); |
297 | if (!offset) | 288 | if (!offset) |
298 | return -ENOSPC; | 289 | return -ENOSPC; |
299 | handle->cur->next_swap = offset; | 290 | handle->cur->next_swap = offset; |
@@ -430,7 +421,8 @@ int swsusp_write(void) | |||
430 | } | 421 | } |
431 | } | 422 | } |
432 | if (error) | 423 | if (error) |
433 | free_all_swap_pages(root_swap, handle.bitmap); | 424 | free_all_swap_pages(root_swap); |
425 | |||
434 | release_swap_writer(&handle); | 426 | release_swap_writer(&handle); |
435 | out: | 427 | out: |
436 | swsusp_close(); | 428 | swsusp_close(); |