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:
A) Request is owned by block layer (refcount 0)
B) Request is owned by driver but with zero ARef
s in existence
(refcount 1)
C) Request is owned by driver with exactly one ARef
in existence
(refcount 2)
D) Request is owned by driver with more than one ARef
in existence
(refcount > 2)
We need to track A and B to ensure we fail tag to request conversions for requests that are not owned by the driver.
We need to track C and D 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.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 of self.wrapper_ref().refcount().