Commit 11826755 authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[PATCH] swsusp: kill one-line helpers, handle read errors

swsusp contains few one-line helpers that only make reading/understanding code
more difficult.  Also warn the user when something goes wrong, instead of
waking machine with corrupt data.
Signed-off-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fb8fa704
......@@ -1001,24 +1001,14 @@ static int __init swsusp_pagedir_relocate(void)
static atomic_t io_done = ATOMIC_INIT(0);
static void start_io(void)
{
atomic_set(&io_done,1);
}
static int end_io(struct bio * bio, unsigned int num, int err)
{
atomic_set(&io_done,0);
if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
panic("I/O error reading memory image");
atomic_set(&io_done, 0);
return 0;
}
static void wait_io(void)
{
while(atomic_read(&io_done))
io_schedule();
}
static struct block_device * resume_bdev;
/**
......@@ -1053,9 +1043,12 @@ static int submit(int rw, pgoff_t page_off, void * page)
if (rw == WRITE)
bio_set_pages_dirty(bio);
start_io();
atomic_set(&io_done, 1);
submit_bio(rw | (1 << BIO_RW_SYNC), bio);
wait_io();
while (atomic_read(&io_done))
yield();
Done:
bio_put(bio);
return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment