From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 1/4] ext4: Move error reporting on bio completion to ext4_finish_bio()
Date: Wed, 10 May 2017 09:41:44 +0200 [thread overview]
Message-ID: <20170510074147.26743-2-jack@suse.cz> (raw)
In-Reply-To: <20170510074147.26743-1-jack@suse.cz>
Currently we were reporting errors from IO completion in ext4_end_bio().
Additionally we were setting page error bit in ext4_finish_bio() and
also unnecessarily calling mapping_set_error() again. Move all the error
reporting from IO completion to ext4_finish_bio().
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/page-io.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 1a82138ba739..61e4e25b8e95 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -62,6 +62,7 @@ static void ext4_finish_bio(struct bio *bio)
{
int i;
struct bio_vec *bvec;
+ bool error_reported = false;
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
@@ -87,7 +88,19 @@ static void ext4_finish_bio(struct bio *bio)
if (bio->bi_error) {
SetPageError(page);
- mapping_set_error(page->mapping, -EIO);
+ if (!error_reported) {
+ struct inode *inode = page->mapping->host;
+ sector_t bi_sector = bio->bi_iter.bi_sector;
+
+ ext4_warning(inode->i_sb,
+ "I/O error %d writing to inode %lu "
+ "(starting block %llu)",
+ bio->bi_error, inode->i_ino,
+ (unsigned long long)
+ bi_sector >> (inode->i_blkbits - 9));
+ mapping_set_error(page->mapping, bio->bi_error);
+ error_reported = true;
+ }
}
bh = head = page_buffers(page);
/*
@@ -296,7 +309,6 @@ ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end)
static void ext4_end_bio(struct bio *bio)
{
ext4_io_end_t *io_end = bio->bi_private;
- sector_t bi_sector = bio->bi_iter.bi_sector;
char b[BDEVNAME_SIZE];
if (WARN_ONCE(!io_end, "io_end is NULL: %s: sector %Lu len %u err %d\n",
@@ -310,19 +322,6 @@ static void ext4_end_bio(struct bio *bio)
}
bio->bi_end_io = NULL;
- if (bio->bi_error) {
- struct inode *inode = io_end->inode;
-
- ext4_warning(inode->i_sb, "I/O error %d writing to inode %lu "
- "(offset %llu size %ld starting block %llu)",
- bio->bi_error, inode->i_ino,
- (unsigned long long) io_end->offset,
- (long) io_end->size,
- (unsigned long long)
- bi_sector >> (inode->i_blkbits - 9));
- mapping_set_error(inode->i_mapping, bio->bi_error);
- }
next prev parent reply other threads:[~2017-05-10 7:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 7:41 [PATCH 0/4] ext4: Allow writeback IO without io_end Jan Kara
2017-05-10 7:41 ` Jan Kara [this message]
2017-05-10 7:41 ` [PATCH 2/4] ext4: Allow IO submission " Jan Kara
2017-05-10 7:41 ` [PATCH 3/4] ext4: Don't allocate io_end for writeback from ext4_writepage() Jan Kara
2017-05-10 7:41 ` [PATCH 4/4] ext4: Remove unnecessary io_end allocation from ext4_writepages() Jan Kara
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=20170510074147.26743-2-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).