* [v2 PATCH 1/1] fs/mpage.c: forgotten WRITE_SYNC in case of WB_SYNC_ALL
@ 2014-03-14 15:34 Roman Pen
2014-04-01 20:50 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Roman Pen @ 2014-03-14 15:34 UTC (permalink / raw)
Cc: Roman Pen, Jens Axboe, Tejun Heo, Andrew Morton, linux-fsdevel,
linux-kernel
When data integrity operation happens (sync, fsync, fdatasync calls)
writeback control is set to WB_SYNC_ALL. In that case all write
requests are marked with WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
indicating that caller is waiting for completion and block layer or
block device should prioritize the IO avoiding any possible delays.
But mpage writeback path ignores marking requests as WRITE_SYNC.
This patch fixes this.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
fs/mpage.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/fs/mpage.c b/fs/mpage.c
index 4979ffa..4e0af5a 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -462,6 +462,7 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
struct buffer_head map_bh;
loff_t i_size = i_size_read(inode);
int ret = 0;
+ int wr = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
if (page_has_buffers(page)) {
struct buffer_head *head = page_buffers(page);
@@ -570,7 +571,7 @@ page_is_mapped:
* 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)
- bio = mpage_bio_submit(WRITE, bio);
+ bio = mpage_bio_submit(wr, bio);
alloc_new:
if (bio == NULL) {
@@ -587,7 +588,7 @@ alloc_new:
*/
length = first_unmapped << blkbits;
if (bio_add_page(bio, page, length, 0) < length) {
- bio = mpage_bio_submit(WRITE, bio);
+ bio = mpage_bio_submit(wr, bio);
goto alloc_new;
}
@@ -620,7 +621,7 @@ alloc_new:
set_page_writeback(page);
unlock_page(page);
if (boundary || (first_unmapped != blocks_per_page)) {
- bio = mpage_bio_submit(WRITE, bio);
+ bio = mpage_bio_submit(wr, bio);
if (boundary_block) {
write_boundary_block(boundary_bdev,
boundary_block, 1 << blkbits);
@@ -632,7 +633,7 @@ alloc_new:
confused:
if (bio)
- bio = mpage_bio_submit(WRITE, bio);
+ bio = mpage_bio_submit(wr, bio);
if (mpd->use_writepage) {
ret = mapping->a_ops->writepage(page, wbc);
@@ -688,8 +689,11 @@ mpage_writepages(struct address_space *mapping,
};
ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd);
- if (mpd.bio)
- mpage_bio_submit(WRITE, mpd.bio);
+ if (mpd.bio) {
+ int wr = (wbc->sync_mode == WB_SYNC_ALL ?
+ WRITE_SYNC : WRITE);
+ mpage_bio_submit(wr, mpd.bio);
+ }
}
blk_finish_plug(&plug);
return ret;
@@ -706,8 +710,11 @@ int mpage_writepage(struct page *page, get_block_t get_block,
.use_writepage = 0,
};
int ret = __mpage_writepage(page, wbc, &mpd);
- if (mpd.bio)
- mpage_bio_submit(WRITE, mpd.bio);
+ if (mpd.bio) {
+ int wr = (wbc->sync_mode == WB_SYNC_ALL ?
+ WRITE_SYNC : WRITE);
+ mpage_bio_submit(wr, mpd.bio);
+ }
return ret;
}
EXPORT_SYMBOL(mpage_writepage);
--
1.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [v2 PATCH 1/1] fs/mpage.c: forgotten WRITE_SYNC in case of WB_SYNC_ALL
2014-03-14 15:34 [v2 PATCH 1/1] fs/mpage.c: forgotten WRITE_SYNC in case of WB_SYNC_ALL Roman Pen
@ 2014-04-01 20:50 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2014-04-01 20:50 UTC (permalink / raw)
To: Roman Pen; +Cc: Jens Axboe, Tejun Heo, linux-fsdevel, linux-kernel
On Sat, 15 Mar 2014 00:34:28 +0900 Roman Pen <r.peniaev@gmail.com> wrote:
> When data integrity operation happens (sync, fsync, fdatasync calls)
> writeback control is set to WB_SYNC_ALL. In that case all write
> requests are marked with WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
> indicating that caller is waiting for completion and block layer or
> block device should prioritize the IO avoiding any possible delays.
>
> But mpage writeback path ignores marking requests as WRITE_SYNC.
>
> This patch fixes this.
Sorry, but it would be unwise to merge this without a good
understanding of its runtime effects.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-01 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-14 15:34 [v2 PATCH 1/1] fs/mpage.c: forgotten WRITE_SYNC in case of WB_SYNC_ALL Roman Pen
2014-04-01 20:50 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).