From: Dave Chinner <david@fromorbit.com>
To: Dmitry Monakhov <dmonlist@gmail.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work
Date: Tue, 26 Apr 2016 09:49:46 +1000 [thread overview]
Message-ID: <20160425234946.GB26977@dastard> (raw)
In-Reply-To: <877ffmhvzt.fsf@openvz.org>
On Mon, Apr 25, 2016 at 12:35:02PM +0300, Dmitry Monakhov wrote:
> Theodore Ts'o <tytso@mit.edu> writes:
>
> > Certain ext4 modes (encryption, data=journal, inline data) cause
> > Direct I/O to be a no-op. Instead of making DIO fail silently, make
> > the open with the O_DIRECT flag fail with EINVAL.
> >
> > This will avoid surprises to application programs, and also signal to
> > xfstests not to try O_DIRECT tests for file system modes where it
> > doesn't work (and could result in test failures).
> >
> > Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> > ---
> > fs/ext4/file.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> > index fa2208b..4113676 100644
> > --- a/fs/ext4/file.c
> > +++ b/fs/ext4/file.c
> > @@ -372,7 +372,12 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
> > return -EACCES;
> > if (ext4_encryption_info(inode) == NULL)
> > return -ENOKEY;
> > + if (filp->f_flags & O_DIRECT)
> > + return -EINVAL;
> > }
> > + if ((ext4_should_journal_data(inode) || ext4_has_inline_data(inode)) &&
> > + (filp->f_flags & O_DIRECT))
> Hmm...
> __ext4_new_inode set EXT4_STATE_MAY_INLINE_DATA for each inode if
> ext4_has_feature_inline_data(sb) is true.
> So this may result in complain from user who want inline data
> optimization for small files, but also want O_DIRECT to works.
> IMHO it is reasonable to convert inline inodes to regular ones if user
> open it for WRITE with O_DIRECT
Why not just transparently fall back to buffered IO if direct IO
cannot be done? Saves people from wondering why applications fail
on one ext4 filesystem and not another....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2016-04-25 23:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-24 4:27 [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work Theodore Ts'o
2016-04-25 9:35 ` Dmitry Monakhov
2016-04-25 23:49 ` Dave Chinner [this message]
2016-04-26 0:20 ` Theodore Ts'o
2016-04-26 8:14 ` O_DIRECT as a hint, was: " Christoph Hellwig
2016-04-26 15:07 ` Mike Marshall
[not found] ` <20160426081451.GA25616-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-04-27 2:16 ` Theodore Ts'o
[not found] ` <20160427021649.GA30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27 2:22 ` Eric Sandeen
2016-04-27 2:25 ` Dave Chinner
2016-04-27 2:27 ` Dave Chinner
2016-04-27 3:25 ` Theodore Ts'o
[not found] ` <20160427032526.GC30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27 3:37 ` Dave Chinner
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=20160425234946.GB26977@dastard \
--to=david@fromorbit.com \
--cc=dmonlist@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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