From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: NeilBrown <neilb@suse.de>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/3] lapi/fcntl.h: Fix O_DIRECT definition for various archs
Date: Wed, 28 Jun 2023 14:51:44 +0200 [thread overview]
Message-ID: <20230628125144.GA147674@pevik> (raw)
In-Reply-To: <ZJwb_wxDrqIlNqfg@yuki>
> Hi!
> > O_DIRECT definitions differ a lot depending on architecture.
> > Because this can lead to problems (e.g. the generic value O_DIRECT
> > 040000 is O_DIRECTORY on powerpc, address that in lapi file.
> > NOTE: Deliberately use correct definitions also on less common archs
> > (maybe LTP even cannot be compiled on m68k or mips, but better to be
> > safe then sorry). But the problem would IMHO be avoided if the fallback
> > O_DIRECT definition would be removed everywhere and tests just define
> > _GNU_SOURCE (no library code is using O_DIRECT atm).
> > Reported-by: NeilBrown <neilb@suse.de>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> > include/lapi/fcntl.h | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> > diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
> > index 848ac7865..27da9f076 100644
> > --- a/include/lapi/fcntl.h
> > +++ b/include/lapi/fcntl.h
> > @@ -1,6 +1,7 @@
> > // SPDX-License-Identifier: GPL-2.0-or-later
> > /*
> > * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
> > + * Copyright (c) Linux Test Project, 2014-2023
> > */
> > #ifndef LAPI_FCNTL_H__
> > @@ -11,7 +12,15 @@
> > #include <sys/socket.h>
> > #ifndef O_DIRECT
> > -# define O_DIRECT 040000
> > +# if defined(__mips__)
> > +# define O_DIRECT 0100000
> > +# elif defined(__arm__) || defined(__aarch64__) || defined(__m68k__)
> > +# define O_DIRECT 0200000
> > +# elif defined(__powerpc__) || defined(__powerpc64__)
> > +# define O_DIRECT 0400000
> > +# else
> > +# define O_DIRECT 040000
> > +# endif
> > #endif
> I do not think that we should default to any value here, just do
> #error Define O_DIRECT for your architecture
> However I think that actually removing the O_DIRECT fallback and adding
> _GNU_SOURCE to tests that use O_DIRECT is more future proof solution.
> There is about 70 tests that use O_DIRECT and many of them define
> _GNU_SOURCE already.
I have no problem to remove O_DIRECT. The only question is what to do if we need
it in the library one day. Will we be ok that whole LTP becaume _GNU_SOURCE due
that?
> Actually I tried to remove the fallback from lapi/fcntl.h and recompiled
> LTP without any change, which is strange. Does that work for you as
> well?
I'm verifying it [1] in a patch, where I only defined _GNU_SOURCE in
testcases/kernel/fs/scsi/ltpscsi/scsimain.c and
testcases/kernel/fs/fsstress/global.h.
Kind regards,
Petr
[1] https://github.com/pevik/ltp/actions/runs/5401264765
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-06-28 12:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 8:18 [LTP] [PATCH 0/3] Fix O_DIRECT definition for various archs Petr Vorel
2023-06-28 8:18 ` [LTP] [PATCH 1/3] lapi/fcntl.h: " Petr Vorel
2023-06-28 8:29 ` Petr Vorel
2023-06-28 11:39 ` Cyril Hrubis
2023-06-28 12:51 ` Petr Vorel [this message]
2023-06-28 13:36 ` Cyril Hrubis
2023-06-28 14:57 ` Petr Vorel
2023-06-28 8:18 ` [LTP] [PATCH 2/3] fsstress/global.h: Include lapi/fcntl.h Petr Vorel
2023-06-28 8:28 ` Petr Vorel
2023-06-28 8:18 ` [LTP] [PATCH 3/3] ltpscsi/scsimain.c: Remove O_DIRECT fallback definition Petr Vorel
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=20230628125144.GA147674@pevik \
--to=pvorel@suse.cz \
--cc=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=neilb@suse.de \
/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