From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, Cesar Eduardo Barros <cesarb@cesarb.net>
Subject: [PATCH 2/3] kernel/power/swap.c: do not use end_swap_bio_read
Date: Sat, 22 May 2010 15:08:50 -0300 [thread overview]
Message-ID: <1274551731-4534-2-git-send-email-cesarb@cesarb.net> (raw)
In-Reply-To: <4BF81D87.6010506@cesarb.net>
The swap checksum patches will change end_swap_bio_read to also verify
the page's checksum. This is not compatible with its use at submit()
from kernel/power/swap.c.
Make kernel/power/swap.c use a private copy of end_swap_bio_read, and
modify it to not say "Read-error" if the error was on a write.
Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
---
include/linux/swap.h | 1 -
kernel/power/swap.c | 21 ++++++++++++++++++++-
mm/page_io.c | 2 +-
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1f59d93..86a0d64 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -291,7 +291,6 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
/* linux/mm/page_io.c */
extern int swap_readpage(struct page *);
extern int swap_writepage(struct page *page, struct writeback_control *wbc);
-extern void end_swap_bio_read(struct bio *bio, int err);
/* linux/mm/swap_state.c */
extern struct address_space swapper_space;
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 66824d7..7305a3f 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -147,6 +147,25 @@ int swsusp_swap_in_use(void)
static unsigned short root_swap = 0xffff;
static struct block_device *resume_bdev;
+static void end_swap_bio(struct bio *bio, int err)
+{
+ const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
+ struct page *page = bio->bi_io_vec[0].bv_page;
+
+ if (!uptodate) {
+ SetPageError(page);
+ ClearPageUptodate(page);
+ printk(KERN_ALERT "%s-error on swap-device (%u:%u:%Lu)\n",
+ bio->bi_rw & BIO_RW ? "Write" : "Read",
+ imajor(bio->bi_bdev->bd_inode),
+ iminor(bio->bi_bdev->bd_inode),
+ (unsigned long long)bio->bi_sector);
+ } else {
+ SetPageUptodate(page);
+ }
+ unlock_page(page);
+ bio_put(bio);
+}
/**
* submit - submit BIO request.
* @rw: READ or WRITE.
@@ -167,7 +186,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1);
bio->bi_sector = page_off * (PAGE_SIZE >> 9);
bio->bi_bdev = resume_bdev;
- bio->bi_end_io = end_swap_bio_read;
+ bio->bi_end_io = end_swap_bio;
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
printk(KERN_ERR "PM: Adding page to bio failed at %ld\n",
diff --git a/mm/page_io.c b/mm/page_io.c
index 31a3b96..0e2d4e8 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -66,7 +66,7 @@ static void end_swap_bio_write(struct bio *bio, int err)
bio_put(bio);
}
-void end_swap_bio_read(struct bio *bio, int err)
+static void end_swap_bio_read(struct bio *bio, int err)
{
const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
struct page *page = bio->bi_io_vec[0].bv_page;
--
1.6.6.1
next prev parent reply other threads:[~2010-05-22 18:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-22 18:08 [PATCH 0/3] mm: Swap checksum Cesar Eduardo Barros
2010-05-22 18:08 ` [PATCH 1/3] mm/swapfile.c: better messages for swap_info_get Cesar Eduardo Barros
2010-05-22 18:13 ` Borislav Petkov
2010-05-22 18:18 ` Cesar Eduardo Barros
2010-05-22 18:08 ` Cesar Eduardo Barros [this message]
2010-05-22 18:08 ` [PATCH 3/3] mm: Swap checksum Cesar Eduardo Barros
2010-05-23 15:19 ` Avi Kivity
2010-05-23 18:58 ` Cesar Eduardo Barros
2010-05-24 6:41 ` Avi Kivity
2010-05-24 7:32 ` Nick Piggin
2010-05-24 10:51 ` Avi Kivity
2010-05-24 11:24 ` Cesar Eduardo Barros
2010-05-23 14:03 ` [PATCH 0/3] " Minchan Kim
2010-05-23 18:32 ` Cesar Eduardo Barros
2010-05-24 0:09 ` Minchan Kim
2010-05-24 0:57 ` Cesar Eduardo Barros
2010-05-24 2:05 ` Minchan Kim
2010-05-24 10:50 ` Cesar Eduardo Barros
2010-05-25 23:52 ` Minchan Kim
2010-05-26 10:21 ` Cesar Eduardo Barros
2010-05-26 15:31 ` Minchan Kim
2010-05-26 21:28 ` Valdis.Kletnieks
2010-05-26 22:45 ` Minchan Kim
2010-05-26 23:19 ` Cesar Eduardo Barros
2010-05-26 23:27 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274551731-4534-2-git-send-email-cesarb@cesarb.net \
--to=cesarb@cesarb.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®