On Mon, Dec 09, 2024 at 02:13:40PM -0800, Bart Van Assche wrote: > On 12/5/24 12:03 AM, Nitesh Shetty wrote: > > But where do we store the read sector info before sending write. > > I see 2 approaches here, > > 1. Should it be part of a payload along with write ? > > We did something similar in previous series which was not liked > > by Christoph and Bart. > > 2. Or driver should store it as part of an internal list inside > > namespace/ctrl data structure ? > > As Bart pointed out, here we might need to send one more fail > > request later if copy_write fails to land in same driver. > > Hi Nitesh, > > Consider the following example: dm-linear is used to concatenate two > block devices. An NVMe device (LBA 0..999) and a SCSI device (LBA > 1000..1999). Suppose that a copy operation is submitted to the dm-linear > device to copy LBAs 1..998 to LBAs 2..1998. If the copy operation is Sorry, I don't think that's a valid operation -- 1998 - 2 = 1996 and 998 - 1 is 997, so these ranges are of different lengths. I presume you're trying to construct an operation which is entirely reading within the first device, and then is going to write across both devices. So let's say you want to read 1-900 and write to 501-1400. > submitted as two separate operations (REQ_OP_COPY_SRC and > REQ_OP_COPY_DST) then the NVMe device will receive the REQ_OP_COPY_SRC > operation and the SCSI device will receive the REQ_OP_COPY_DST > operation. The NVMe and SCSI device drivers should fail the copy operations > after a timeout because they only received half of the copy > operation. ... no? The SRC operation succeeds, but then the DM driver gets the DST operation and sees that it crosses the boundary and fails the DST op. Then the pair of ops can be retried using an in-memory buffer. I'm not quite clear on the atomicity; whether there could be an initial copy of 500-900 to 1000-1400 and then a remap of 1-499 to 501-999.