All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catherine Ho <catherine.hecx@gmail.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	 QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] virtiofsd/passthrough_ll: don't remove O_DIRECT when cache=none
Date: Tue, 21 Apr 2020 09:55:45 +0800	[thread overview]
Message-ID: <CAEn6zmF5=cvqPz0UZsEs=a+GRm08Os-Vhnyun4PP73w54kUhXQ@mail.gmail.com> (raw)
In-Reply-To: <1586594144-24605-1-git-send-email-catherine.hecx@gmail.com>

Ping :)

---
B.R.
Catherine

On Sat, 11 Apr 2020 at 16:41, Catherine Ho <catherine.hecx@gmail.com> wrote:
>
> cache=none means to bypass host cache. So we can't remove O_DIRECT flag in
> unconditionally in update_open_flags();
>
> Signed-off-by: Catherine Ho <catherine.hecx@gmail.com>
> ---
> v2: Fix to keep flags unchanged if cache=none, otherwise changed the file
>     without O_DIRECT incorrectly.
>  tools/virtiofsd/passthrough_ll.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index 4c35c95..59e64dd 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -1677,7 +1677,8 @@ static void lo_releasedir(fuse_req_t req, fuse_ino_t ino,
>      fuse_reply_err(req, 0);
>  }
>
> -static void update_open_flags(int writeback, struct fuse_file_info *fi)
> +static void update_open_flags(int writeback, int cache_mode,
> +                              struct fuse_file_info *fi)
>  {
>      /*
>       * With writeback cache, kernel may send read requests even
> @@ -1702,10 +1703,11 @@ static void update_open_flags(int writeback, struct fuse_file_info *fi)
>
>      /*
>       * 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.
> +     * cache on host as well. If cache=none, keep the flag unchanged
>       */
> -    fi->flags &= ~O_DIRECT;
> +    if (cache_mode != CACHE_NONE) {
> +        fi->flags &= ~O_DIRECT;
> +    }
>  }
>
>  static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
> @@ -1737,7 +1739,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
>          goto out;
>      }
>
> -    update_open_flags(lo->writeback, fi);
> +    update_open_flags(lo->writeback, lo->cache, fi);
>
>      fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
>                  mode);
> @@ -1947,7 +1949,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
>      fuse_log(FUSE_LOG_DEBUG, "lo_open(ino=%" PRIu64 ", flags=%d)\n", ino,
>               fi->flags);
>
> -    update_open_flags(lo->writeback, fi);
> +    update_open_flags(lo->writeback, lo->cache, fi);
>
>      sprintf(buf, "%i", lo_fd(req, ino));
>      fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
> --
> 1.7.1
>


  reply	other threads:[~2020-04-21  1:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-11  6:19 [PATCH] virtiofsd/passthrough_ll: don't remove O_DIRECT when cache=none Catherine Ho
2020-04-11  8:35 ` [PATCH v2] " Catherine Ho
2020-04-21  1:55   ` Catherine Ho [this message]
2020-04-30  8:35   ` Stefan Hajnoczi
2020-04-30  8:35     ` [Virtio-fs] " Stefan Hajnoczi

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='CAEn6zmF5=cvqPz0UZsEs=a+GRm08Os-Vhnyun4PP73w54kUhXQ@mail.gmail.com' \
    --to=catherine.hecx@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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.