# HG changeset patch
# User akw@xxxxxxxxxxx
# Node ID 7bfd8efb4fa7d2e2f90bd21af3407cd2fd28744a
# Parent 8273f730371bfabbfa15f79a47a59ada06711aec
Reduce AIO context allocations in blktap.
Signed-off-by: Andrew Warfield <andy@xxxxxxxxxxxxx>
---
tools/blktap/drivers/block-aio.c | 19 ++++++++++++++-----
tools/blktap/drivers/block-qcow.c | 19 +++++++++++++++----
2 files changed, 29 insertions(+), 9 deletions(-)
diff -r 8273f730371b -r 7bfd8efb4fa7 tools/blktap/drivers/block-aio.c
--- a/tools/blktap/drivers/block-aio.c Tue Aug 29 12:23:11 2006 +0100
+++ b/tools/blktap/drivers/block-aio.c Tue Aug 29 14:34:57 2006 -0700
@@ -52,7 +52,7 @@
*/
#define REQUEST_ASYNC_FD 1
-#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ * 8)
+#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ)
struct pending_aio {
td_callback_t cb;
@@ -146,7 +146,7 @@ int tdaio_open (struct td_state *s, cons
struct tdaio_state *prv = (struct tdaio_state *)s->private;
s->private = prv;
- DPRINTF("XXX: block-aio open('%s')", name);
+ DPRINTF("block-aio open('%s')", name);
/* Initialize AIO */
prv->iocb_free_count = MAX_AIO_REQS;
prv->iocb_queued = 0;
@@ -156,9 +156,18 @@ int tdaio_open (struct td_state *s, cons
if (prv->poll_fd < 0) {
ret = prv->poll_fd;
- DPRINTF("Couldn't get fd for AIO poll support. This is "
- "probably because your kernel does not have the "
- "aio-poll patch applied.\n");
+ if (ret == -EAGAIN) {
+ DPRINTF("Couldn't setup AIO context. If you are "
+ "trying to concurrently use a large number "
+ "of blktap-based disks, you may need to "
+ "increase the system-wide aio request limit. "
+ "(e.g. 'echo echo 1048576 > /proc/sys/"
+ "aio-max-nr')\n");
+ } else {
+ DPRINTF("Couldn't get fd for AIO poll support. This "
+ "is probably because your kernel does not "
+ "have the aio-poll patch applied.\n");
+ }
goto done;
}
diff -r 8273f730371b -r 7bfd8efb4fa7 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c Tue Aug 29 12:23:11 2006 +0100
+++ b/tools/blktap/drivers/block-qcow.c Tue Aug 29 14:34:57 2006 -0700
@@ -51,7 +51,7 @@
/******AIO DEFINES******/
#define REQUEST_ASYNC_FD 1
#define MAX_QCOW_IDS 0xFFFF
-#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ * 8)
+#define MAX_AIO_REQS (MAX_REQUESTS * MAX_SEGMENTS_PER_REQ)
struct pending_aio {
td_callback_t cb;
@@ -176,10 +176,21 @@ static int init_aio_state(struct td_stat
s->aio_ctx = (io_context_t) REQUEST_ASYNC_FD;
s->poll_fd = io_setup(MAX_AIO_REQS, &s->aio_ctx);
- if (s->poll_fd < 0) {
- DPRINTF("Retrieving Async poll fd failed\n");
+ if (s->poll_fd < 0) {
+ if (s->poll_fd == -EAGAIN) {
+ DPRINTF("Couldn't setup AIO context. If you are "
+ "trying to concurrently use a large number "
+ "of blktap-based disks, you may need to "
+ "increase the system-wide aio request limit. "
+ "(e.g. 'echo echo 1048576 > /proc/sys/"
+ "aio-max-nr')\n");
+ } else {
+ DPRINTF("Couldn't get fd for AIO poll support. This "
+ "is probably because your kernel does not "
+ "have the aio-poll patch applied.\n");
+ }
goto fail;
- }
+ }
for (i=0;i<MAX_AIO_REQS;i++)
s->iocb_free[i] = &s->iocb_list[i];
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|