pub struct Request<T>(/* 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
ARef
s in existence (refcount 1). - Request is owned by driver with exactly one
ARef
in existence (refcount 2). - Request is owned by driver with more than one
ARef
in 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.
Note that the driver can still obtain new ARef
even if there is no ARef
s in existence by
using tag_to_rq
, hence the need to distinguish B and C.
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.0
is a validstruct request
created by the C portion of the kernel.- The private data area associated with this request must be an initialized
and valid
RequestDataWrapper<T>
. self
is 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
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot
. Read more