yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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