linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: Make sync_file_range(2) use WB_SYNC_NONE writeback
@ 2015-10-24 19:28 Jan Kara
  2015-10-28  9:30 ` Andres Freund
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2015-10-24 19:28 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Andrew Morton, Andres Freund, Al Viro, Jan Kara

sync_file_range(2) is documented to issue writeback only for pages that
are not currently being written. After all the system call has been
created for userspace to be able to issue background writeout and so
waiting for in-flight IO is undesirable there. However commit
ee53a891f474 (mm: do_sync_mapping_range integrity fix) switched
do_sync_mapping_range() and thus sync_file_range() to issue writeback in
WB_SYNC_ALL mode since do_sync_mapping_range() was used by other code
relying on WB_SYNC_ALL semantics.

These days do_sync_mapping_range() went away and we can switch
sync_file_range(2) back to issuing WB_SYNC_NONE writeback. That should
help PostgreSQL avoid large latency spikes when flushing data in the
background.

Reported-by: Andres Freund <andres@anarazel.de>
Signed-off-by: Jan Kara <jack@suse.com>
---
 fs/sync.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/sync.c b/fs/sync.c
index fbc98ee62044..ef60e812d771 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -343,7 +343,8 @@ SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
 	}
 
 	if (flags & SYNC_FILE_RANGE_WRITE) {
-		ret = filemap_fdatawrite_range(mapping, offset, endbyte);
+		ret = __filemap_fdatawrite_range(mapping, offset, endbyte,
+						 WB_SYNC_NONE);
 		if (ret < 0)
 			goto out_put;
 	}
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-06 20:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-24 19:28 [PATCH] fs: Make sync_file_range(2) use WB_SYNC_NONE writeback Jan Kara
2015-10-28  9:30 ` Andres Freund
2015-10-28 14:18   ` Jan Kara
2015-11-06 13:06     ` Andres Freund
2015-11-06 20:43       ` Jan Kara

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).