From aff3a66e0c25fd384dbdd05f35442f911e31c99f Mon Sep 17 00:00:00 2001 From: Will Reese Date: Tue, 10 May 2016 23:00:29 -0500 Subject: [PATCH 1/2] Add AutoInvalData Mount Option --- options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/options.go b/options.go index b7f458f5..2cf1b813 100644 --- a/options.go +++ b/options.go @@ -170,6 +170,16 @@ func WritebackCache() MountOption { } } +// AutoInvalData enables the kernel to automatically invalidate +// cached pages on file open. The kernel uses mtime and size to +// determine when to invalidate cached pages. +func AutoInvalData() MountOption { + return func(conf *mountConfig) error { + conf.initFlags |= InitAutoInvalData + return nil + } +} + // OSXFUSEPaths describes the paths used by an installed OSXFUSE // version. See OSXFUSELocationV3 for typical values. type OSXFUSEPaths struct { From 232d26458394e50129a91bff6b3d4dfee8ee1b28 Mon Sep 17 00:00:00 2001 From: Will Reese Date: Sat, 14 May 2016 22:07:40 -0500 Subject: [PATCH 2/2] Decrease the buffer size to reduce memory usage The linux kernel will not send a write greater than 128KB. Dropping this value from 16MB to 128KB lowers fuse client memory usage by 10X or more. --- fuse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuse.go b/fuse.go index ca988967..790a6d5c 100644 --- a/fuse.go +++ b/fuse.go @@ -404,7 +404,7 @@ func (h *Header) RespondError(err error) { } // Maximum file write size we are prepared to receive from the kernel. -const maxWrite = 16 * 1024 * 1024 +const maxWrite = 128 * 1024 // All requests read from the kernel, without data, are shorter than // this.