-
I've been testing out the library and I started wondering why the interface uses let (res, buf) = file.read_at(buf, 0).await;
let n = res?; If we passed by reference, let n = file.read_at(&mut buf, 0).await?; While I understand why Another problem it would solve is reusing the same buffer for operations. Currently when I try to use a buffer in a loop, because I need to hand the buffer over by value, rust thinks I'm getting handed a new buffer on function return. This means I can't use it on the next iteration of the loop, since it goes out of scope, while with borrowing I could keep reusing the buffer on each iteration. I'm definitely missing something here, but I can't seem to find the reason anywhere, so I'm asking for help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Kernel should own the passing buffer because it's completion based API. You can refer https://without.boats/blog/io-uring/ |
Beta Was this translation helpful? Give feedback.
It won't work as it has to be owned.
Future in rust isn't guaranteed to be polled to end, nor is it guaranteed to be dropped.
Potential solution could be:
I believe that's for the SSD discard via
ioctl
.Io-uring already supports cancelling an in-flig…