Sherlock-Holo / fuse3

an async version fuse library for rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Double data copy due to use of Bytes

asomers opened this issue · comments

The ReplyData and ReplyXAttr types use bytes::Bytes to pass data from the filesystem to fuse3. Because those methods are async fn, it makes sense that the buffer type must be 'static. However, using bytes::Bytes is unnecessarily restrictive. My file system does not use Bytes internally, so I must do a data copy from my own buffer type into a Bytes, only for fuse3 to immediately copy it again with Vec::extend_from_slice.
The extra data copy could be eliminated if Filesystem has a generic parameter type Buffer: AsRef<[u8]> + 'static, and the ReplyData and ReplyXAttr types use that instead of Bytes.