On 6/30/22 7:22 AM, Anastasia Kovaleva wrote: > To determine how many blocks sends in one command, the minimum value is > selected from the hw_max_sectors of both devices. In > target_xcopy_do_work, hw_max_sectors are used as blocks, not sectors; it > also ignores the fact that sectors can be of different sizes, for > example 512 and 4096 bytes. Because of this, a number of blocks can be > transmitted that the device will not be able to accept. > > Change the selection of max thransmition size into bytes. I think it's "transmission". Run the scripts/checkpatch.pl on the patch and fix up those warnings. Also don't forget to checkout the kernel test bot warnings. > > Signed-off-by: Anastasia Kovaleva <a.kovaleva@xxxxxxxxx> > Reviewed-by: Konstantin Shelekhin <k.shelekhin@xxxxxxxxx> > Reviewed-by: Dmitriy Bogdanov <d.bogdanov@xxxxxxxxx> > --- > drivers/target/target_core_xcopy.c | 68 ++++++++++++++++-------------- > drivers/target/target_core_xcopy.h | 2 +- > 2 files changed, 37 insertions(+), 33 deletions(-) > > diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c > index 6bb20aa9c5bc..c9341a92b567 100644 > --- a/drivers/target/target_core_xcopy.c > +++ b/drivers/target/target_core_xcopy.c > @@ -582,11 +582,11 @@ static int target_xcopy_read_source( > struct xcopy_op *xop, > struct se_device *src_dev, > sector_t src_lba, > - u32 src_sectors) > + u32 src_bytes) > { > struct xcopy_pt_cmd xpt_cmd; > struct se_cmd *se_cmd = &xpt_cmd.se_cmd; > - u32 length = (src_sectors * src_dev->dev_attrib.block_size); > + u32 transfer_length = src_bytes / src_dev->dev_attrib.block_size; It was nice how in the patches you added a bytes/blocks to the variable names. Maybe do that here and the other transfer_length you added? I wasn't sure if you just forgot or maybe adding a "block" in the name made it sound weird.