]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
aio-dio-regress: fix aio-dio-extend-stat on s390
authorEric Sandeen <sandeen@sandeen.net>
Thu, 4 Jun 2009 21:32:24 +0000 (16:32 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 4 Jun 2009 21:32:24 +0000 (16:32 -0500)
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>
src/aio-dio-regress/aio-dio-extend-stat.c

index c274e58204fea951ed7c0b1ae3922c185031382b..1cbd7e11e17250c987faf965f114f3ba94ec2bdd 100644 (file)
@@ -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);
                }
        }
 }