All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anastasia Kovaleva <a.kovaleva@yadro.com>
To: <target-devel@vger.kernel.org>
Cc: <linux-scsi@vger.kernel.org>, <linux@yadro.com>
Subject: [v2,PATCH 2/3] target: core: make hw_max_sectors store the sectors amount in blocks
Date: Fri, 14 Oct 2022 14:45:48 +0300	[thread overview]
Message-ID: <20221014114549.32888-3-a.kovaleva@yadro.com> (raw)
In-Reply-To: <20221014114549.32888-1-a.kovaleva@yadro.com>

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(-)

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


  parent reply	other threads:[~2022-10-14 11:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 11:45 [v2,PATCH 0/3] Make target send correct io limits Anastasia Kovaleva
2022-10-14 11:45 ` [v2,PATCH 1/3] target: core: Send mtl in blocks Anastasia Kovaleva
2022-10-17  6:05   ` Christoph Hellwig
2022-10-14 11:45 ` Anastasia Kovaleva [this message]
2022-10-17  6:05   ` [v2,PATCH 2/3] target: core: make hw_max_sectors store the sectors amount " Christoph Hellwig
2022-10-14 11:45 ` [v2,PATCH 3/3] target: core: Change the way target_xcopy_do_work sets restiction on max io Anastasia Kovaleva
2022-10-17  6:06   ` Christoph Hellwig
2022-10-18 10:22   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014114549.32888-3-a.kovaleva@yadro.com \
    --to=a.kovaleva@yadro.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux@yadro.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.