summaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/ubd_user.c
diff options
context:
space:
mode:
authorAnton Ivanov <aivanov@kot-begemot.co.uk>2016-11-09 20:43:25 +0000
committerRichard Weinberger <richard@nod.at>2016-12-14 22:46:55 +0100
commitf88f0bdfc32f3d1e2fd03ec8a7f7b456df4db725 (patch)
tree7eed7ad5a2f795f8b45187db4955eff9c5ef049a /arch/um/drivers/ubd_user.c
parent69973b830859bc6529a7a0468ba0d80ee5117826 (diff)
downloadlinux-f88f0bdfc32f3d1e2fd03ec8a7f7b456df4db725.tar.bz2
um: UBD Improvements
UBD at present is extremely slow because it handles only one request at a time in the IO thread and IRQ handler. The single request at a time is replaced by handling multiple requests as well as necessary workarounds for short reads/writes. Resulting performance improvement in disk IO - 30% Signed-off-by: Anton Ivanov <aivanov@kot-begemot.co.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers/ubd_user.c')
-rw-r--r--arch/um/drivers/ubd_user.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index e376f9b9c68d..6f744794d141 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -1,4 +1,5 @@
-/*
+/*
+ * Copyright (C) 2016 Anton Ivanov (aivanov@brocade.com)
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
* Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com)
* Licensed under the GPL
@@ -20,6 +21,9 @@
#include "ubd.h"
#include <os.h>
+#include <poll.h>
+
+struct pollfd kernel_pollfd;
int start_io_thread(unsigned long sp, int *fd_out)
{
@@ -32,9 +36,12 @@ int start_io_thread(unsigned long sp, int *fd_out)
}
kernel_fd = fds[0];
+ kernel_pollfd.fd = kernel_fd;
+ kernel_pollfd.events = POLLIN;
*fd_out = fds[1];
err = os_set_fd_block(*fd_out, 0);
+ err = os_set_fd_block(kernel_fd, 0);
if (err) {
printk("start_io_thread - failed to set nonblocking I/O.\n");
goto out_close;
@@ -57,3 +64,15 @@ int start_io_thread(unsigned long sp, int *fd_out)
out:
return err;
}
+
+int ubd_read_poll(int timeout)
+{
+ kernel_pollfd.events = POLLIN;
+ return poll(&kernel_pollfd, 1, timeout);
+}
+int ubd_write_poll(int timeout)
+{
+ kernel_pollfd.events = POLLOUT;
+ return poll(&kernel_pollfd, 1, timeout);
+}
+