diff options
| -rw-r--r-- | fs/ext4/page-io.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7270dcfca92a..4e9b0a242f4c 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
| @@ -190,6 +190,7 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 190 | struct inode *inode; | 190 | struct inode *inode; |
| 191 | unsigned long flags; | 191 | unsigned long flags; |
| 192 | int i; | 192 | int i; |
| 193 | sector_t bi_sector = bio->bi_sector; | ||
| 193 | 194 | ||
| 194 | BUG_ON(!io_end); | 195 | BUG_ON(!io_end); |
| 195 | bio->bi_private = NULL; | 196 | bio->bi_private = NULL; |
| @@ -207,9 +208,7 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 207 | if (error) | 208 | if (error) |
| 208 | SetPageError(page); | 209 | SetPageError(page); |
| 209 | BUG_ON(!head); | 210 | BUG_ON(!head); |
| 210 | if (head->b_size == PAGE_CACHE_SIZE) | 211 | if (head->b_size != PAGE_CACHE_SIZE) { |
| 211 | clear_buffer_dirty(head); | ||
| 212 | else { | ||
| 213 | loff_t offset; | 212 | loff_t offset; |
| 214 | loff_t io_end_offset = io_end->offset + io_end->size; | 213 | loff_t io_end_offset = io_end->offset + io_end->size; |
| 215 | 214 | ||
| @@ -221,7 +220,6 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 221 | if (error) | 220 | if (error) |
| 222 | buffer_io_error(bh); | 221 | buffer_io_error(bh); |
| 223 | 222 | ||
| 224 | clear_buffer_dirty(bh); | ||
| 225 | } | 223 | } |
| 226 | if (buffer_delay(bh)) | 224 | if (buffer_delay(bh)) |
| 227 | partial_write = 1; | 225 | partial_write = 1; |
| @@ -257,7 +255,7 @@ static void ext4_end_bio(struct bio *bio, int error) | |||
| 257 | (unsigned long long) io_end->offset, | 255 | (unsigned long long) io_end->offset, |
| 258 | (long) io_end->size, | 256 | (long) io_end->size, |
| 259 | (unsigned long long) | 257 | (unsigned long long) |
| 260 | bio->bi_sector >> (inode->i_blkbits - 9)); | 258 | bi_sector >> (inode->i_blkbits - 9)); |
| 261 | } | 259 | } |
| 262 | 260 | ||
| 263 | /* Add the io_end to per-inode completed io list*/ | 261 | /* Add the io_end to per-inode completed io list*/ |
| @@ -380,6 +378,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
| 380 | 378 | ||
| 381 | blocksize = 1 << inode->i_blkbits; | 379 | blocksize = 1 << inode->i_blkbits; |
| 382 | 380 | ||
| 381 | BUG_ON(!PageLocked(page)); | ||
| 383 | BUG_ON(PageWriteback(page)); | 382 | BUG_ON(PageWriteback(page)); |
| 384 | set_page_writeback(page); | 383 | set_page_writeback(page); |
| 385 | ClearPageError(page); | 384 | ClearPageError(page); |
| @@ -397,12 +396,14 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
| 397 | for (bh = head = page_buffers(page), block_start = 0; | 396 | for (bh = head = page_buffers(page), block_start = 0; |
| 398 | bh != head || !block_start; | 397 | bh != head || !block_start; |
| 399 | block_start = block_end, bh = bh->b_this_page) { | 398 | block_start = block_end, bh = bh->b_this_page) { |
| 399 | |||
| 400 | block_end = block_start + blocksize; | 400 | block_end = block_start + blocksize; |
| 401 | if (block_start >= len) { | 401 | if (block_start >= len) { |
| 402 | clear_buffer_dirty(bh); | 402 | clear_buffer_dirty(bh); |
| 403 | set_buffer_uptodate(bh); | 403 | set_buffer_uptodate(bh); |
| 404 | continue; | 404 | continue; |
| 405 | } | 405 | } |
| 406 | clear_buffer_dirty(bh); | ||
| 406 | ret = io_submit_add_bh(io, io_page, inode, wbc, bh); | 407 | ret = io_submit_add_bh(io, io_page, inode, wbc, bh); |
| 407 | if (ret) { | 408 | if (ret) { |
| 408 | /* | 409 | /* |
