Commit c3c029c5 authored by Aaron Jacobs's avatar Aaron Jacobs

cachingFS.SetKeepCache

parent 7fae3a99
...@@ -126,6 +126,9 @@ type cachingFS struct { ...@@ -126,6 +126,9 @@ type cachingFS struct {
mu syncutil.InvariantMutex mu syncutil.InvariantMutex
// GUARDED_BY(mu)
keepPageCache bool
// The current ID of the lowest numbered non-root inode. // The current ID of the lowest numbered non-root inode.
// //
// INVARIANT: baseID > fuseops.RootInodeID // INVARIANT: baseID > fuseops.RootInodeID
...@@ -248,7 +251,10 @@ func (fs *cachingFS) SetMtime(mtime time.Time) { ...@@ -248,7 +251,10 @@ func (fs *cachingFS) SetMtime(mtime time.Time) {
// LOCKS_EXCLUDED(fs.mu) // LOCKS_EXCLUDED(fs.mu)
func (fs *cachingFS) SetKeepCache(keep bool) { func (fs *cachingFS) SetKeepCache(keep bool) {
// TODO fs.mu.Lock()
defer fs.mu.Unlock()
fs.keepPageCache = keep
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -350,6 +356,11 @@ func (fs *cachingFS) OpenDir( ...@@ -350,6 +356,11 @@ func (fs *cachingFS) OpenDir(
func (fs *cachingFS) OpenFile( func (fs *cachingFS) OpenFile(
ctx context.Context, ctx context.Context,
op *fuseops.OpenFileOp) (err error) { op *fuseops.OpenFileOp) (err error) {
fs.mu.Lock()
defer fs.mu.Unlock()
op.KeepPageCache = fs.keepPageCache
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment