cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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