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 <jmoyer@redhat.com>
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Eric Sandeen
2009-06-04 16:32:24 -05:00
parent 66b36d1952
commit 8eac986fe4
+9 -12
View File
@@ -44,7 +44,7 @@
* in 2.6.20. This test should fail on 2.6.19. * 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))); static unsigned char buf[BUFSIZE] __attribute((aligned (4096)));
@@ -68,8 +68,6 @@ io_context_t ctxp;
struct iocb *iocbs[MAX_AIO_EVENTS]; struct iocb *iocbs[MAX_AIO_EVENTS];
struct io_event ioevents[MAX_AIO_EVENTS]; struct io_event ioevents[MAX_AIO_EVENTS];
volatile int submittedSize = 0; //synchronization
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
pthread_t thread_read; pthread_t thread_read;
@@ -140,20 +138,19 @@ void fun_read(void *ptr)
n -= r; n -= r;
for (i = 0; i < r; ++i) { for (i = 0; i < r; ++i) {
if (ioevents[i].obj->u.c.nbytes != BUFSIZE) struct io_event *event = &ioevents[i];
fail("error in block: expacted %d bytes, " if (event->res != BUFSIZE)
"receiced %ld\n", BUFSIZE, fail("error in block: expected %d bytes, "
ioevents[i].obj->u.c.nbytes); "received %ld\n", BUFSIZE,
event->obj->u.c.nbytes);
exSize = ioevents[i].obj->u.c.offset + exSize = event->obj->u.c.offset + event->obj->u.c.nbytes;
ioevents[i].obj->u.c.nbytes;
fstat(handle, &filestat); fstat(handle, &filestat);
if (filestat.st_size < exSize) if (filestat.st_size < exSize)
fail("write of %lu bytes @%llu finished, " fail("write of %lu bytes @%llu finished, "
"expected filesize at least %llu, but " "expected filesize at least %llu, but "
"got %ld\n", ioevents[i].obj->u.c.nbytes, "got %ld\n", event->obj->u.c.nbytes,
ioevents[i].obj->u.c.offset, exSize, event->obj->u.c.offset, exSize, filestat.st_size);
filestat.st_size);
} }
} }
} }