[v2,09/14] scsi: change to use blk_rq_nr_integrity_segments() instead of blk_rq_count_integrity_sg()
Message ID | 20230510085648epcms2p8f7a9095b798cab8746c39ea25d7f3bec@epcms2p8 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3472449vqo; Wed, 10 May 2023 02:06:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6ItjYhyAFV5+SVrfezz6fX7t/D6fwO0Eq4tI2l/VQ0ZRb567vyiEmIiBY2axk8J0O7yJuu X-Received: by 2002:a17:90a:290e:b0:23c:fef0:d441 with SMTP id g14-20020a17090a290e00b0023cfef0d441mr17664823pjd.33.1683709611075; Wed, 10 May 2023 02:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683709611; cv=none; d=google.com; s=arc-20160816; b=wY9rtHg4CVtk5QX0URrk+wJjYF0kIbe7CCGjRF8pPUqkRwUx8kcuxS8TW4xNF8APEZ tPKAiXtG0NqBAcVjV/BeVLLDqNaPM2tVIum8Cnm692OExl9Hj3fG0qZmUuS2mSkqFu/V dJW5Dp1obTK65R3SW0ySjPtL2BJCRATJ6vETgJEsF22wt5RPZCvTROnvym51D7KYhVog 5KOSmNJJU1Iwb46xacefyqxgqr91myyWgQ5lqAGKZmqQnjMGXgigU5f1ApnWx8GKA20Q zVGHfc1i5qbQbSGYD3WKmkfn3XIi85zL45QD5WZmfHig5lbh1R4bhgk9ZEsLzuHgCdms FyAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:in-reply-to:to:from :sender:reply-to:subject:mime-version:dkim-signature:dkim-filter; bh=J1DOTjK8gn87giwmABoGcvRXxfDSssG6aRXYYY56duk=; b=WT9foYZIUd0iZQY/m2yMcfR/JgKekzeFECCQWpgZTt/vRCP9jCg3969aDQj2B4PyQr Yna4F8AOJd/XXPu+qRzc52TKMBWV+zeTt1mpGMt0fuCvpNz9S67r3Y3hvmTBoGknNqGF wjuAlBtRQj2HslqgP8WsTMV5oV1ARhVseQP/5M2tVb+OONqwCVsbdOvVpMWwIAMvxFx5 NtdnDgMWhENHfcx2oRFYlWJZGiX/zIToF2VZtbsE+k6Z5dWCGa5ZFgLRDPEHyEgCR13J HNU2bbd3TkaUYfGLwuFszQRlTDRT7KoAC095UFDa903+pHQ/P5ValF/hxsTK5kEd6Pxr Wkvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=umFmWPI1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b00502f0410410si3519659pgd.472.2023.05.10.02.06.36; Wed, 10 May 2023 02:06:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=umFmWPI1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236842AbjEJI44 (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Wed, 10 May 2023 04:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236851AbjEJI4x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 10 May 2023 04:56:53 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFF51992 for <linux-kernel@vger.kernel.org>; Wed, 10 May 2023 01:56:51 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230510085650epoutp0367c7b4233af43c34da0bb3038fcf24f9~dvGyJBiop1904419044epoutp03K for <linux-kernel@vger.kernel.org>; Wed, 10 May 2023 08:56:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230510085650epoutp0367c7b4233af43c34da0bb3038fcf24f9~dvGyJBiop1904419044epoutp03K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1683709010; bh=J1DOTjK8gn87giwmABoGcvRXxfDSssG6aRXYYY56duk=; h=Subject:Reply-To:From:To:In-Reply-To:Date:References:From; b=umFmWPI1h3xq6KWOn9ccYpx2SqYTYAq7IrFm01qWBs0DnJb6VIAcqq380Z18jZwUt Mo4gncJbmeFyniWZnn1BpwsDkFHl/XBNyFkDADGSeg59ERpzbK85JP5+gpfvdnlWvw F3vros25MA8PC1aMcPRRA1NLFjZR05yTA1S/csZ0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230510085649epcas2p2753e134660d5d8874f0a72088df2d640~dvGxmnF2f1277712777epcas2p2o; Wed, 10 May 2023 08:56:49 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.100]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4QGTRN6M9zz4x9Py; Wed, 10 May 2023 08:56:48 +0000 (GMT) X-AuditID: b6c32a47-e99fd70000002007-6d-645b5c50b6c2 Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 69.69.08199.05C5B546; Wed, 10 May 2023 17:56:48 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH v2 09/14] scsi: change to use blk_rq_nr_integrity_segments() instead of blk_rq_count_integrity_sg() Reply-To: j-young.choi@samsung.com Sender: Jinyoung CHOI <j-young.choi@samsung.com> From: Jinyoung CHOI <j-young.choi@samsung.com> To: Jinyoung CHOI <j-young.choi@samsung.com>, "axboe@kernel.dk" <axboe@kernel.dk>, "kbusch@kernel.org" <kbusch@kernel.org>, "hch@lst.de" <hch@lst.de>, "sagi@grimberg.me" <sagi@grimberg.me>, "jejb@linux.ibm.com" <jejb@linux.ibm.com>, "martin.petersen@oracle.com" <martin.petersen@oracle.com>, "johannes.thumshirn@wdc.com" <johannes.thumshirn@wdc.com>, "kch@nvidia.com" <kch@nvidia.com>, "willy@infradead.org" <willy@infradead.org>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230510085648epcms2p8f7a9095b798cab8746c39ea25d7f3bec@epcms2p8> Date: Wed, 10 May 2023 17:56:48 +0900 X-CMS-MailID: 20230510085648epcms2p8f7a9095b798cab8746c39ea25d7f3bec Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJJsWRmVeSWpSXmKPExsWy7bCmuW5ATHSKQfcSE4vVd/vZLF4e0rRY ufook0Vv/1Y2i0U3tjFZ/O26x2Qx6dA1RounV2cxWey9pW1xedccNovl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KGvR3rm5PZ3/d3H7035Ea5V v1mT9U5pWEnqE4vjmZb6/k/7tiw9Ye2xvCb2QPOfuKajp81PyUvIp7fp/1q6TCHs75nr7+Yp sRRnJBpqMRcVJwIA9QaM7UwEAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684 References: <20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p1> <CGME20230510084407epcms2p123f17696d3c30c749897eeaf2c4de684@epcms2p8> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765497489427572755?= X-GMAIL-MSGID: =?utf-8?q?1765497489427572755?= |
Series |
Change the integrity configuration method in block
|
|
Commit Message
Jinyoung Choi
May 10, 2023, 8:56 a.m. UTC
In the block layer, the number of segments is recorded in the request.
It is already divided into separate segments based on hw information.
Therefore, there is no need to count again.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com>
---
drivers/scsi/scsi_lib.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 89cf21345e1a..5d67b6f6854e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1006,8 +1006,9 @@ static inline bool scsi_cmd_needs_dma_drain(struct scsi_device *sdev, static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) { struct request *rq = scsi_cmd_to_rq(cmd); + unsigned short nr_integrity_segs = blk_rq_nr_integrity_segments(rq); struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; - int count, ivecs; + int count; if (WARN_ON_ONCE(!prot_sdb)) { /* @@ -1018,9 +1019,7 @@ static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) return BLK_STS_IOERR; } - ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); - - if (sg_alloc_table_chained(&prot_sdb->table, ivecs, + if (sg_alloc_table_chained(&prot_sdb->table, nr_integrity_segs, prot_sdb->table.sgl, SCSI_INLINE_PROT_SG_CNT)) { return BLK_STS_RESOURCE; @@ -1028,10 +1027,7 @@ static blk_status_t scsi_alloc_integrity_sgtables(struct scsi_cmnd *cmd) count = blk_rq_map_integrity_sg(rq->q, rq->bio, prot_sdb->table.sgl); - BUG_ON(count > ivecs); - BUG_ON(count > queue_max_integrity_segments(rq->q)); - - cmd->prot_sdb = prot_sdb; + BUG_ON(count > prot_sdb->table.nents); cmd->prot_sdb->table.nents = count; return BLK_STS_OK;