Closed aidosww closed 2 months ago
Yes you have to use O_DIRECT with IOPOLL, if you attempt to use it with buffered IO it will error with -EOPNOTSUPP. IOPOLL can be used for both read and write.
Yes you have to use O_DIRECT with IOPOLL, if you attempt to use it with buffered IO it will error with -EOPNOTSUPP. IOPOLL can be used for both read and write.
Thanks, this helps me a lot. So when I use IOPOLL and open a file with O_DIRECT, the buffer applied at the user application must be 4K aligned.
1.Can io_uring_register_buffers be used in this case? 2.io_uring_prep_provide_buffers can only be used under DIRECT I/O? Can it only be used for reading files?
1.Can io_uring_register_buffers be used in this case?
Yes
2.io_uring_prep_provide_buffers can only be used under DIRECT I/O?
No. It should work regardless whether it's buffered or direct io. However, I don't see much sense in using provided buffers for storage IO.
Can it only be used for reading files?
Currently yes, but Jens is trying to merge some support for sends. In any case it's mostly a network feature.
1.Can io_uring_register_buffers be used in this case?
Yes
2.io_uring_prep_provide_buffers can only be used under DIRECT I/O?
No. It should work regardless whether it's buffered or direct io. However, I don't see much sense in using provided buffers for storage IO.
Can it only be used for reading files?
Currently yes, but Jens is trying to merge some support for sends. In any case it's mostly a network feature.
Thank you very much! I still have some confusions about using DIRECT I/O and IO_POLL. 1.Do I need to implement a set of functions similar to the page cache from the kernel in the user space? If not, will it affect the performance of file reading and writing if I only use io_uring_register_buffers?
1.Do I need to implement a set of functions similar to the page cache from the kernel in the user space?
Not sure what you mean, but without Direct IO you wouldn't have buffering (i.e. page cache) with everything that follows from it.
will it affect the performance of file reading and writing if I only use io_uring_register_buffers?
Registered buffers are not helpful for buffered reads, otherwise they can help to shed some cycles. It's always a good idea to use them, but with IOPOLL those cycles may shift into iopolling, so for actual numbers it's better for you to experiment and measure.
OK,these comments are very helpful for me! Thanks
Here i have a question. I'm using kernel version 5.10. When I use IORING_SETUP_IOPOLL,