Fallback implementation of the IOUring batch interface. This implementation uses queues of individual read/write operations instead of a single batched operation.
More...
#include <IOUringFallback.hpp>
|
| IOUringFallback (unsigned entries) |
|
virtual | ~IOUringFallback () |
|
void | submit () override |
| Submit all prepared uring operations in a batch, and wait for all operations to return a result. Throws if there are errors interacting with the completion queue. Failures of batched operations are reported by ret from the operation's respective prep_... function call, and do not cause this function to throw. More...
|
|
void | prep_read (std::shared_ptr< int > ret, int fd, void *buf, unsigned nbytes, off_t offset) override |
| Perform a pread in the next batch submission. More...
|
|
void | prep_write (std::shared_ptr< int > ret, int fd, const void *buf, unsigned nbytes, off_t offset) override |
| Perform a pwrite in the next batch submission. More...
|
|
| IOUring ()=default |
| Create and initialize an IO uring. More...
|
|
virtual | ~IOUring ()=default |
| Clean up the IO uring. More...
|
|
|
static std::unique_ptr< IOUring > | make_unique (unsigned entries) |
| Create a fallback implementation of IOUring that uses non-batched IO operations, in case we cannot use IO uring or liburing. More...
|
|
static std::unique_ptr< IOUring > | make_unique (unsigned entries) |
| Create an object that supports an io_uring-like interface. The created object uses io_uring if supported, otherwise uses individual read/write operations. More...
|
|
Fallback implementation of the IOUring batch interface. This implementation uses queues of individual read/write operations instead of a single batched operation.
◆ IOUringFallback()
geopm::IOUringFallback::IOUringFallback |
( |
unsigned |
entries | ) |
|
◆ ~IOUringFallback()
geopm::IOUringFallback::~IOUringFallback |
( |
| ) |
|
|
virtual |
◆ make_unique()
std::unique_ptr< IOUring > geopm::IOUringFallback::make_unique |
( |
unsigned |
entries | ) |
|
|
static |
Create a fallback implementation of IOUring that uses non-batched IO operations, in case we cannot use IO uring or liburing.
- Parameters
-
entries | The expected maximum number of batched operations. |
◆ prep_read()
void geopm::IOUringFallback::prep_read |
( |
std::shared_ptr< int > |
ret, |
|
|
int |
fd, |
|
|
void * |
buf, |
|
|
unsigned |
nbytes, |
|
|
off_t |
offset |
|
) |
| |
|
overridevirtual |
Perform a pread in the next batch submission.
- Parameters
-
ret | Where to store the operation's return value, which will be a non-negative number of bytes read, or -errno on failure, after submit() returns. |
fd | Which already-opened file to read. |
buf | Where to store the read data. |
nbytes | Number of bytes to read into buf . |
offset | Offset within fd to start the pread. -1 uses the existing offset of fd , like in read(). |
- Exceptions
-
if | the queue is already full. |
Implements geopm::IOUring.
◆ prep_write()
void geopm::IOUringFallback::prep_write |
( |
std::shared_ptr< int > |
ret, |
|
|
int |
fd, |
|
|
const void * |
buf, |
|
|
unsigned |
nbytes, |
|
|
off_t |
offset |
|
) |
| |
|
overridevirtual |
Perform a pwrite in the next batch submission.
- Parameters
-
ret | Where to store the operation's return value, which will be a non-negative number of bytes written, or -errno on failure, after submit() returns. |
fd | Which already-opened file to write. |
buf | Which data to write to the file. |
nbytes | Number of bytes to write from buf . |
offset | Offset within fd to start the pwrite. -1 uses the existing offset of fd , like in write(). |
- Exceptions
-
if | the queue is already full. |
Implements geopm::IOUring.
◆ submit()
void geopm::IOUringFallback::submit |
( |
| ) |
|
|
overridevirtual |
Submit all prepared uring operations in a batch, and wait for all operations to return a result. Throws if there are errors interacting with the completion queue. Failures of batched operations are reported by ret
from the operation's respective prep_... function call, and do not cause this function to throw.
Implements geopm::IOUring.
The documentation for this class was generated from the following files: