From: Vivek Goyal <vgoyal@redhat.com>
To: piaojun <piaojun@huawei.com>
Cc: virtio-fs-list <virtio-fs@redhat.com>, aneesh.kumar@linux.vnet.ibm.com
Subject: Re: [Virtio-fs] [PATCH] virtiofsd: Reset O_DIRECT flag during file open
Date: Tue, 20 Aug 2019 14:36:14 -0400 [thread overview]
Message-ID: <20190820183614.GE4233@redhat.com> (raw)
In-Reply-To: <d6fe5b15-5ca4-c189-3319-2b90150704d2@huawei.com>
On Tue, Aug 20, 2019 at 10:33:29PM +0800, piaojun wrote:
> Hi Vivek & Aneesh,
>
> On 2019/8/20 21:45, Vivek Goyal wrote:
> > If an application wants to do direct IO and opens a file with O_DIRECT
> > in guest, that does not necessarily mean that we need to bypass page
> > cache on host as well. So reset this flag on host.
>
> I have a different understanding about this. The I/O mode should be kept
> same both in Guest and Host. When doing direct io in Guest, the user may
> want the data go to disk rather than kept in Host page cache which means
> volatile. So it seems more reasonable that Guest and Host have the same
> file I/0 semantics.
I look at it other way. If we open a file O_DIRECT, it should bypass
page cache on kernel it is running on. It does not guarantee anything
on underlying storage stack. For example, virtual block device or physical
disks could still be caching data with O_DIRECT.
To me same analogy should apply for caching on host. Atleast by default
O_DIRECT should only mean bypassing page cache in guest. If there is
an application which requires bypassing page cache on host as well, then
it should be a server option to control this behavior. But we can do when
there is a real user.
>
> >
> > If somebody needs to bypass page cache on host as well (and it is safe to
> > do so), we can add a knob in daemon later to control this behavior.
>
> This discussion has some relationship with my RFC PATCH "virtiofsd: do
> not fall back to buffer io when cache=auto/always", and we could involve
> the issue mentioned in that email if you do not mind.
>
I responded to your patch separately and that seems completely unrelated
to this patch.
[..]
> > + /*
> > + * O_DIRECT in guest should not necessarily mean bypassing page
> > + * cache on host as well. If somebody needs that behavior, it
> > + * probably should be a configuration knob in daemon.
> > + */
> > + fi->flags &= ~O_DIRECT;
> > +
>
> We need do the same thing for lo_create().
That's a good point. I have fixed it and will post V2.
Vivek
next prev parent reply other threads:[~2019-08-20 18:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 13:45 [Virtio-fs] [PATCH] virtiofsd: Reset O_DIRECT flag during file open Vivek Goyal
2019-08-20 14:33 ` piaojun
2019-08-20 18:36 ` Vivek Goyal [this message]
2019-08-21 2:36 ` piaojun
2019-08-21 13:12 ` Vivek Goyal
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=20190820183614.GE4233@redhat.com \
--to=vgoyal@redhat.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=piaojun@huawei.com \
--cc=virtio-fs@redhat.com \
/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 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.