diff mbox series

[v2,2/3] target: core: make hw_max_sectors store the sectors amount in blocks

Message ID 20221014114549.32888-3-a.kovaleva@yadro.com
State Superseded
Headers show
Series Make target send correct io limits | expand

Commit Message

Anastasia Kovaleva Oct. 14, 2022, 11:45 a.m. UTC
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.

Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Dmitriy Bogdanov <d.bogdanov@yadro.com>
---
 drivers/target/target_core_iblock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Oct. 17, 2022, 6:05 a.m. UTC | #1
On Fri, Oct 14, 2022 at 02:45:48PM +0300, Anastasia Kovaleva wrote:
> 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.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

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;
 
 	/*