All of lore.kernel.org
 help / color / mirror / Atom feed
From: piaojun <piaojun@huawei.com>
To: Eryu Guan <eguan@linux.alibaba.com>
Cc: virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH][RFC] viriofsd: do not fall back to buffer io when cache=auto
Date: Mon, 19 Aug 2019 11:51:51 +0800	[thread overview]
Message-ID: <5D5A1CD7.6070202@huawei.com> (raw)
In-Reply-To: <20190819031537.GK52397@e18g06458.et15sqa>



On 2019/8/19 11:15, Eryu Guan wrote:
> On Wed, Aug 14, 2019 at 05:46:42PM +0800, piaojun wrote:
>> Direct io flags will be tured off even if cache=auto, which seems a
>> little bit strange. It's better to keep the open flags set by user. If
>> I missed the discussion about this issue, please let me know, thanks.
>>
>> Signed-off-by: Jun Piao <piaojun@huawei.com>
>> ---
>>  contrib/virtiofsd/passthrough_ll.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
>> index 321bbb2..a080f0d 100644
>> --- a/contrib/virtiofsd/passthrough_ll.c
>> +++ b/contrib/virtiofsd/passthrough_ll.c
>> @@ -1687,6 +1687,8 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
>>  		fi->direct_io = 1;
>>  	else if (lo->cache == CACHE_ALWAYS)
>>  		fi->keep_cache = 1;
>> +	else
>> +		fi->direct_io = !!(fi->flags & O_DIRECT);
>>
>>  out:
>>  	lo_inode_put(lo, &parent_inode);
>> @@ -1899,6 +1901,8 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
>>  		fi->direct_io = 1;
>>  	else if (lo->cache == CACHE_ALWAYS)
>>  		fi->keep_cache = 1;
>> +	else
>> +		fi->direct_io = !!(fi->flags & O_DIRECT);
>>  	fuse_reply_open(req, fi);
> 
> IMHO, this is necessary, it seems that in the case cache=auto/always,
> virtiofsd already follows what guest requests, i.e.  virtiofsd only does
> direct I/O when guest opens file with O_DIRECT.

>From my testing, virtiofsd won't do direct io even if guest opens file
with O_DIRECT when cache=auto/alway. It's weird to convert direct io to
buffer io at host side.

> 
> If I understand the code correctly, fi->direct_io = 1 is used to force
> guest to use direct I/O even if guest opens file without O_DIRECT.

But in fact, direct I/O will be forced to buffer I/O even if with
O_DIRECT. I will look into this problem by further testing, and very
glad to share my test result.

Jun


  reply	other threads:[~2019-08-19  3:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14  9:46 [Virtio-fs] [PATCH][RFC] viriofsd: do not fall back to buffer io when cache=auto piaojun
2019-08-19  0:48 ` piaojun
2019-08-19  3:15 ` Eryu Guan
2019-08-19  3:51   ` piaojun [this message]
2019-08-19  5:07     ` Eryu Guan
2019-08-19  6:07       ` piaojun
2019-08-19  6:49 ` [Virtio-fs] [PATCH RESEND][RFC] virtiofsd: do not fall back to buffer io when cache=auto/always piaojun
2019-08-19  7:34   ` Eryu Guan
2019-08-19 14:16     ` piaojun
2019-08-20 15:39   ` Vivek Goyal
2019-08-20 17:56     ` Vivek Goyal
2019-08-21  1:48       ` piaojun
2019-08-21 13:11         ` Vivek Goyal
2019-08-21 14:38           ` piaojun
2019-08-21 14:47             ` Vivek Goyal
2019-08-22  5:01               ` piaojun
2019-08-23  1:55           ` piaojun
2019-08-20 15:31 ` [Virtio-fs] [PATCH][RFC] viriofsd: do not fall back to buffer io when cache=auto 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=5D5A1CD7.6070202@huawei.com \
    --to=piaojun@huawei.com \
    --cc=eguan@linux.alibaba.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.