diff options
author | Nicolas Lacasse <nlacasse@google.com> | 2018-06-19 11:09:20 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-19 11:10:11 -0700 |
commit | 9db7cfad93abff181c59d61892d32b9b05f4234f (patch) | |
tree | 51e3f4b6fa836a52f317dca62e01bf13143c8c05 /pkg/sentry/fs/gofer/fs.go | |
parent | 5581256f879f4249de5ebffddaf0626fcb39eebd (diff) |
Add a new cache policy FSCACHE_WRITETHROUGH.
The new policy is identical to FSCACHE (which caches everything in memory), but
it also flushes writes to the backing fs agent immediately.
All gofer cache policy decisions have been moved into the cachePolicy type.
Previously they were sprinkled around the codebase.
There are many different things that we cache (page cache, negative dirents,
dirent LRU, unstable attrs, readdir results....), and I don't think we should
have individual flags to control each of these. Instead, we should have a few
high-level cache policies that are consistent and useful to users. This
refactoring makes it easy to add more such policies.
PiperOrigin-RevId: 201206937
Change-Id: I6e225c382b2e5e1b0ad4ccf8ca229873f4cd389d
Diffstat (limited to 'pkg/sentry/fs/gofer/fs.go')
-rw-r--r-- | pkg/sentry/fs/gofer/fs.go | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/pkg/sentry/fs/gofer/fs.go b/pkg/sentry/fs/gofer/fs.go index a8a3ec19d..e041074d2 100644 --- a/pkg/sentry/fs/gofer/fs.go +++ b/pkg/sentry/fs/gofer/fs.go @@ -56,27 +56,6 @@ const ( privateUnixSocketKey = "privateunixsocket" ) -// cachePolicy is a 9p cache policy. -type cachePolicy int - -const ( - // TODO: fully support cache=none. - cacheNone cachePolicy = iota - - // Use virtual file system cache. - cacheAll -) - -func parseCachePolicy(policy string) (cachePolicy, error) { - switch policy { - case "fscache": - return cacheAll, nil - case "none": - return cacheNone, nil - } - return cacheNone, fmt.Errorf("unsupported cache mode: %s", policy) -} - // defaultAname is the default attach name. const defaultAname = "/" |