diff options
author | Pavel Machek <pavel@ucw.cz> | 2006-02-07 15:58:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-07 19:12:31 -0500 |
commit | 7714d5985bb7101a90fb427dc29dc592cf1b960e (patch) | |
tree | 60079a07fcbe5ac38c48e0ddc24d8132c66abe8c /kernel/power | |
parent | 2139bdd5b15a4cc450adb17da836f33c16477188 (diff) |
[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>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/swsusp.c | 6 |
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) | |||
743 | if (!bio) | 743 | if (!bio) |
744 | return -ENOMEM; | 744 | return -ENOMEM; |
745 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); | 745 | bio->bi_sector = page_off * (PAGE_SIZE >> 9); |
746 | bio_get(bio); | ||
747 | bio->bi_bdev = resume_bdev; | 746 | bio->bi_bdev = resume_bdev; |
748 | bio->bi_end_io = end_io; | 747 | bio->bi_end_io = end_io; |
749 | 748 | ||
@@ -753,14 +752,13 @@ static int submit(int rw, pgoff_t page_off, void *page) | |||
753 | goto Done; | 752 | goto Done; |
754 | } | 753 | } |
755 | 754 | ||
756 | if (rw == WRITE) | ||
757 | bio_set_pages_dirty(bio); | ||
758 | 755 | ||
759 | atomic_set(&io_done, 1); | 756 | atomic_set(&io_done, 1); |
760 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); | 757 | submit_bio(rw | (1 << BIO_RW_SYNC), bio); |
761 | while (atomic_read(&io_done)) | 758 | while (atomic_read(&io_done)) |
762 | yield(); | 759 | yield(); |
763 | 760 | if (rw == READ) | |
761 | bio_set_pages_dirty(bio); | ||
764 | Done: | 762 | Done: |
765 | bio_put(bio); | 763 | bio_put(bio); |
766 | return error; | 764 | return error; |