mount: put read and write async buffers back - control with --buffer-size #1043

This commit is contained in:
Nick Craig-Wood 2017-02-14 22:59:52 +00:00
parent 7fa687b3e1
commit 9a9d09845c
2 changed files with 2 additions and 3 deletions

View File

@ -29,7 +29,7 @@ func newReadFileHandle(o fs.Object) (*ReadFileHandle, error) {
} }
fh := &ReadFileHandle{ fh := &ReadFileHandle{
o: o, o: o,
r: fs.NewAccount(r, o), // account the transfer r: fs.NewAccountWithBuffer(r, o), // account the transfer
} }
fs.Stats.Transferring(fh.o.Remote()) fs.Stats.Transferring(fh.o.Remote())
return fh, nil return fh, nil
@ -68,7 +68,6 @@ func (fh *ReadFileHandle) seek(offset int64, reopen bool) error {
if err != nil { if err != nil {
fs.Debugf(fh.o, "ReadFileHandle.Read seek close old failed: %v", err) fs.Debugf(fh.o, "ReadFileHandle.Read seek close old failed: %v", err)
} }
// fh.r = fs.NewAccount(r, fh.o) // account the transfer
fh.r.UpdateReader(r) fh.r.UpdateReader(r)
} }
fh.offset = offset fh.offset = offset

View File

@ -38,7 +38,7 @@ func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, e
file: f, file: f,
} }
fh.pipeReader, fh.pipeWriter = io.Pipe() fh.pipeReader, fh.pipeWriter = io.Pipe()
r := fs.NewAccountSizeName(fh.pipeReader, 0, src.Remote()) // account the transfer r := fs.NewAccountSizeNameWithBuffer(fh.pipeReader, 0, src.Remote()) // account the transfer
go func() { go func() {
o, err := d.f.Put(r, src) o, err := d.f.Put(r, src)
fh.o = o fh.o = o