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{
o: o,
r: fs.NewAccount(r, o), // account the transfer
r: fs.NewAccountWithBuffer(r, o), // account the transfer
}
fs.Stats.Transferring(fh.o.Remote())
return fh, nil
@ -68,7 +68,6 @@ func (fh *ReadFileHandle) seek(offset int64, reopen bool) error {
if err != nil {
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.offset = offset

View File

@ -38,7 +38,7 @@ func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, e
file: f,
}
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() {
o, err := d.f.Put(r, src)
fh.o = o