cache read performance improvements
This commit is contained in:
parent
39c4720e40
commit
f69d3149f3
14 changed files with 140 additions and 71 deletions
|
|
@ -139,7 +139,8 @@ func (f *file) Seek(offset int64, whence int) (n int64, err error) {
|
|||
return
|
||||
}
|
||||
f.nonce = [NonceSize]byte{}
|
||||
inc(&f.nonce, cn)
|
||||
//inc(&f.nonce, cn)
|
||||
put(&f.nonce, cn)
|
||||
f.r.nonce = f.nonce
|
||||
f.w.nonce = f.nonce
|
||||
f.r.off = roff
|
||||
|
|
@ -187,7 +188,8 @@ func (f *file) WriteAt(data []byte, pos int64) (n int, err error) {
|
|||
c, ok := f.w.cm[cn]
|
||||
if !ok {
|
||||
c = &chunkWriter{offset: off + KDFNonceSize, w: f.w, cn: cn}
|
||||
inc(&c.nonce, cn)
|
||||
//inc(&c.nonce, cn)
|
||||
put(&c.nonce, cn)
|
||||
f.w.cm[cn] = c
|
||||
if f.w.last == nil {
|
||||
f.w.last = c
|
||||
|
|
@ -199,7 +201,6 @@ func (f *file) WriteAt(data []byte, pos int64) (n int, err error) {
|
|||
if c.full() {
|
||||
// async flush
|
||||
go func() {
|
||||
//_, err = c.flush(notLastChunk)
|
||||
c.flush(notLastChunk)
|
||||
}()
|
||||
delete(f.w.cm, cn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue