summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2006-02-07 21:58:22 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-08 01:12:31 +0100
commit7714d5985bb7101a90fb427dc29dc592cf1b960e (patch)
tree60079a07fcbe5ac38c48e0ddc24d8132c66abe8c
parent[PATCH] drivers/base/bus.c warning fixes (diff)
downloadlinux-7714d5985bb7101a90fb427dc29dc592cf1b960e.tar.xz
linux-7714d5985bb7101a90fb427dc29dc592cf1b960e.zip
[PATCH] swsusp: kill unneeded/unbalanced bio_get
- Remove unneeded bio_get() which would cause a bio leak - Writing doesn't dirty pages. Reading dirties pages. - We should dirty the pages after the IO completion, not before (Busy-waiting for disk I/O completion isn't very polite.) Signed-off-by: Pavel Machek <pavel@suse.cz> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/power/swsusp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 59c91c148e82..4e90905f0e87 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page)
if (!bio)
return -ENOMEM;
bio->bi_sector = page_off * (PAGE_SIZE >> 9);
- bio_get(bio);
bio->bi_bdev = resume_bdev;
bio->bi_end_io = end_io;
@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page)
goto Done;
}
- if (rw == WRITE)
- bio_set_pages_dirty(bio);
atomic_set(&io_done, 1);
submit_bio(rw | (1 << BIO_RW_SYNC), bio);
while (atomic_read(&io_done))
yield();
-
+ if (rw == READ)
+ bio_set_pages_dirty(bio);
Done:
bio_put(bio);
return error;