diff mbox series

[v3] aio02: Drop O_DIRECT flag for tmpfs

Message ID 1581502051-17240-1-git-send-email-xuyang2018.jy@cn.fujitsu.com
State Accepted
Headers show
Series [v3] aio02: Drop O_DIRECT flag for tmpfs | expand

Commit Message

Yang Xu Feb. 12, 2020, 10:07 a.m. UTC
tmpfs doesn't support O_DIRECT flag, drop it. So user still can run aio02
with different filesystem by mounting specified filesystem on $TMPDIR.

Also remove unused static value initialization.

Reviewed-by: Xiao Yang <ice_yangxiao@163.com>
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
 testcases/kernel/io/aio/aio02.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Jan Stancek Feb. 12, 2020, 1:37 p.m. UTC | #1
----- Original Message -----
> tmpfs doesn't support O_DIRECT flag, drop it. So user still can run aio02
> with different filesystem by mounting specified filesystem on $TMPDIR.
> 
> Also remove unused static value initialization.
> 
> Reviewed-by: Xiao Yang <ice_yangxiao@163.com>
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
>  testcases/kernel/io/aio/aio02.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Acked-by: Jan Stancek <jstancek@redhat.com>
Xiao Yang Feb. 13, 2020, 3:03 a.m. UTC | #2
On 2020/2/12 21:37, Jan Stancek wrote:
>
> ----- Original Message -----
>> tmpfs doesn't support O_DIRECT flag, drop it. So user still can run aio02
>> with different filesystem by mounting specified filesystem on $TMPDIR.
>>
>> Also remove unused static value initialization.
>>
>> Reviewed-by: Xiao Yang<ice_yangxiao@163.com>
>> Signed-off-by: Yang Xu<xuyang2018.jy@cn.fujitsu.com>
>> ---
>>   testcases/kernel/io/aio/aio02.c | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
> Acked-by: Jan Stancek<jstancek@redhat.com>
>
>
Hi all,

Thanks, I will push it with a minor change:
Keep original tc->flags and change cloned new_flags for tmpfs so that 
running aio02
in loops can report the 'Drop ...' hint for each changed subtest.  As below:
Without the change:
-----------------------------------------------------------------------------------
[root@Fedora-30 aio]# ./aio02 -i 2
tst_test.c:1215: INFO: Timeout per run is 0h 05m 00s
aio02.c:210: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:218: PASS: WRITE: O_WRONLY | O_TRUNC | O_DIRECT | O_LARGEFILE | 
O_CREAT
aio02.c:210: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:218: PASS: READ : O_RDONLY | O_DIRECT | O_LARGEFILE
aio02.c:218: PASS: WRITE: O_RDWR | O_TRUNC
aio02.c:218: PASS: READ : O_RDWR
aio02.c:218: PASS: WRITE: O_WRONLY | O_TRUNC
aio02.c:218: PASS: READ : O_RDONLY
aio02.c:218: PASS: WRITE: O_WRONLY | O_TRUNC | O_DIRECT | O_LARGEFILE | 
O_CREAT
aio02.c:218: PASS: READ : O_RDONLY | O_DIRECT | O_LARGEFILE
aio02.c:218: PASS: WRITE: O_RDWR | O_TRUNC
aio02.c:218: PASS: READ : O_RDWR
aio02.c:218: PASS: WRITE: O_WRONLY | O_TRUNC
aio02.c:218: PASS: READ : O_RDONLY
...
-----------------------------------------------------------------------------------
With the change:
-----------------------------------------------------------------------------------
[root@Fedora-30 aio]# ./aio02 -i 2
tst_test.c:1215: INFO: Timeout per run is 0h 05m 00s
aio02.c:212: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:220: PASS: WRITE: O_WRONLY | O_TRUNC | O_DIRECT | O_LARGEFILE | 
O_CREAT
aio02.c:212: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:220: PASS: READ : O_RDONLY | O_DIRECT | O_LARGEFILE
aio02.c:220: PASS: WRITE: O_RDWR | O_TRUNC
aio02.c:220: PASS: READ : O_RDWR
aio02.c:220: PASS: WRITE: O_WRONLY | O_TRUNC
aio02.c:220: PASS: READ : O_RDONLY
aio02.c:212: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:220: PASS: WRITE: O_WRONLY | O_TRUNC | O_DIRECT | O_LARGEFILE | 
O_CREAT
aio02.c:212: INFO: Drop O_DIRECT flag for tmpfs
aio02.c:220: PASS: READ : O_RDONLY | O_DIRECT | O_LARGEFILE
aio02.c:220: PASS: WRITE: O_RDWR | O_TRUNC
aio02.c:220: PASS: READ : O_RDWR
aio02.c:220: PASS: WRITE: O_WRONLY | O_TRUNC
aio02.c:220: PASS: READ : O_RDONLY
...
-----------------------------------------------------------------------------------

Thanks,
Xiao Yang
diff mbox series

Patch

diff --git a/testcases/kernel/io/aio/aio02.c b/testcases/kernel/io/aio/aio02.c
index e283afba9..6dec073a2 100644
--- a/testcases/kernel/io/aio/aio02.c
+++ b/testcases/kernel/io/aio/aio02.c
@@ -18,7 +18,7 @@ 
 #define AIO_MAXIO 32
 #define AIO_BLKSIZE (64*1024)
 
-static int wait_count = 0;
+static int wait_count;
 
 #define DESC_FLAGS_OPR(x, y) .desc = (x == IO_CMD_PWRITE ? "WRITE: " #y: "READ : " #y), \
 	.flags = y, .operation = x
@@ -206,6 +206,11 @@  static void test_io(unsigned int n)
 	int status;
 	struct testcase *tc = testcases + n;
 
+	if ((tst_fs_type(".") == TST_TMPFS_MAGIC) && (tc->flags & O_DIRECT)) {
+		tst_res(TINFO, "Drop O_DIRECT flag for tmpfs");
+		tc->flags &= ~O_DIRECT;
+	}
+
 	status = io_tio("file", tc->flags, tc->operation);
 	if (status)
 		tst_res(TFAIL, "%s, status = %d", tc->desc, status);