From 8eac986fe42ab1aa1f2a0bb11dbe993ff2412c24 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 4 Jun 2009 16:32:24 -0500 Subject: [PATCH] aio-dio-regress: fix aio-dio-extend-stat on s390 This patch: o Changes the BUFSIZE to 4096 so that we can successfully perform direct I/O on devices that have a sector size of 4k, such as the virtual disks found on the s390 architecture. o Removes an unused variable. o Checks the proper field in the ioevent to determine if there was an error in the I/O submission. Signed-off-by: Jeff Moyer Signed-off-by: Zach Brown Reviewed-by: Eric Sandeen --- src/aio-dio-regress/aio-dio-extend-stat.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/aio-dio-regress/aio-dio-extend-stat.c b/src/aio-dio-regress/aio-dio-extend-stat.c index c274e582..1cbd7e11 100644 --- a/src/aio-dio-regress/aio-dio-extend-stat.c +++ b/src/aio-dio-regress/aio-dio-extend-stat.c @@ -44,7 +44,7 @@ * in 2.6.20. This test should fail on 2.6.19. */ -#define BUFSIZE 1024 +#define BUFSIZE 4096 static unsigned char buf[BUFSIZE] __attribute((aligned (4096))); @@ -68,8 +68,6 @@ io_context_t ctxp; struct iocb *iocbs[MAX_AIO_EVENTS]; struct io_event ioevents[MAX_AIO_EVENTS]; -volatile int submittedSize = 0; //synchronization - int main(int argc, char **argv) { pthread_t thread_read; @@ -140,20 +138,19 @@ void fun_read(void *ptr) n -= r; for (i = 0; i < r; ++i) { - if (ioevents[i].obj->u.c.nbytes != BUFSIZE) - fail("error in block: expacted %d bytes, " - "receiced %ld\n", BUFSIZE, - ioevents[i].obj->u.c.nbytes); + struct io_event *event = &ioevents[i]; + if (event->res != BUFSIZE) + fail("error in block: expected %d bytes, " + "received %ld\n", BUFSIZE, + event->obj->u.c.nbytes); - exSize = ioevents[i].obj->u.c.offset + - ioevents[i].obj->u.c.nbytes; + exSize = event->obj->u.c.offset + event->obj->u.c.nbytes; fstat(handle, &filestat); if (filestat.st_size < exSize) fail("write of %lu bytes @%llu finished, " "expected filesize at least %llu, but " - "got %ld\n", ioevents[i].obj->u.c.nbytes, - ioevents[i].obj->u.c.offset, exSize, - filestat.st_size); + "got %ld\n", event->obj->u.c.nbytes, + event->obj->u.c.offset, exSize, filestat.st_size); } } } -- 2.39.5