1 ext4: allow IO submission without io_end
3 From: Jan Kara <jack@suse.cz>
5 Allow submission of bio through ext4_bio_write_page() without io_end.
6 For the case where we are not converting unwritten extents we don't need
7 io_end for anything anyway.
9 Signed-off-by: Jan Kara <jack@suse.cz>
10 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 fs/ext4/page-io.c | 18 +++++++++---------
13 1 file changed, 9 insertions(+), 9 deletions(-)
15 diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
16 index 208241b06662..a8a6caf4752a 100644
17 --- a/fs/ext4/page-io.c
18 +++ b/fs/ext4/page-io.c
19 @@ -298,23 +298,20 @@ static void ext4_end_bio(struct bio *bio)
20 ext4_io_end_t *io_end = bio->bi_private;
21 sector_t bi_sector = bio->bi_iter.bi_sector;
24 bio->bi_end_io = NULL;
27 struct inode *inode = io_end->inode;
29 ext4_warning(inode->i_sb, "I/O error %d writing to inode %lu "
30 - "(offset %llu size %ld starting block %llu)",
31 + "(starting block %llu)",
32 bio->bi_error, inode->i_ino,
33 - (unsigned long long) io_end->offset,
34 - (long) io_end->size,
36 bi_sector >> (inode->i_blkbits - 9));
37 mapping_set_error(inode->i_mapping, bio->bi_error);
40 - if (io_end->flag & EXT4_IO_END_UNWRITTEN) {
41 + if (io_end && io_end->flag & EXT4_IO_END_UNWRITTEN) {
43 * Link bio into list hanging from io_end. We have to do it
44 * atomically as bio completions can be racing against each
45 @@ -322,15 +319,17 @@ static void ext4_end_bio(struct bio *bio)
47 bio->bi_private = xchg(&io_end->bio, bio);
48 ext4_put_io_end_defer(io_end);
54 * Drop io_end reference early. Inode can get freed once
57 ext4_put_io_end_defer(io_end);
58 - ext4_finish_bio(bio);
61 + ext4_finish_bio(bio);
65 void ext4_io_submit(struct ext4_io_submit *io)
66 @@ -366,7 +365,8 @@ static int io_submit_init_bio(struct ext4_io_submit *io,
67 bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
68 bio->bi_bdev = bh->b_bdev;
69 bio->bi_end_io = ext4_end_bio;
70 - bio->bi_private = ext4_get_io_end(io->io_end);
72 + bio->bi_private = ext4_get_io_end(io->io_end);
74 io->io_next_block = bh->b_blocknr;