From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] aio02: Drop O_DIRECT flag for tmpfs
Date: Wed, 12 Feb 2020 17:42:19 +0800 [thread overview]
Message-ID: <5E43C87B.60800@cn.fujitsu.com> (raw)
In-Reply-To: <1581492715-15110-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>
On 2020/2/12 15:31, Yang Xu wrote:
> tmpfs doesn't support O_DIRECT flag, drop it. userer still can run aio02
> with different filesystem by mounting specified filesystem on $TMPDIR.
>
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
> testcases/kernel/io/aio/aio02.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/io/aio/aio02.c b/testcases/kernel/io/aio/aio02.c
> index e283afba9..3bb89c45f 100644
> --- a/testcases/kernel/io/aio/aio02.c
> +++ b/testcases/kernel/io/aio/aio02.c
> @@ -18,7 +18,8 @@
> #define AIO_MAXIO 32
> #define AIO_BLKSIZE (64*1024)
>
> -static int wait_count = 0;
> +static int wait_count;
Hi,
Why do you set wait_count to 0?
Isn't it default behavior?
> +static unsigned int use_tmpfs;
>
> #define DESC_FLAGS_OPR(x, y) .desc = (x == IO_CMD_PWRITE ? "WRITE: " #y: "READ : " #y), \
> .flags = y, .operation = x
> @@ -206,6 +207,11 @@ static void test_io(unsigned int n)
> int status;
> struct testcase *tc = testcases + n;
>
> + if (use_tmpfs && (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);
> @@ -213,7 +219,14 @@ static void test_io(unsigned int n)
> tst_res(TPASS, "%s", tc->desc);
> }
>
> +static void setup(void)
> +{
> + if (tst_fs_type(".") == TST_TMPFS_MAGIC)
> + use_tmpfs = 1;
Could you simple the fix by moving 'tst_fs_type(".") == TST_TMPFS_MAGIC
' into test_io().
(i.e. Drop unused setup() and use_tmpfs.)
Thanks,
Xiao Yang
> +}
> +
> static struct tst_test test = {
> + .setup = setup,
> .needs_tmpdir = 1,
> .test = test_io,
> .tcnt = ARRAY_SIZE(testcases),
next prev parent reply other threads:[~2020-02-12 9:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 5:08 [LTP] [PATCH] aio02: Use mounted filesystem instead of temp directory Yang Xu
2020-02-12 5:30 ` Xiao Yang
2020-02-12 5:53 ` Yang Xu
2020-02-12 7:31 ` [LTP] [PATCH v2] aio02: Drop O_DIRECT flag for tmpfs Yang Xu
2020-02-12 9:42 ` Xiao Yang [this message]
2020-02-12 9:47 ` Xiao Yang
2020-02-12 9:53 ` Yang Xu
2020-02-12 10:07 ` [LTP] [PATCH v3] " Yang Xu
2020-02-12 13:37 ` Jan Stancek
2020-02-13 3:03 ` Xiao Yang
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=5E43C87B.60800@cn.fujitsu.com \
--to=yangx.jy@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox