Commit 7714d598 authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[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: default avatarPavel Machek <pavel@suse.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2139bdd5
...@@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page) ...@@ -743,7 +743,6 @@ static int submit(int rw, pgoff_t page_off, void *page)
if (!bio) if (!bio)
return -ENOMEM; return -ENOMEM;
bio->bi_sector = page_off * (PAGE_SIZE >> 9); bio->bi_sector = page_off * (PAGE_SIZE >> 9);
bio_get(bio);
bio->bi_bdev = resume_bdev; bio->bi_bdev = resume_bdev;
bio->bi_end_io = end_io; bio->bi_end_io = end_io;
...@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page) ...@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page)
goto Done; goto Done;
} }
if (rw == WRITE)
bio_set_pages_dirty(bio);
atomic_set(&io_done, 1); atomic_set(&io_done, 1);
submit_bio(rw | (1 << BIO_RW_SYNC), bio); submit_bio(rw | (1 << BIO_RW_SYNC), bio);
while (atomic_read(&io_done)) while (atomic_read(&io_done))
yield(); yield();
if (rw == READ)
bio_set_pages_dirty(bio);
Done: Done:
bio_put(bio); bio_put(bio);
return error; 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