summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorAnastasia Kovaleva <a.kovaleva@yadro.com>2022-11-14 11:24:59 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2022-11-24 03:16:19 +0100
commit9375031ee40b66c8fd2fc24d5fbea47b69f53de6 (patch)
tree839819081fd59b57daa9fcd4324aee787ae5d40b /drivers/target
parentscsi: target: core: Send max transfer length in blocks (diff)
downloadlinux-9375031ee40b66c8fd2fc24d5fbea47b69f53de6.tar.xz
linux-9375031ee40b66c8fd2fc24d5fbea47b69f53de6.zip
scsi: target: core: Make hw_max_sectors store the sectors amount in blocks
By default, hw_max_sectors stores its value in 512 blocks in iblock, despite the fact that the block size can be 4096 bytes. Change hw_max_sectors to store the number of sectors in hw_block_size blocks. Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com> Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com> Link: https://lore.kernel.org/r/20221114102500.88892-3-a.kovaleva@yadro.com Reviewed-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_iblock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 8351c974cee3..2a704926edb9 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -124,7 +124,9 @@ static int iblock_configure_device(struct se_device *dev)
q = bdev_get_queue(bd);
dev->dev_attrib.hw_block_size = bdev_logical_block_size(bd);
- dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q);
+ dev->dev_attrib.hw_max_sectors = mult_frac(queue_max_hw_sectors(q),
+ SECTOR_SIZE,
+ dev->dev_attrib.hw_block_size);
dev->dev_attrib.hw_queue_depth = q->nr_requests;
/*