swsusp: kill one-line helpers, handle read errors
From: Pavel Machek
Date: Sat Dec 25 2004 - 12:55:49 EST
Hi!
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. Please apply,
Pavel
Signed-off-by: Pavel Machek <pavel@xxxxxxx>
--- clean-cvs/kernel/power/swsusp.c 2004-12-14 20:43:42.000000000 +0100
+++ linux-cvs/kernel/power/swsusp.c 2004-12-14 20:48:31.000000000 +0100
@@ -1003,24 +984,14 @@
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;
/**
@@ -1055,9 +1026,12 @@
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;
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/