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