From: Matthias Maennich <maennich@google.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 1/3] aio_tio: determine alignment based on target block device
Date: Tue, 26 Feb 2019 17:02:41 +0000 [thread overview]
Message-ID: <20190226170243.134366-2-maennich@google.com> (raw)
In-Reply-To: <20190226170243.134366-1-maennich@google.com>
The alignment for O_DIRECT operations has to match the blocksize of the
underlying block device. Determine the alignment from the target file.
aio_tio test cases 1 and 2 failed (nondeterministic) on aarch64 when run
on a 4096 byte blocksize and with an alignment of 512 bytes.
Determining the blocksize from the block device and using it for the
alignment resolves the test issue.
Signed-off-by: Matthias Maennich <maennich@google.com>
Reviewed-by: Alessio Balsini <balsini@google.com>
Reviewed-by: Steve Muckle <smuckle@google.com>
---
testcases/kernel/io/aio/aio02/aio_tio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/io/aio/aio02/aio_tio.c b/testcases/kernel/io/aio/aio02/aio_tio.c
index 623c81a5e..ddf71e85b 100644
--- a/testcases/kernel/io/aio/aio02/aio_tio.c
+++ b/testcases/kernel/io/aio/aio02/aio_tio.c
@@ -34,6 +34,7 @@
#include "config.h"
#include "common.h"
#include "test.h"
+#include "safe_macros.h"
#include <string.h>
#include <errno.h>
@@ -42,7 +43,6 @@
#define AIO_MAXIO 32
#define AIO_BLKSIZE (64*1024)
-static int alignment = 512;
static int wait_count = 0;
/*
@@ -94,6 +94,8 @@ int io_tio(char *pathname, int flag, int n, int operation)
void *bufptr = NULL;
off_t offset = 0;
struct timespec timeout;
+ struct stat fi_stat;
+ size_t alignment;
io_context_t myctx;
struct iocb iocb_array[AIO_MAXIO];
@@ -105,6 +107,10 @@ int io_tio(char *pathname, int flag, int n, int operation)
return -1;
}
+ /* determine the alignment from the blksize of the underlying device */
+ SAFE_FSTAT(NULL, fd, &fi_stat);
+ alignment = fi_stat.st_blksize;
+
res = io_queue_init(n, &myctx);
//printf (" res = %d \n", res);
--
2.21.0.rc2.261.ga7da99ff1b-goog
next prev parent reply other threads:[~2019-02-26 17:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 8:53 [LTP] [PATCH v2 1/2] aio_tio: fix error diagnosis for byte transfers Matthias Maennich
2019-01-11 8:53 ` [LTP] [PATCH v2 2/2] aio_tio: determine alignment based on target filesystem Matthias Maennich
2019-01-29 18:19 ` Steve Muckle
2019-02-22 15:33 ` Cyril Hrubis
2019-02-26 15:37 ` Matthias =?unknown-8bit?q?M=C3=A4nnich?=
2019-02-20 15:20 ` [LTP] [PATCH v3 0/3] aio_tio: fixes and conversion to new lib Matthias Maennich
2019-02-20 15:20 ` [LTP] [PATCH v3 1/3] aio_tio: fix error diagnosis for byte transfers Matthias Maennich
2019-02-20 15:20 ` [LTP] [PATCH v3 2/3] aio_tio: determine alignment based on target filesystem Matthias Maennich
2019-02-20 15:20 ` [LTP] [PATCH v3 3/3] aio_tio: convert to new lib Matthias Maennich
2019-02-22 20:40 ` Steve Muckle
2019-02-22 15:28 ` [LTP] [PATCH v2 1/2] aio_tio: fix error diagnosis for byte transfers Cyril Hrubis
2019-02-26 17:02 ` [LTP] [PATCH v4 0/3] aio_tio: fixes and conversion to new lib Matthias Maennich
2019-02-26 17:02 ` Matthias Maennich [this message]
2019-02-26 17:02 ` [LTP] [PATCH v4 2/3] aio_tio: convert " Matthias Maennich
2019-02-26 19:13 ` Steve Muckle
2019-03-15 11:50 ` Petr Vorel
2019-02-26 17:02 ` [LTP] [PATCH v4 3/3] io/aio: cleanup test directory Matthias Maennich
2019-02-26 19:16 ` Steve Muckle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190226170243.134366-2-maennich@google.com \
--to=maennich@google.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.