fuse: Add bandwidth accounting and buffering

This fixes rclone mount ignoring bwlimit and increases buffering which
should speed up transfers greatly.

Fixes #796
Fixes #690
This commit is contained in:
Nick Craig-Wood
2016-12-04 16:57:47 +00:00
parent 2cbdb95ce5
commit be4fd51289
4 changed files with 34 additions and 16 deletions
+2 -7
View File
@@ -264,12 +264,7 @@ func Copy(f Fs, dst Object, remote string, src Object) (err error) {
if err != nil {
err = errors.Wrap(err, "failed to open source object")
} else {
// On big files add a buffer
if src.Size() > 10<<20 {
in0, _ = newAsyncReader(in0, 4, 4<<20)
}
in := NewAccount(in0, src) // account the transfer
in := NewAccount(in0, src) // account and buffer the transfer
wrappedSrc := &overrideRemoteObject{Object: src, remote: remote}
if doUpdate {
@@ -1131,7 +1126,7 @@ func Cat(f Fs, w io.Writer) error {
ErrorLog(o, "Failed to close: %v", err)
}
}()
inAccounted := NewAccount(in, o) // account the transfer
inAccounted := NewAccount(in, o) // account and buffer the transfer
_, err = io.Copy(w, inAccounted)
if err != nil {
Stats.Error()