From patchwork Fri Oct 14 11:45:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Kovaleva X-Patchwork-Id: 615379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5132FC4167B for ; Fri, 14 Oct 2022 11:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229624AbiJNLqU (ORCPT ); Fri, 14 Oct 2022 07:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiJNLqM (ORCPT ); Fri, 14 Oct 2022 07:46:12 -0400 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC1A6DFB74; Fri, 14 Oct 2022 04:46:09 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 32C7B41220; Fri, 14 Oct 2022 11:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received:received; s= mta-01; t=1665747966; x=1667562367; bh=vvj0DKabEFwvHkKOGLh1yeT/k zHZ5GPfeIsn6eWZCj8=; b=K8IzUEnrAJaG8SfD2zbeUIAwLtXkfYNi7XRIZ581I 8Sr6ag5nHPaSBhVbdEeqHbsL4tfFPFpSG2/KGdHl5a5OukoX/XFAzvcpVjeSl5Fi SIk+Mnua0xBNGHbajGatDEKteij+SRD7GRFgcuWKY3wnm+mkXNHjtHztXllVhNka U0= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8Dgzfop0cZOX; Fri, 14 Oct 2022 14:46:06 +0300 (MSK) Received: from T-EXCH-01.corp.yadro.com (T-EXCH-01.corp.yadro.com [172.17.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 327C64120D; Fri, 14 Oct 2022 14:46:05 +0300 (MSK) Received: from T-EXCH-09.corp.yadro.com (172.17.11.59) by T-EXCH-01.corp.yadro.com (172.17.10.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Fri, 14 Oct 2022 14:46:04 +0300 Received: from localhost (10.199.23.220) by T-EXCH-09.corp.yadro.com (172.17.11.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Fri, 14 Oct 2022 14:46:04 +0300 From: Anastasia Kovaleva To: CC: , 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 Message-ID: <20221014114549.32888-3-a.kovaleva@yadro.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221014114549.32888-1-a.kovaleva@yadro.com> References: <20221014114549.32888-1-a.kovaleva@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.23.220] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-09.corp.yadro.com (172.17.11.59) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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 Reviewed-by: Konstantin Shelekhin Reviewed-by: Dmitriy Bogdanov Reviewed-by: Christoph Hellwig --- 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; /*