diff options
Diffstat (limited to 'fs/ext4/page-io.c')
-rw-r--r-- | fs/ext4/page-io.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 955cc309142f..b6dbd056fcb1 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -259,6 +259,11 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
259 | bi_sector >> (inode->i_blkbits - 9)); | 259 | bi_sector >> (inode->i_blkbits - 9)); |
260 | } | 260 | } |
261 | 261 | ||
262 | if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) { | ||
263 | ext4_free_io_end(io_end); | ||
264 | return; | ||
265 | } | ||
266 | |||
262 | /* Add the io_end to per-inode completed io list*/ | 267 | /* Add the io_end to per-inode completed io list*/ |
263 | spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags); | 268 | spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags); |
264 | list_add_tail(&io_end->list, &EXT4_I(inode)->i_completed_io_list); | 269 | list_add_tail(&io_end->list, &EXT4_I(inode)->i_completed_io_list); |
@@ -279,9 +284,9 @@ void ext4_io_submit(struct ext4_io_submit *io) | |||
279 | BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP)); | 284 | BUG_ON(bio_flagged(io->io_bio, BIO_EOPNOTSUPP)); |
280 | bio_put(io->io_bio); | 285 | bio_put(io->io_bio); |
281 | } | 286 | } |
282 | io->io_bio = 0; | 287 | io->io_bio = NULL; |
283 | io->io_op = 0; | 288 | io->io_op = 0; |
284 | io->io_end = 0; | 289 | io->io_end = NULL; |
285 | } | 290 | } |
286 | 291 | ||
287 | static int io_submit_init(struct ext4_io_submit *io, | 292 | static int io_submit_init(struct ext4_io_submit *io, |
@@ -310,8 +315,7 @@ static int io_submit_init(struct ext4_io_submit *io, | |||
310 | io_end->offset = (page->index << PAGE_CACHE_SHIFT) + bh_offset(bh); | 315 | io_end->offset = (page->index << PAGE_CACHE_SHIFT) + bh_offset(bh); |
311 | 316 | ||
312 | io->io_bio = bio; | 317 | io->io_bio = bio; |
313 | io->io_op = (wbc->sync_mode == WB_SYNC_ALL ? | 318 | io->io_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE); |
314 | WRITE_SYNC_PLUG : WRITE); | ||
315 | io->io_next_block = bh->b_blocknr; | 319 | io->io_next_block = bh->b_blocknr; |
316 | return 0; | 320 | return 0; |
317 | } | 321 | } |
@@ -381,8 +385,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
381 | 385 | ||
382 | BUG_ON(!PageLocked(page)); | 386 | BUG_ON(!PageLocked(page)); |
383 | BUG_ON(PageWriteback(page)); | 387 | BUG_ON(PageWriteback(page)); |
384 | set_page_writeback(page); | ||
385 | ClearPageError(page); | ||
386 | 388 | ||
387 | io_page = kmem_cache_alloc(io_page_cachep, GFP_NOFS); | 389 | io_page = kmem_cache_alloc(io_page_cachep, GFP_NOFS); |
388 | if (!io_page) { | 390 | if (!io_page) { |
@@ -393,6 +395,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
393 | io_page->p_page = page; | 395 | io_page->p_page = page; |
394 | atomic_set(&io_page->p_count, 1); | 396 | atomic_set(&io_page->p_count, 1); |
395 | get_page(page); | 397 | get_page(page); |
398 | set_page_writeback(page); | ||
399 | ClearPageError(page); | ||
396 | 400 | ||
397 | for (bh = head = page_buffers(page), block_start = 0; | 401 | for (bh = head = page_buffers(page), block_start = 0; |
398 | bh != head || !block_start; | 402 | bh != head || !block_start; |