Commit 5948edbc authored by Roman Pen's avatar Roman Pen Committed by Jens Axboe

fs/mpage.c: forgotten WRITE_SYNC in case of data integrity write

In case of wbc->sync_mode == WB_SYNC_ALL we need to do data integrity
write, thus mark request as WRITE_SYNC.

akpm: afaict this change will cause the data integrity write bios to be
placed onto the second queue in cfq_io_cq.cfqq[], which presumably results
in special treatment.  The documentation for REQ_SYNC is horrid.
Signed-off-by: 's avatarRoman Pen <r.peniaev@gmail.com>
Reviewed-by: 's avatarJan Kara <jack@suse.cz>
Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: 's avatarTejun Heo <tj@kernel.org>
Signed-off-by: 's avatarJens Axboe <axboe@fb.com>
parent f75782e4
...@@ -482,6 +482,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -482,6 +482,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
struct buffer_head map_bh; struct buffer_head map_bh;
loff_t i_size = i_size_read(inode); loff_t i_size = i_size_read(inode);
int ret = 0; int ret = 0;
int wr = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
if (page_has_buffers(page)) { if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page); struct buffer_head *head = page_buffers(page);
...@@ -590,7 +591,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -590,7 +591,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
* This page will go to BIO. Do we need to send this BIO off first? * This page will go to BIO. Do we need to send this BIO off first?
*/ */
if (bio && mpd->last_block_in_bio != blocks[0] - 1) if (bio && mpd->last_block_in_bio != blocks[0] - 1)
bio = mpage_bio_submit(WRITE, bio); bio = mpage_bio_submit(wr, bio);
alloc_new: alloc_new:
if (bio == NULL) { if (bio == NULL) {
...@@ -617,7 +618,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -617,7 +618,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
wbc_account_io(wbc, page, PAGE_SIZE); wbc_account_io(wbc, page, PAGE_SIZE);
length = first_unmapped << blkbits; length = first_unmapped << blkbits;
if (bio_add_page(bio, page, length, 0) < length) { if (bio_add_page(bio, page, length, 0) < length) {
bio = mpage_bio_submit(WRITE, bio); bio = mpage_bio_submit(wr, bio);
goto alloc_new; goto alloc_new;
} }
...@@ -627,7 +628,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -627,7 +628,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
set_page_writeback(page); set_page_writeback(page);
unlock_page(page); unlock_page(page);
if (boundary || (first_unmapped != blocks_per_page)) { if (boundary || (first_unmapped != blocks_per_page)) {
bio = mpage_bio_submit(WRITE, bio); bio = mpage_bio_submit(wr, bio);
if (boundary_block) { if (boundary_block) {
write_boundary_block(boundary_bdev, write_boundary_block(boundary_bdev,
boundary_block, 1 << blkbits); boundary_block, 1 << blkbits);
...@@ -639,7 +640,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc, ...@@ -639,7 +640,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
confused: confused:
if (bio) if (bio)
bio = mpage_bio_submit(WRITE, bio); bio = mpage_bio_submit(wr, bio);
if (mpd->use_writepage) { if (mpd->use_writepage) {
ret = mapping->a_ops->writepage(page, wbc); ret = mapping->a_ops->writepage(page, wbc);
...@@ -695,8 +696,11 @@ mpage_writepages(struct address_space *mapping, ...@@ -695,8 +696,11 @@ mpage_writepages(struct address_space *mapping,
}; };
ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd); ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd);
if (mpd.bio) if (mpd.bio) {
mpage_bio_submit(WRITE, mpd.bio); int wr = (wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC : WRITE);
mpage_bio_submit(wr, mpd.bio);
}
} }
blk_finish_plug(&plug); blk_finish_plug(&plug);
return ret; return ret;
...@@ -713,8 +717,11 @@ int mpage_writepage(struct page *page, get_block_t get_block, ...@@ -713,8 +717,11 @@ int mpage_writepage(struct page *page, get_block_t get_block,
.use_writepage = 0, .use_writepage = 0,
}; };
int ret = __mpage_writepage(page, wbc, &mpd); int ret = __mpage_writepage(page, wbc, &mpd);
if (mpd.bio) if (mpd.bio) {
mpage_bio_submit(WRITE, mpd.bio); int wr = (wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC : WRITE);
mpage_bio_submit(wr, mpd.bio);
}
return ret; return ret;
} }
EXPORT_SYMBOL(mpage_writepage); EXPORT_SYMBOL(mpage_writepage);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment