pub struct Request<T: Operations>(/* private fields */);Expand description
A wrapper around a blk-mq struct request. This represents an IO request.
§Implementation details
There are four states for a request that the Rust bindings care about:
- Request is owned by block layer (refcount 0).
- Request is owned by driver but with zero
ARefs in existence (refcount 1). - Request is owned by driver with exactly one
ARefin existence (refcount 2). - Request is owned by driver with more than one
ARefin existence (refcount > 2).
We need to track 1 and 2 to ensure we fail tag to request conversions for requests that are not owned by the driver.
We need to track 3 and 4 to ensure that it is safe to end the request and hand back ownership to the block layer.
The states are tracked through the private refcount field of
RequestDataWrapper. This structure lives in the private data area of the C
struct request.
§Invariants
self.0is a validstruct requestcreated by the C portion of the kernel.- The private data area associated with this request must be an initialized
and valid
RequestDataWrapper<T>. selfis reference counted by atomic modification ofself.wrapper_ref().refcount().
Implementations§
Trait Implementations§
Source§impl<T: Operations> AlwaysRefCounted for Request<T>
impl<T: Operations> AlwaysRefCounted for Request<T>
impl<T: Operations> Send for Request<T>
impl<T: Operations> Sync for Request<T>
Auto Trait Implementations§
impl<T> !Freeze for Request<T>
impl<T> !RefUnwindSafe for Request<T>
impl<T> !Unpin for Request<T>
impl<T> UnwindSafe for Request<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more