thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-virtiofsd-passthrough_ll-clean-up-cache-related-opti.patch

ddf19c
From 079199c53f483f0051f994b195ebb595aec76a39 Mon Sep 17 00:00:00 2001
ddf19c
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ddf19c
Date: Mon, 27 Jan 2020 19:01:51 +0100
ddf19c
Subject: [PATCH 080/116] virtiofsd: passthrough_ll: clean up cache related
ddf19c
 options
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
Message-id: <20200127190227.40942-77-dgilbert@redhat.com>
ddf19c
Patchwork-id: 93530
ddf19c
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 076/112] virtiofsd: passthrough_ll: clean up cache related options
ddf19c
Bugzilla: 1694164
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ddf19c
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
ddf19c
ddf19c
From: Miklos Szeredi <mszeredi@redhat.com>
ddf19c
ddf19c
 - Rename "cache=never" to "cache=none" to match 9p's similar option.
ddf19c
ddf19c
 - Rename CACHE_NORMAL constant to CACHE_AUTO to match the "cache=auto"
ddf19c
   option.
ddf19c
ddf19c
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
ddf19c
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ddf19c
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
(cherry picked from commit 230e777b5e250759ee0480fcc0e9ccfa2b082fba)
ddf19c
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ddf19c
---
ddf19c
 tools/virtiofsd/helper.c         |  5 ++++-
ddf19c
 tools/virtiofsd/passthrough_ll.c | 20 ++++++++++----------
ddf19c
 2 files changed, 14 insertions(+), 11 deletions(-)
ddf19c
ddf19c
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
ddf19c
index 14f5d70..5672024 100644
ddf19c
--- a/tools/virtiofsd/helper.c
ddf19c
+++ b/tools/virtiofsd/helper.c
ddf19c
@@ -145,6 +145,9 @@ void fuse_cmdline_help(void)
ddf19c
            "    --syslog                   log to syslog (default stderr)\n"
ddf19c
            "    -f                         foreground operation\n"
ddf19c
            "    --daemonize                run in background\n"
ddf19c
+           "    -o cache=<mode>            cache mode. could be one of \"auto, "
ddf19c
+           "always, none\"\n"
ddf19c
+           "                               default: auto\n"
ddf19c
            "    -o log_level=<level>       log level, default to \"info\"\n"
ddf19c
            "                               level could be one of \"debug, "
ddf19c
            "info, warn, err\"\n"
ddf19c
@@ -156,7 +159,7 @@ void fuse_cmdline_help(void)
ddf19c
            "    -o readdirplus|no_readdirplus\n"
ddf19c
            "                               enable/disable readirplus\n"
ddf19c
            "                               default: readdirplus except with "
ddf19c
-           "cache=never\n"
ddf19c
+           "cache=none\n"
ddf19c
           );
ddf19c
 }
ddf19c
 
ddf19c
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
ddf19c
index 9e7191e..b40f287 100644
ddf19c
--- a/tools/virtiofsd/passthrough_ll.c
ddf19c
+++ b/tools/virtiofsd/passthrough_ll.c
ddf19c
@@ -101,8 +101,8 @@ struct lo_cred {
ddf19c
 };
ddf19c
 
ddf19c
 enum {
ddf19c
-    CACHE_NEVER,
ddf19c
-    CACHE_NORMAL,
ddf19c
+    CACHE_NONE,
ddf19c
+    CACHE_AUTO,
ddf19c
     CACHE_ALWAYS,
ddf19c
 };
ddf19c
 
ddf19c
@@ -138,8 +138,8 @@ static const struct fuse_opt lo_opts[] = {
ddf19c
     { "no_xattr", offsetof(struct lo_data, xattr), 0 },
ddf19c
     { "timeout=%lf", offsetof(struct lo_data, timeout), 0 },
ddf19c
     { "timeout=", offsetof(struct lo_data, timeout_set), 1 },
ddf19c
-    { "cache=never", offsetof(struct lo_data, cache), CACHE_NEVER },
ddf19c
-    { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
ddf19c
+    { "cache=none", offsetof(struct lo_data, cache), CACHE_NONE },
ddf19c
+    { "cache=auto", offsetof(struct lo_data, cache), CACHE_AUTO },
ddf19c
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
ddf19c
     { "norace", offsetof(struct lo_data, norace), 1 },
ddf19c
     { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
ddf19c
@@ -482,7 +482,7 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
ddf19c
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
ddf19c
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
ddf19c
     }
ddf19c
-    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
ddf19c
+    if ((lo->cache == CACHE_NONE && !lo->readdirplus_set) ||
ddf19c
         lo->readdirplus_clear) {
ddf19c
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
ddf19c
         conn->want &= ~FUSE_CAP_READDIRPLUS;
ddf19c
@@ -1493,7 +1493,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
ddf19c
         fi->fh = fh;
ddf19c
         err = lo_do_lookup(req, parent, name, &e);
ddf19c
     }
ddf19c
-    if (lo->cache == CACHE_NEVER) {
ddf19c
+    if (lo->cache == CACHE_NONE) {
ddf19c
         fi->direct_io = 1;
ddf19c
     } else if (lo->cache == CACHE_ALWAYS) {
ddf19c
         fi->keep_cache = 1;
ddf19c
@@ -1578,7 +1578,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
ddf19c
     }
ddf19c
 
ddf19c
     fi->fh = fh;
ddf19c
-    if (lo->cache == CACHE_NEVER) {
ddf19c
+    if (lo->cache == CACHE_NONE) {
ddf19c
         fi->direct_io = 1;
ddf19c
     } else if (lo->cache == CACHE_ALWAYS) {
ddf19c
         fi->keep_cache = 1;
ddf19c
@@ -2395,7 +2395,7 @@ int main(int argc, char *argv[])
ddf19c
     lo.root.next = lo.root.prev = &lo.root;
ddf19c
     lo.root.fd = -1;
ddf19c
     lo.root.fuse_ino = FUSE_ROOT_ID;
ddf19c
-    lo.cache = CACHE_NORMAL;
ddf19c
+    lo.cache = CACHE_AUTO;
ddf19c
 
ddf19c
     /*
ddf19c
      * Set up the ino map like this:
ddf19c
@@ -2470,11 +2470,11 @@ int main(int argc, char *argv[])
ddf19c
     }
ddf19c
     if (!lo.timeout_set) {
ddf19c
         switch (lo.cache) {
ddf19c
-        case CACHE_NEVER:
ddf19c
+        case CACHE_NONE:
ddf19c
             lo.timeout = 0.0;
ddf19c
             break;
ddf19c
 
ddf19c
-        case CACHE_NORMAL:
ddf19c
+        case CACHE_AUTO:
ddf19c
             lo.timeout = 1.0;
ddf19c
             break;
ddf19c
 
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c