From: Anton Ivanov <antiv...@cisco.com> If the ubd is asynchronous the amount of time uml will spend fsync-ing on FLUSH is unpredictable. There are bits in the upper fs layers that really dislike this. Replacing fsync() with an async flush request via sync_file_range mitigates this (somewhat), improves performance significantly without making filesystem integrity much worse (compared to the original async writes + flush).
Signed-off-by: Anton Ivanov <antiv...@cisco.com> --- arch/um/drivers/ubd.h | 1 + arch/um/drivers/ubd_kern.c | 2 +- arch/um/drivers/ubd_user.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/um/drivers/ubd.h b/arch/um/drivers/ubd.h index 3b48cd2..5847fff 100644 --- a/arch/um/drivers/ubd.h +++ b/arch/um/drivers/ubd.h @@ -8,6 +8,7 @@ #define __UM_UBD_USER_H extern int start_io_thread(unsigned long sp, int *fds_out); +extern int ubd_async_fsync(int fd); extern int io_thread(void *arg); extern int kernel_fd; diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 80f8655..ccfaa9d 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1410,7 +1410,7 @@ static void do_io(struct io_thread_req *req) if (req->op == UBD_FLUSH) { /* fds[0] is always either the rw image or our cow file */ - n = os_sync_file(req->fds[0]); + n = ubd_async_fsync(req->fds[0]); if (n != 0) { printk("do_io - sync failed err = %d " "fd = %d\n", -n, req->fds[0]); diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c index 6833fc5..4970087 100644 --- a/arch/um/drivers/ubd_user.c +++ b/arch/um/drivers/ubd_user.c @@ -17,10 +17,17 @@ #include <sys/param.h> #include <endian.h> #include <byteswap.h> +#include <fcntl.h> #include "ubd.h" #include <os.h> +int ubd_async_fsync(int fd) { + int ret; + CATCH_EINTR(ret = sync_file_range(fd, 0, 0, SYNC_FILE_RANGE_WRITE)); + return ret; +} + int start_io_thread(unsigned long sp, int *fd_out) { int pid, fds[2], err; -- 1.7.10.4 ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel