mount: allow files of unkown size to be read properly
Before this change, files of unknown size (eg Google Docs) would appear in file listings with 0 size and would only allow 0 bytes to be read. This change sets the direct_io flag in the FUSE return which bypasses the cache for these files. This means that they can be read properly. This is compatible with some, but not all applications.s3-about
parent
ba121eddf0
commit
0baafb158f
|
@ -299,6 +299,9 @@ func (fsys *FS) Open(path string, flags int) (errc int, fh uint64) {
|
|||
return translateError(err), fhUnset
|
||||
}
|
||||
|
||||
// FIXME add support for unknown length files setting direct_io
|
||||
// See: https://github.com/billziss-gh/cgofuse/issues/38
|
||||
|
||||
return 0, fsys.openHandle(handle)
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,11 @@ func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenR
|
|||
return nil, translateError(err)
|
||||
}
|
||||
|
||||
// If size unknown then use direct io to read
|
||||
if handle.Node().DirEntry().Size() < 0 {
|
||||
resp.Flags |= fuse.OpenDirectIO
|
||||
}
|
||||
|
||||
return &FileHandle{handle}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -882,9 +882,12 @@ without downloading them.
|
|||
Google docs will transfer correctly with `rclone sync`, `rclone copy`
|
||||
etc as rclone knows to ignore the size when doing the transfer.
|
||||
|
||||
However an unfortunate consequence of this is that you can't download
|
||||
Google docs using `rclone mount` - you will get a 0 sized file. If
|
||||
you try again the doc may gain its correct size and be downloadable.
|
||||
However an unfortunate consequence of this is that you may not be able
|
||||
to download Google docs using `rclone mount`. If it doesn't work you
|
||||
will get a 0 sized file. If you try again the doc may gain its
|
||||
correct size and be downloadable. Whther it will work on not depends
|
||||
on the application accessing the mount and the OS you are running -
|
||||
experiment to find out if it does work for you!
|
||||
|
||||
### Duplicated files ###
|
||||
|
||||
|
|
|
@ -277,13 +277,14 @@ that when syncing to Google Photos, rclone can only do a file
|
|||
existence check.
|
||||
|
||||
It is possible to read the size of the media, but this needs an extra
|
||||
HTTP HEAD request per media item so is very slow and uses up a lot of
|
||||
HTTP HEAD request per media item so is **very slow** and uses up a lot of
|
||||
transactions. This can be enabled with the `--gphotos-read-size`
|
||||
option or the `read_size = true` config parameter.
|
||||
|
||||
If you want to use the backend with `rclone mount` you will need to
|
||||
enable this flag otherwise you will not be able to read media off the
|
||||
mount.
|
||||
If you want to use the backend with `rclone mount` you may need to
|
||||
enable this flag (depending on your OS and application using the
|
||||
photos) otherwise you may not be able to read media off the mount.
|
||||
You'll need to experiment to see if it works for you without the flag.
|
||||
|
||||
### Albums
|
||||
|
||||
|
|
Loading…
Reference in New Issue