On 22/05/24 11:05AM, Bart Van Assche wrote:
On 5/20/24 03:20, Nitesh Shetty wrote:
We add two new opcode REQ_OP_COPY_DST, REQ_OP_COPY_SRC.
Since copy is a composite operation involving src and dst sectors/lba,
each needs to be represented by a separate bio to make it compatible
with device mapper.
We expect caller to take a plug and send bio with destination information,
followed by bio with source information.
Once the dst bio arrives we form a request and wait for source
bio. Upon arrival of source bio we merge these two bio's and send
corresponding request down to device driver.
Merging non copy offload bio is avoided by checking for copy specific
opcodes in merge function.
Plugs are per task. Can the following happen?
We rely on per-context plugging to avoid this.
* Task A calls blk_start_plug()
* Task B calls blk_start_plug()
* Task A submits a REQ_OP_COPY_DST bio and a REQ_OP_COPY_SRC bio.
Lets say this forms request A and stored in plug A
* Task B submits a REQ_OP_COPY_DST bio and a REQ_OP_COPY_SRC bio.
Lets say this forms request B and stored in plug B
* Task A calls blk_finish_plug()
* Task B calls blk_finish_plug()
* The REQ_OP_COPY_DST bio from task A and the REQ_OP_COPY_SRC bio from
task B are combined into a single request.
Here task A picks plug A and hence request A
* The REQ_OP_COPY_DST bio from task B and the REQ_OP_COPY_SRC bio from
task A are combined into a single request.
same as above, request B
So we expect this case not to happen.
Thank you,
Nitesh Shetty