diff options
author | Jakob Unterwurzacher | 2017-06-20 21:22:00 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-06-20 21:22:00 +0200 |
commit | 3c6fe98eb1e5dada2613664182ead18be9e68819 (patch) | |
tree | 46b9a79ff38db49b203fe6773b9eb046e3b7b64e /internal/fusefrontend/file.go | |
parent | 609343accf37505fbf0f7916044f0318f35dac4f (diff) |
contentenc: use sync.Pool memory pools for encryption
We use two levels of buffers:
1) 4kiB+overhead for each ciphertext block
2) 128kiB+overhead for each FUSE write (32 ciphertext blocks)
This commit adds a sync.Pool for both levels.
The memory-efficiency for small writes could be improved,
as we now always use a 128kiB buffer.
Diffstat (limited to 'internal/fusefrontend/file.go')
-rw-r--r-- | internal/fusefrontend/file.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index 5b0a254..f70c9a5 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -311,6 +311,8 @@ func (f *file) doWrite(data []byte, off int64) (uint32, fuse.Status) { } // Write _, err = f.fd.WriteAt(ciphertext, cOff) + // Return memory to cWritePool + f.fs.contentEnc.CWritePut(ciphertext) if err != nil { tlog.Warn.Printf("doWrite: Write failed: %s", err.Error()) return 0, fuse.ToStatus(err) |