Skip to content

Commit 5948edb

Browse files
roumingaxboe
authored andcommitted
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: Roman Pen <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Tejun Heo <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f75782e commit 5948edb

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

fs/mpage.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
482482
struct buffer_head map_bh;
483483
loff_t i_size = i_size_read(inode);
484484
int ret = 0;
485+
int wr = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
485486

486487
if (page_has_buffers(page)) {
487488
struct buffer_head *head = page_buffers(page);
@@ -590,7 +591,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
590591
* This page will go to BIO. Do we need to send this BIO off first?
591592
*/
592593
if (bio && mpd->last_block_in_bio != blocks[0] - 1)
593-
bio = mpage_bio_submit(WRITE, bio);
594+
bio = mpage_bio_submit(wr, bio);
594595

595596
alloc_new:
596597
if (bio == NULL) {
@@ -617,7 +618,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
617618
wbc_account_io(wbc, page, PAGE_SIZE);
618619
length = first_unmapped << blkbits;
619620
if (bio_add_page(bio, page, length, 0) < length) {
620-
bio = mpage_bio_submit(WRITE, bio);
621+
bio = mpage_bio_submit(wr, bio);
621622
goto alloc_new;
622623
}
623624

@@ -627,7 +628,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
627628
set_page_writeback(page);
628629
unlock_page(page);
629630
if (boundary || (first_unmapped != blocks_per_page)) {
630-
bio = mpage_bio_submit(WRITE, bio);
631+
bio = mpage_bio_submit(wr, bio);
631632
if (boundary_block) {
632633
write_boundary_block(boundary_bdev,
633634
boundary_block, 1 << blkbits);
@@ -639,7 +640,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
639640

640641
confused:
641642
if (bio)
642-
bio = mpage_bio_submit(WRITE, bio);
643+
bio = mpage_bio_submit(wr, bio);
643644

644645
if (mpd->use_writepage) {
645646
ret = mapping->a_ops->writepage(page, wbc);
@@ -695,8 +696,11 @@ mpage_writepages(struct address_space *mapping,
695696
};
696697

697698
ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd);
698-
if (mpd.bio)
699-
mpage_bio_submit(WRITE, mpd.bio);
699+
if (mpd.bio) {
700+
int wr = (wbc->sync_mode == WB_SYNC_ALL ?
701+
WRITE_SYNC : WRITE);
702+
mpage_bio_submit(wr, mpd.bio);
703+
}
700704
}
701705
blk_finish_plug(&plug);
702706
return ret;
@@ -713,8 +717,11 @@ int mpage_writepage(struct page *page, get_block_t get_block,
713717
.use_writepage = 0,
714718
};
715719
int ret = __mpage_writepage(page, wbc, &mpd);
716-
if (mpd.bio)
717-
mpage_bio_submit(WRITE, mpd.bio);
720+
if (mpd.bio) {
721+
int wr = (wbc->sync_mode == WB_SYNC_ALL ?
722+
WRITE_SYNC : WRITE);
723+
mpage_bio_submit(wr, mpd.bio);
724+
}
718725
return ret;
719726
}
720727
EXPORT_SYMBOL(mpage_writepage);

0 commit comments

Comments
 (0)