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/3] ext4: Allow IO submission without io_end
Date: Tue, 11 Apr 2017 15:54:16 +0200 [thread overview]
Message-ID: <20170411135418.9638-2-jack@suse.cz> (raw)
In-Reply-To: <20170411135418.9638-1-jack@suse.cz>
Allow submission of bio through ext4_bio_write_page() without io_end.
For the case where we are not converting unwritten extents we don't need
io_end for anything anyway.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/ext4/page-io.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 208241b06662..a8a6caf4752a 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -298,23 +298,20 @@ 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;
- BUG_ON(!io_end);
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)",
+ "(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);
}
- if (io_end->flag & EXT4_IO_END_UNWRITTEN) {
+ if (io_end && io_end->flag & EXT4_IO_END_UNWRITTEN) {
/*
* Link bio into list hanging from io_end. We have to do it
* atomically as bio completions can be racing against each
@@ -322,15 +319,17 @@ static void ext4_end_bio(struct bio *bio)
*/
bio->bi_private = xchg(&io_end->bio, bio);
ext4_put_io_end_defer(io_end);
- } else {
+ return;
+ }
+ if (io_end) {
/*
* Drop io_end reference early. Inode can get freed once
* we finish the bio.
*/
ext4_put_io_end_defer(io_end);
- ext4_finish_bio(bio);
- bio_put(bio);
}
+ ext4_finish_bio(bio);
+ bio_put(bio);
}
void ext4_io_submit(struct ext4_io_submit *io)
@@ -366,7 +365,8 @@ static int io_submit_init_bio(struct ext4_io_submit *io,
bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
bio->bi_bdev = bh->b_bdev;
bio->bi_end_io = ext4_end_bio;
- bio->bi_private = ext4_get_io_end(io->io_end);
+ if (io->io_end)
+ bio->bi_private = ext4_get_io_end(io->io_end);
io->io_bio = bio;
io->io_next_block = bh->b_blocknr;
return 0;
--
2.12.0
next prev parent reply other threads:[~2017-04-11 13:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 13:54 [PATCH 0/3] ext4: Avoid transaction stalls during writeback Jan Kara
2017-04-11 13:54 ` Jan Kara [this message]
2017-04-30 22:01 ` [PATCH 1/3] ext4: Allow IO submission without io_end Theodore Ts'o
2017-04-30 22:30 ` [PATCH -v2] ext4: avoid unnecessary transaction stalls during writeback Theodore Ts'o
2017-05-02 12:10 ` Jan Kara
2017-05-02 14:18 ` Theodore Ts'o
2017-04-11 13:54 ` [PATCH 2/3] ext4: Don't allocate io_end for writeback from ext4_writepage() Jan Kara
2017-04-11 13:54 ` [PATCH 3/3] ext4: Avoid unnecessary transaction stalls during writeback Jan Kara
2017-04-11 15:00 ` Amir Goldstein
2017-04-11 16:16 ` Jan Kara
2017-04-30 0:47 ` Theodore Ts'o
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=20170411135418.9638-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).