* [LTP] [PATCH 1/2] aio_tio: fix error diagnosis for byte transfers
@ 2019-01-10 13:28 Matthias Maennich
2019-01-10 13:28 ` [LTP] [PATCH 2/2] aio_tio: determine alignment based on target filesystem Matthias Maennich
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Maennich @ 2019-01-10 13:28 UTC (permalink / raw)
To: ltp
In case the expected bytes written during an async io operation did not
match the actually written ones, the wrong error code (res2) had been
reported. Correct that to reflect the error condition (res!=bytes).
Signed-off-by: Matthias Maennich <maennich@google.com>
---
testcases/kernel/io/aio/aio02/aio_tio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/io/aio/aio02/aio_tio.c b/testcases/kernel/io/aio/aio02/aio_tio.c
index 08fb04162..623c81a5e 100644
--- a/testcases/kernel/io/aio/aio02/aio_tio.c
+++ b/testcases/kernel/io/aio/aio02/aio_tio.c
@@ -57,7 +57,7 @@ static void work_done(io_context_t ctx, struct iocb *iocb, long res, long res2)
if (res != iocb->u.c.nbytes) {
fprintf(stderr, "write missed bytes expect %lu got %ld\n",
- iocb->u.c.nbytes, res2);
+ iocb->u.c.nbytes, res);
exit(1);
}
wait_count--;
--
2.20.1.97.g81188d93c3-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH 2/2] aio_tio: determine alignment based on target filesystem
2019-01-10 13:28 [LTP] [PATCH 1/2] aio_tio: fix error diagnosis for byte transfers Matthias Maennich
@ 2019-01-10 13:28 ` Matthias Maennich
2019-01-11 5:56 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Maennich @ 2019-01-10 13:28 UTC (permalink / raw)
To: ltp
The alignment for O_DIRECT operations has to match the blocksize of the
underlying filesystem. Determine the alignment from the target file's
file system.
aio_tio test cases 1 and 2 failed (nondeterministic) on aarch64 when run
on a 4096 byte blocksize filesystem and with an alignment of 512 bytes.
Determining the blocksize from the file system 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>
---
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..b2d9a7bec 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 "tst_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 fs */
+ SAFE_FSTAT(fd, &fi_stat);
+ alignment = fi_stat.st_blksize;
+
res = io_queue_init(n, &myctx);
//printf (" res = %d \n", res);
--
2.20.1.97.g81188d93c3-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH 2/2] aio_tio: determine alignment based on target filesystem
2019-01-10 13:28 ` [LTP] [PATCH 2/2] aio_tio: determine alignment based on target filesystem Matthias Maennich
@ 2019-01-11 5:56 ` Li Wang
0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2019-01-11 5:56 UTC (permalink / raw)
To: ltp
On Thu, Jan 10, 2019 at 10:03 PM Matthias Maennich <maennich@google.com> wrote:
>
> The alignment for O_DIRECT operations has to match the blocksize of the
> underlying filesystem. Determine the alignment from the target file's
> file system.
>
> aio_tio test cases 1 and 2 failed (nondeterministic) on aarch64 when run
> on a 4096 byte blocksize filesystem and with an alignment of 512 bytes.
>
> Determining the blocksize from the file system 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>
> ---
> 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..b2d9a7bec 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 "tst_safe_macros.h"
Since aio_tio.c is still written in old API, so here we probably need
to include original safe_macros.h but not the tst_safe_macros.h which
is for new LTP API.
>
> + /* determine the alignment from the blksize of the underlying fs */
> + SAFE_FSTAT(fd, &fi_stat);
Then, here needs old using way too: SAFE_FSTAT(NULL, fd, &fi_stat);
Beside these tiny issues, patch set LGTM.
--
Regards,
Li Wang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-11 5:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-10 13:28 [LTP] [PATCH 1/2] aio_tio: fix error diagnosis for byte transfers Matthias Maennich
2019-01-10 13:28 ` [LTP] [PATCH 2/2] aio_tio: determine alignment based on target filesystem Matthias Maennich
2019-01-11 5:56 ` Li Wang
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.