diff options
| author | Jakob Unterwurzacher | 2017-06-30 23:15:31 +0200 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2017-06-30 23:15:31 +0200 | 
| commit | b2a23e94d10a7e3f7e25db50211b167f6fb280da (patch) | |
| tree | b45e1863148d1a20b02a622dc8eded1c629cad6d | |
| parent | 06398e82d91c81c618bfa6a481c0e9070847c909 (diff) | |
fusefrontend: doRead: use CReqPool for ciphertext buffer
Easily saves lots of allocations.
| -rw-r--r-- | internal/fusefrontend/file.go | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index 6f963e7..70c8d83 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -172,7 +172,8 @@ func (f *file) doRead(dst []byte, off uint64, length uint64) ([]byte, fuse.Statu  	skip := blocks[0].Skip  	tlog.Debug.Printf("JointCiphertextRange(%d, %d) -> %d, %d, %d", off, length, alignedOffset, alignedLength, skip) -	ciphertext := make([]byte, int(alignedLength)) +	ciphertext := f.fs.contentEnc.CReqPool.Get() +	ciphertext = ciphertext[:int(alignedLength)]  	n, err := f.fd.ReadAt(ciphertext, int64(alignedOffset))  	// We don't care if the file ID changes after we have read the data. Drop the lock.  	f.fileTableEntry.HeaderLock.RUnlock() @@ -188,6 +189,7 @@ func (f *file) doRead(dst []byte, off uint64, length uint64) ([]byte, fuse.Statu  	// Decrypt it  	plaintext, err := f.contentEnc.DecryptBlocks(ciphertext, firstBlockNo, fileID) +	f.fs.contentEnc.CReqPool.Put(ciphertext)  	if err != nil {  		if f.fs.args.ForceDecode && err == stupidgcm.ErrAuth {  			// We do not have the information which block was corrupt here anymore, | 
