From patchwork Fri Sep 13 18:28:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828850 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C13BA139CE9 for ; Fri, 13 Sep 2024 18:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.153.30 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252156; cv=none; b=Ml1ca3p7OP29DBiRqAhi96q/vce9+YXcCT+RjS4BM/3LqDmHyFmKG2tWhskBtr3oZsyHR67PFKC1ApcP/TsMZqIqY2ez8esJtENoyZjn+2iY1ZD6ShQBJvLyee72ES6tfTfiyPfVHJH5nTR+q+waO8QlC5oxxYVFEA7c5y/z25Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252156; c=relaxed/simple; bh=XoEpw5S2u1wXeN3nCPq1cfEK9odrIn7xITR9y1OrN04=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Clf6AKsGyyIGLNxcwkaSD2EjTpbzUTA0Sjk80CGhKW4o9mPVf7HthOnDdmn1Bj9LQ84A+ydC5TkW/hkTgJIdOaxHAedk2q2qjE6qzyfrCVgSqjyS1zuCB5nrRBnZSefwRL8KlS/eAEe++S6Dn9lSwYIs1WfSgxF+ZX2VsB7HqKc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=FWfIdwSH; arc=none smtp.client-ip=67.231.153.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="FWfIdwSH" Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI2LlR003051 for ; Fri, 13 Sep 2024 11:29:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=ol2Diwm840wEdv83fl13zLXO99ZYV29lYaH8A1zftr8=; b= FWfIdwSHCEfZy0/YTni/5H8bHV/misFA2GgOj/n3yB5SebLo5TLlhZfU6T0Tf3xF IzV8Qv/hEy2VO139ORDsrNn+Plvv7DpxeG5YK+xdCR3LejNSKLi3kqqRC7DTr4TJ nRbA5hDFBPaHM008rv+ZX7VYuOhmoKaIxWg7n8hqp0RDc/a6rzWCVcf7HrT2XzLQ ZUPJRfw0Nat6+U0UYLAfeS6d4F9rBdbxMzJcs3yIkA2dHUa4emeaR+eORxCU8oM7 IZX0eUw8cUmvRoZBsrSN7Hiwebd6kau1TsxmASEgXceKWMoQoXpYbswgs55n1/U3 CK/6wgTwmdC5YqvHrlfQuw== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41kha4qjc4-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:13 -0700 (PDT) Received: from twshared0911.02.ash9.facebook.com (2620:10d:c085:108::4) by mail.thefacebook.com (2620:10d:c08b:78::c78f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:09 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 56D3E12F91043; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 1/9] blk-mq: unconditional nr_integrity_segments Date: Fri, 13 Sep 2024 11:28:46 -0700 Message-ID: <20240913182854.2445457-2-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: VgTs5rjXJ_A-uVHoYtv3uiTJtnlGC_OY X-Proofpoint-ORIG-GUID: VgTs5rjXJ_A-uVHoYtv3uiTJtnlGC_OY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch Always defining the field will make using it easier and less error prone in future patches. There shouldn't be any downside to this: the field fits in what would otherwise be a 2-byte hole, so we're not saving space by conditionally leaving it out. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-mq.c | 2 -- include/linux/blk-mq.h | 3 --- 2 files changed, 5 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 3f1f7d0b3ff35..ef3a2ed499563 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -376,9 +376,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->io_start_time_ns = 0; rq->stats_sectors = 0; rq->nr_phys_segments = 0; -#if defined(CONFIG_BLK_DEV_INTEGRITY) rq->nr_integrity_segments = 0; -#endif rq->end_io = NULL; rq->end_io_data = NULL; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 8d304b1d16b15..4fecf46ef681b 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -149,10 +149,7 @@ struct request { * physical address coalescing is performed. */ unsigned short nr_phys_segments; - -#ifdef CONFIG_BLK_DEV_INTEGRITY unsigned short nr_integrity_segments; -#endif #ifdef CONFIG_BLK_INLINE_ENCRYPTION struct bio_crypt_ctx *crypt_ctx; From patchwork Fri Sep 13 18:28:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828580 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C47F13AA41 for ; Fri, 13 Sep 2024 18:29:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252163; cv=none; b=EvlHjn/sjFbzPuBnrb6Z9T7OaopyX2PbzGimYnJCOw6ySNTcbUUAlzyAMQJIZjQogaExuBo1We5LoOUTCTt5ZpdMSXbHMEcx8bEbrDLXwTrG/mSzjQL2pZzkSweSc6tMlp72CMqp06CppyJ0ZdZZamSrJv+1SBzcyn2h8xiBKNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252163; c=relaxed/simple; bh=XIbXz65NGOF+8WjRY9AcaYfdofzplqXjYiKbIsxhYPI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PvjHXKtMA88MkLYzkoZL3z44U4+rXyDHUVbCpNVbr7uHtBOLIo+yrSyc+kWjujNrlgd3Nt6u1JVocyJ+UjsDLHM/nKD1MHwMnmslG1A05M5KsGUIDUMpuGN/1RP7yBjmQxuYtb2HDALCZUamPd+eU/kGSDt5mePA5bVZeXcvWSc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=l9BOmwG0; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="l9BOmwG0" Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI2Cuf032443 for ; Fri, 13 Sep 2024 11:29:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=dDsEwI+ao/aPgw7GYpJ4ITMYtFyfxhpYZ0cKsKXdu2I=; b= l9BOmwG0WeCwavTRrsEDifIzDVYyiRmWIh5N1E1kuGr7Jn2A4OYBq7G9ctZXukqh hlR88tdODz6m3QdLgkl+Cvem0f1IXHdZRhk8xoP1ExikjXrNAh/XhMRf9BLHnNEB LurENNvH3OSx6L9mEm6yG8305I1Q12ifUN7btMSqrn2PY+qLmAb042CmRNgxow3Q dAPwvbY8V5wSfI48yyJcn4ChVKEP3E+BUv/gHke6O/OUmCr64tY6BjpVTfYkg/rL A4qaGRMDMuFb1d30v7LRxRD+ut7cW6dnedzsjNQL2NCOqeKUrXlXHXkvhaz5CGAf BVynHnzfFWdoOkRRQW/0xw== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mqb2sp95-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:21 -0700 (PDT) Received: from twshared32638.07.ash9.facebook.com (2620:10d:c085:208::f) by mail.thefacebook.com (2620:10d:c08b:78::c78f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:10 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 60F6E12F91045; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 2/9] blk-mq: set the nr_integrity_segments from bio Date: Fri, 13 Sep 2024 11:28:47 -0700 Message-ID: <20240913182854.2445457-3-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: CmL8LgEoD1UyQDnXUgNNV1vCr-4p4twG X-Proofpoint-ORIG-GUID: CmL8LgEoD1UyQDnXUgNNV1vCr-4p4twG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch This value is used for merging considerations, so it needs to be accurate. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-mq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index ef3a2ed499563..82219f0e9a256 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2544,6 +2544,9 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio, rq->__sector = bio->bi_iter.bi_sector; rq->write_hint = bio->bi_write_hint; blk_rq_bio_prep(rq, bio, nr_segs); + if (bio_integrity(bio)) + rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q, + bio); /* This can't fail, since GFP_NOIO includes __GFP_DIRECT_RECLAIM. */ err = blk_crypto_rq_bio_prep(rq, bio, GFP_NOIO); From patchwork Fri Sep 13 18:28:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828581 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D70013774B for ; Fri, 13 Sep 2024 18:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252162; cv=none; b=ugQEybI75SmLwwmaxy54JqheNsncqwZdUkNHxB+bnXTvQAB7srmmNFouZ7UC8lp5AeTJGL39kmmIvNFJfh7TfnhGEqTYSK+vgpfpwtpbXMvBYMYOaAl4dqzQc0iw2JpWd6935UtbAVIiEdDqjHMWFe+t50G2Do3dBApeyDYm+Sc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252162; c=relaxed/simple; bh=X81DJqYcgEwRYW6k80qOnRuSdeOnPN+S7H+naGQt1Bc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tIq49c8yz1foh1CwK9RWUhyUjJz5v6/Uxt3oe1RluGoEdF+0EMSyMlFpJJDKNwgnlwSEAnBcqgW2LlT64a+v+1eOx2LuXvxnvHC38/dJ8MwPGdAQVv5vX9z+9sEDKzim1yFAnWyZW7elVo91SX+LSbMQBjB3xecsr/kM9cWow/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=TjYEE7q+; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="TjYEE7q+" Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI2Cud032443 for ; Fri, 13 Sep 2024 11:29:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=EK7qRVh7IubhEF75usjllDVX8wTrwNSbwEX2ZPVAxZ4=; b= TjYEE7q+wgX0XEKkcNJRs2RGesVbDegYUp+HLCdvhP7zrqHfohg3ek3iTeoo+meG BBVc4rVWbwZy0hXGn5+DVQMO7hYf+vAvmbM5kFupk7hFbth4FP800IBqxZeiooGN 6qAhyDt1zKE1G53ikDLp23fUuw9jreMlAznSwFwxT7fKBUG0Rv7FkK69ERmN/kGI 8bgUQMbI2FxmbCcQYZpZb1LO80kHTzakPAyHodDud3CxCp8Yskwq5OASjWgcJGCL FghDqLZNkxvsMQU9g2MBdOSvaAPGYoleevYzCcb5r+ZVOyZHOpxrEdN4a8R29JhX cJAtHF8JxJcwvGUMP7aFWw== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mqb2sp95-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:20 -0700 (PDT) Received: from twshared32638.07.ash9.facebook.com (2620:10d:c085:208::7cb7) by mail.thefacebook.com (2620:10d:c08b:78::c78f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:10 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 691FB12F91047; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 3/9] blk-integrity: properly account for segments Date: Fri, 13 Sep 2024 11:28:48 -0700 Message-ID: <20240913182854.2445457-4-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: yKBvhoGjNeHW7VPU1Bkximtv5ztSXFRS X-Proofpoint-ORIG-GUID: yKBvhoGjNeHW7VPU1Bkximtv5ztSXFRS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch Both types of merging when integrity data is used are miscounting the segments: Merging two requests wasn't accounting for the new segment count, so add the "next" segment count to the first on a successful merge to ensure this value is accurate. Merging a bio into an existing request was double counting the bio's segments, even if the merge failed later on. Move the segment accounting to the end when the merge is successful. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-integrity.c | 2 -- block/blk-merge.c | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 010decc892eaa..afd101555d3cb 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -153,8 +153,6 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, q->limits.max_integrity_segments) return false; - req->nr_integrity_segments += nr_integrity_segs; - return true; } diff --git a/block/blk-merge.c b/block/blk-merge.c index 56769c4bcd799..ad763ec313b6a 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -639,6 +639,9 @@ static inline int ll_new_hw_segment(struct request *req, struct bio *bio, * counters. */ req->nr_phys_segments += nr_phys_segs; + if (bio_integrity(bio)) + req->nr_integrity_segments += blk_rq_count_integrity_sg(req->q, + bio); return 1; no_merge: @@ -731,6 +734,7 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req, /* Merge is OK... */ req->nr_phys_segments = total_phys_segments; + req->nr_integrity_segments += next->nr_integrity_segments; return 1; } From patchwork Fri Sep 13 18:28:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828583 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2ABED139590 for ; Fri, 13 Sep 2024 18:29:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252155; cv=none; b=G6uEYqSynGNQBJImJHBQ+/y01gKih58STKHBkWV1FPGCnabnh6R8rf3as4CAX/56wfKTfg3ml2cQVMiTyw7vQ/m1kHcrsoQ/jHPWknBv0rpTuHz1r8S9nZ9l7zDvDndQiDXla8x5b/7PVyed/fuk8Suqf9ZZ9B1jvgwBO1Apo+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252155; c=relaxed/simple; bh=DVVKnOrWjiRoSCgaBNa//smYB0J1VdkCfgXVLidzJbQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oVSBhojuAX6lp0xTwH1BJK0liW5+GyhxUyRh9JDgAi6spDjWqZnXoLuwCx/WBFi/DQpFqKq9VhoZNOqYKqM0i4Fz5E142hoD7B9EadDrrPaCk8YRtvaTz6GCros9C5xJEQ6ZXrOqXo8te7CpJECjX6iqFEB851tWYeSUVXNZcjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=bVysg4A6; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="bVysg4A6" Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI2DVZ032589 for ; Fri, 13 Sep 2024 11:29:13 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=oUfSROr0FhSCtvL6UbszCRKrsV9riysj4gJgGG+83JA=; b= bVysg4A6Z0dHj0+PmhLV8Fv/24JJKgX75zpqBCm4rw1XGrIsmNbHbP899aGx3k/p FiR6gcC19dPSqqe2R1E9VSiuYFZrzcfmwKtfZQA4TFKt7oi9PXtq0/tik3rolCri boS/0Vnnj0XCkqcL1iFPM0zVPObyQxeTSy+W5yOhUEBJzRldGLGJkEEWpibMPSaC +tpN+Wy24Dd3bXtAuRu7mRrgRk0Dm0PsT+zQz8LpqDlSemrRatH3rei457+o0Ytf aFC3KgiMMG2IOMwyDIzIJsZ0wmINfxF04AOMrnoXMRtOLynAtkBbVqYB1MLWi2vf woLE+om6VClxVlKH2/aChg== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mqb2sp7a-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:13 -0700 (PDT) Received: from twshared13976.17.frc2.facebook.com (2620:10d:c0a8:1c::11) by mail.thefacebook.com (2620:10d:c0a9:6f::237c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:06 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 6F30E12F91049; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 4/9] blk-integrity: consider entire bio list for merging Date: Fri, 13 Sep 2024 11:28:49 -0700 Message-ID: <20240913182854.2445457-5-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: Bgv5YagGNgGvI6h2V4ROH2gaRBZW71HY X-Proofpoint-ORIG-GUID: Bgv5YagGNgGvI6h2V4ROH2gaRBZW71HY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch If a bio is merged to a request, the entire bio list is merged, so don't temporarily detach it from its list when counting segments. In most cases, bi_next will already be NULL, so detaching is usually a no-op. But if the bio does have a list, the current code is miscounting the segments for the resulting merge. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-integrity.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index afd101555d3cb..84065691aaed0 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -134,7 +134,6 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, struct bio *bio) { int nr_integrity_segs; - struct bio *next = bio->bi_next; if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL) return true; @@ -145,10 +144,7 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags) return false; - bio->bi_next = NULL; nr_integrity_segs = blk_rq_count_integrity_sg(q, bio); - bio->bi_next = next; - if (req->nr_integrity_segments + nr_integrity_segs > q->limits.max_integrity_segments) return false; From patchwork Fri Sep 13 18:28:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828852 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE40A2F860 for ; Fri, 13 Sep 2024 18:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252150; cv=none; b=XZKIIqnObz3dyn1HZyjSKs/a4GuoIFyM9COw+CnRm22boRi+kM9I14oYWHMvZ2n2fRaQO4vRyp5IWWXCCleY7cHcGqyVyftkcEWB8v9L4KzF7XhTNU41lz+ffB0UPLvj+E3gnuXiZrc/nQ3r1FVS9MQKzPVqQBJIooiAo4rD9/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252150; c=relaxed/simple; bh=/xRbpYTmItdNfTgMZUlmMcBDDQDJai5vbVVoVSnAvNM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mp+3jyT5sJ4gkND3HMflTdmFUZjwuAMgp3o8IT9qCjTVYzTBixOH2pnhHWGE3pTaBIRci3GyBdz9/9BeoT2esvs78x/fmldsVT+n3P6cdx1oFSCWaxWPqGNHX+h11pSjOTQikDp2iEj+AKb/u/eWOdpxt9d/dQsYtQGfxOMUufw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=fHF+1n/8; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="fHF+1n/8" Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI9uOc016519 for ; Fri, 13 Sep 2024 11:29:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=YjRDVhh75SMTGa/Nn/K3IvSmdcIyNqHJBBkm4InR34M=; b= fHF+1n/8IqkkxClSZzL2/Xn6LCL7Uw93tAn9SkLLlcFFctTvPF3/5/9dBlnOSqLh 1cv14+n7lTZVWXdOUQbwgqHqDQz13PrJllwLh2huzG96i/xuBAcMrNvuOB0mMLNT BLut+nGeGD0sGeajx+2l7NHfHkFRjIYpagWwCqZnriQ772SvdCLXzcHL1j7+rF3f 0aK7bhEgvu9yQ8e2QhityVK80eMFUbRw9nUQ8mLNCSmC7B2x1VLsDP1wuNcon6Y3 TvTwIwcd9G/sOUqoNuqyK+OvTSO6i60jNjVJr5ez6cBtVoF9k4lm/+LUQG0lozgy ACZhy2Dg0AbiOyRc7eiUWw== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mte705n8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:07 -0700 (PDT) Received: from twshared57535.03.ash8.facebook.com (2620:10d:c0a8:1b::30) by mail.thefacebook.com (2620:10d:c0a9:6f::8fd4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:06 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 7966312F9104B; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch , Kanchan Joshi Subject: [PATCHv5 5/9] block: provide a request helper for user integrity segments Date: Fri, 13 Sep 2024 11:28:50 -0700 Message-ID: <20240913182854.2445457-6-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: Eegenq0eeyezyqqVNAb6Md0WLiwSv9BK X-Proofpoint-GUID: Eegenq0eeyezyqqVNAb6Md0WLiwSv9BK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch Provide a helper to keep the request flags and nr_integrity_segments in sync with the bio's integrity payload. This is an integrity equivalent to the normal data helper function, 'blk_rq_map_user()'. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Kanchan Joshi Signed-off-by: Keith Busch --- block/bio-integrity.c | 1 - block/blk-integrity.c | 14 ++++++++++++++ drivers/nvme/host/ioctl.c | 6 ++---- include/linux/blk-integrity.h | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 8d1fb38f745f9..357a022eed411 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -371,7 +371,6 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes, kfree(bvec); return ret; } -EXPORT_SYMBOL_GPL(bio_integrity_map_user); /** * bio_integrity_prep - Prepare bio for integrity I/O diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 84065691aaed0..ddc742d58330b 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -107,6 +107,20 @@ int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio, } EXPORT_SYMBOL(blk_rq_map_integrity_sg); +int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, + ssize_t bytes, u32 seed) +{ + int ret = bio_integrity_map_user(rq->bio, ubuf, bytes, seed); + + if (ret) + return ret; + + rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q, rq->bio); + rq->cmd_flags |= REQ_INTEGRITY; + return 0; +} +EXPORT_SYMBOL_GPL(blk_rq_integrity_map_user); + bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, struct request *next) { diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 1d769c842fbf5..b9b79ccfabf8a 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -3,7 +3,6 @@ * Copyright (c) 2011-2014, Intel Corporation. * Copyright (c) 2017-2021 Christoph Hellwig. */ -#include #include #include /* for force_successful_syscall_return */ #include @@ -153,11 +152,10 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, bio_set_dev(bio, bdev); if (has_metadata) { - ret = bio_integrity_map_user(bio, meta_buffer, meta_len, - meta_seed); + ret = blk_rq_integrity_map_user(req, meta_buffer, meta_len, + meta_seed); if (ret) goto out_unmap; - req->cmd_flags |= REQ_INTEGRITY; } return ret; diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index de98049b7ded9..793dbb1e0672d 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -28,6 +28,8 @@ static inline bool queue_limits_stack_integrity_bdev(struct queue_limits *t, int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, struct scatterlist *); int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); +int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, + ssize_t bytes, u32 seed); static inline bool blk_integrity_queue_supports_integrity(struct request_queue *q) @@ -102,6 +104,13 @@ static inline int blk_rq_map_integrity_sg(struct request_queue *q, { return 0; } +static inline int blk_rq_integrity_map_user(struct request *rq, + void __user *ubuf, + ssize_t bytes, + u32 seed) +{ + return -EINVAL; +} static inline struct blk_integrity *bdev_get_integrity(struct block_device *b) { return NULL; From patchwork Fri Sep 13 18:28:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828848 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8A4413AA53 for ; Fri, 13 Sep 2024 18:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.153.30 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252163; cv=none; b=U9/ZkXMUOrEFe6r7BoVwBp0yS9QNpJhAmgUVUQ6E0+F7bBRJPfRKU8D7EmFGvoeEp9f04pkD7sAmEqlvg7v/6Tl5wHvkTUA0irWtlscMAllSroFed1pF6nPAyj5YarPwm30IPFMYnN9Atujc67tkeBeBYCa9WSxjnkcfMuswFlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252163; c=relaxed/simple; bh=LQNvPJsnnG6srhGbizFLlLMMZW75saCeAcs5oP8Y1Hk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ULU4lZi4aLO3Om+cnBk9lshxLuB5gQqmZaAqP5njv4XXpCpgXVaNaOpXoLTgTHK0q30JhxsT2ud8Qh1FBeeHXb1Hpw75VkKJvZX5svfwgTcHsEDUViGffCgoW6Juk4B9PyXweTzPcYO6Nc7m/kSYgcp4mB6P+1Q0KPF8qcrOIP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=VgAm0THE; arc=none smtp.client-ip=67.231.153.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="VgAm0THE" Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.18.1.2/8.18.1.2) with ESMTP id 48DI29uc031774 for ; Fri, 13 Sep 2024 11:29:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=KJlLK4m9aT2f6rk7dnQeBXLeEgmslFG5sIDCnnhlqKo=; b= VgAm0THENlnROo0/l9H2cTlDi8sF5O+bTqkT0kOTCKkUyZ2EqmRHC6g1zC+14WB4 M0wBiAX74vOZ8Xb9pAiN/C0gw7oFmvE71BCx+felSOgKbclP374T8Owmnn45JFkT j6M+Z1ovwTe1Z0uZ/WE+TM8040ThReWsBbDq3I4DOMnZppJIMDMloLmysdpCr6DF Fglugvj3m+0GlDxGMdRRsyELTChal3F7w/JQj+qRFiP+m4yPlqnIf1szcT7Uu9Hg tVE0EhsVgbM0+DmRktwzyQTTxHZn5o64dSo2ZycQLadKmk0e258ZHH4oV5oT25+Y KJdzi8eXeaGqFp/d8X8gQA== Received: from mail.thefacebook.com ([163.114.134.16]) by m0089730.ppops.net (PPS) with ESMTPS id 41mpbqa2gb-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:20 -0700 (PDT) Received: from twshared23455.15.frc2.facebook.com (2620:10d:c085:108::150d) by mail.thefacebook.com (2620:10d:c08b:78::2ac9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:18 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 8186112F9104D; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch , Kanchan Joshi Subject: [PATCHv5 6/9] scsi: use request to get integrity segments Date: Fri, 13 Sep 2024 11:28:51 -0700 Message-ID: <20240913182854.2445457-7-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: C2Fq6uNdJoy4WejxjdQWx5QFRgFrNj-e X-Proofpoint-GUID: C2Fq6uNdJoy4WejxjdQWx5QFRgFrNj-e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch The request tracks the integrity segments already, so no need to recount the segments again. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Kanchan Joshi Signed-off-by: Keith Busch --- drivers/scsi/scsi_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3958a6d14bf45..c602b0af745ca 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1175,8 +1175,7 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd) goto out_free_sgtables; } - ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio); - + ivecs = rq->nr_integrity_segments; if (sg_alloc_table_chained(&prot_sdb->table, ivecs, prot_sdb->table.sgl, SCSI_INLINE_PROT_SG_CNT)) { From patchwork Fri Sep 13 18:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828584 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE9E212C54B for ; Fri, 13 Sep 2024 18:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252152; cv=none; b=a4rAVHF2+y0RM+TB3y968FhhaQpBWmbfP6Uld7FQmcqj9LpBSigZePi15areJKm/6AT+zleQvXUVYxDJkZeXKWmePQwHPPSg5XH2eWoehtgJ80AlgPvoWLS5ydZyC/i3SBMLVsrdxHZv31nJCNzQGp1lK6FyBPzIkSSPNCMrKe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252152; c=relaxed/simple; bh=eyPe9KJBGop6ccg4/RvQbOot9mGALbwbD2rK7OeE/9g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E6X06rNcOupY6ZSWzuvqPuupzLDHUFOw0gk5uWpz9x7DBclCPMGkFwJPsrlY0G1kk0/l3DQ09rPP+Yp8d+Y9esX6gxU0w1YtvkIY+rAeu2W2ce3Uj+qXOl73E7YHgwwxCy06SK1EytMCqEY7kK/X4OwNi8fjE+NieECUqzXJI1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=LKbwMfgG; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="LKbwMfgG" Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DIANFH018518 for ; Fri, 13 Sep 2024 11:29:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=RWIdamZUV/daqLi0XaMr2NW2huZHn5RwNbZdv3Y9OBM=; b= LKbwMfgGhLRc6oJ2BAVl3N4UNTH0SbpitrSMMSwvxps3IanpH0HsvJwBegSkQLZo xtQ566wFijhLEAk03KoDXz1BBbHloLyTwHrO1FKFtf/6/L1HoQsF84eAzqeRnzyC LSFrPAKEdTC3Tkp6YWM5u1SkqT0tzhWK9Mp7vbheeubxhXn9/wjTBjFXMTfFlXUB RKR3VlKPCgf82TDnjBI/0mpBWSVax4EEin672AE/pkRlcCs9/CMMiY65qBaSjDS1 MLEVQoNEUOx6IJ33S4q5lfutcHt/DAH5miwUtpufY+0Zs6kvOSX71cM+N1FJCH+U +19TRb7p1U7wFGscel6TFA== Received: from mail.thefacebook.com ([163.114.134.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mte705nd-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:10 -0700 (PDT) Received: from twshared18321.17.frc2.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c08b:78::2ac9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:07 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 8DC0712F9104F; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch , Kanchan Joshi Subject: [PATCHv5 7/9] nvme-rdma: use request to get integrity segments Date: Fri, 13 Sep 2024 11:28:52 -0700 Message-ID: <20240913182854.2445457-8-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: Fb9GmU7zeUzlUK3-tzPA9AGsrVniYtUo X-Proofpoint-GUID: Fb9GmU7zeUzlUK3-tzPA9AGsrVniYtUo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch The request tracks the integrity segments already, so no need to recount the segments again. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Kanchan Joshi Signed-off-by: Keith Busch --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 15b5e06039a5f..256466bdaee7c 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1496,7 +1496,7 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq, req->metadata_sgl->sg_table.sgl = (struct scatterlist *)(req->metadata_sgl + 1); ret = sg_alloc_table_chained(&req->metadata_sgl->sg_table, - blk_rq_count_integrity_sg(rq->q, rq->bio), + rq->nr_integrity_segments, req->metadata_sgl->sg_table.sgl, NVME_INLINE_METADATA_SG_CNT); if (unlikely(ret)) { From patchwork Fri Sep 13 18:28:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828851 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1662112E1E9 for ; Fri, 13 Sep 2024 18:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252152; cv=none; b=EwBDWir35F8IUPpMM19jUWz7qxdt0FK4Y0MNCFXDYYtLMFDNr47ENsrtpKX1Zjphv8k7BG4PBaCkKHuphscoV8LSmMfB6JTPKrxZP+NbSwUeJNuP/DGGHbsGWCXzHP3eXYldUVKQnmUfSaumWdRtOoKadrr3f94O2UwB+O513wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252152; c=relaxed/simple; bh=iz1+AhRMB4Jo0p2TIHTuDSLNf7yS85rfXZrYU2zdXmI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QzQCCLcpT4OkhBQKwe2u5bl7tn1XNaKAiML4KFZ8E86tO31ZgehIIcnjjIE5oCxNehRMMxl3EFbjpW7VXr8BwHhCN7jXMVU5Sd60Ei3ctzLniHOwA2qXuU93KnYv6d4UUEL404w0UW7WEHKgu/1pXVRciVsix16i/bKQ8QIhmpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=eB+fO9Eo; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="eB+fO9Eo" Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI9uOh016519 for ; Fri, 13 Sep 2024 11:29:10 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=HcqXvo6kQUXv7b2KuuGjEPVoCjrXFP5rn6rmKQIjDMs=; b= eB+fO9EoWcqkHrsr+jKYMXy/ig+HbIx3QOvTL1B+tx8GyTuuSo8qmYi1ONuEzmhZ eoPg/TzVge+jXh9B+sW/7OIc8cSGNRyRrKLbmx/R0h12FZpIe10YMg0Ih0fDN8S6 luEwKb/bjmpJipH4j7/SXRF7iUJ4K80wfFY1jac+K7sDLGPZGIt0R283ZFU8bYNk sy0gg1uvl7gzA4VS9kGYVrf5Wf0kD+orzpD67Bq43xdoRxJfJDFR3zyDwddCXpaj rjkv/8Yi9WBCdkc+i8b1vVrnUGtszd9119zdb2MOyJfZB5TkIcph9ug2z4u9UF0G efQj97VZpCIwBdiAzw06/A== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mte705n8-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:10 -0700 (PDT) Received: from twshared13976.17.frc2.facebook.com (2620:10d:c0a8:1c::1b) by mail.thefacebook.com (2620:10d:c0a9:6f::8fd4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:06 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 97EB512F91051; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 8/9] block: unexport blk_rq_count_integrity_sg Date: Fri, 13 Sep 2024 11:28:53 -0700 Message-ID: <20240913182854.2445457-9-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: UPoy2z-69afXCuTdXVULlkerWL2QfOqS X-Proofpoint-GUID: UPoy2z-69afXCuTdXVULlkerWL2QfOqS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch There are no external users of this. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-integrity.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index ddc742d58330b..1d82b18e06f8e 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -53,7 +53,6 @@ int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio) return segments; } -EXPORT_SYMBOL(blk_rq_count_integrity_sg); /** * blk_rq_map_integrity_sg - Map integrity metadata into a scatterlist From patchwork Fri Sep 13 18:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 828849 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1983213213A for ; Fri, 13 Sep 2024 18:29:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.145.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252160; cv=none; b=ib0AQUQ7MMKjzPBR+KpepPmylxQZ2rkpq5XXSyoRlgRq9E6SG/aHciozDG3O427VPQc/eMJYp2d0gWUTg3gn/WLXxkKWAmqrX08PlF8koy1PDqL0wkfcUslMLsFMPGf4olDMjBZS5eQoRIzxMEm9Ix1S1+JOyPI0zYz3TNKn8f4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726252160; c=relaxed/simple; bh=eMJrezZr9HbuifV/esvLyKXDYwMZt4+GKhhHQyCGb7E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RHhGMKZa7cwK5ymJOB03aDTFVecUMic5lQ0RzGnUK2hH0WYRlo7j5DCPw5GsFs8Ed244yWMK0bhanXGNPJRynFHsIyXCT0m7H56NnNXmSNL2kuXEHNjso1/6tOtg5rODf01VCduJSMcGrOzUKhDqyoa5KKTOzhe7kT/GTAOnGkw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com; spf=pass smtp.mailfrom=meta.com; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b=RuJtQyw8; arc=none smtp.client-ip=67.231.145.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=meta.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=meta.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=meta.com header.i=@meta.com header.b="RuJtQyw8" Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DI2DVh032589 for ; Fri, 13 Sep 2024 11:29:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= s2048-2021-q4; bh=p6VwkvKbI/A78E59kaxtyU9y0s+RsmIy8xFoL+H0KLU=; b= RuJtQyw84XCedloXPWvzGimgpQpcoR9CRK4FZzQYbWxHnGYqxXjwncGtyfyYK55d mTD5910abFLEa7yqnHVtoA+aYrDWY3oUqlvp5fvze0IwH7MjYLFTBxPLPfXiqJXC wpPtjrA/wPHdl6WQEpf7MnnFU1z8/rbPytoeUyosjUL8eLSVakwDmwplH/FzYXzT WY6u+clOKRSSKVw1saNdkx6fWo3QdldFu0JJi5j8xPy01tsvxUvPC4rueMgK6CfS xKXgUhlgJvcWMh/YMSxAGDhntgquk4qCG7x/XY2IBfjsEVwH24inP9tKsY2ZGMcV GH9iqQWIL2rC0kcU/F7UyA== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 41mqb2sp7a-19 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Sep 2024 11:29:18 -0700 (PDT) Received: from twshared13976.17.frc2.facebook.com (2620:10d:c0a8:1c::11) by mail.thefacebook.com (2620:10d:c0a9:6f::237c) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.11; Fri, 13 Sep 2024 18:29:07 +0000 Received: by devbig638.nha1.facebook.com (Postfix, from userid 544533) id 9C02E12F91053; Fri, 13 Sep 2024 11:29:03 -0700 (PDT) From: Keith Busch To: , , , , , CC: , Keith Busch Subject: [PATCHv5 9/9] blk-integrity: improved sg segment mapping Date: Fri, 13 Sep 2024 11:28:54 -0700 Message-ID: <20240913182854.2445457-10-kbusch@meta.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240913182854.2445457-1-kbusch@meta.com> References: <20240913182854.2445457-1-kbusch@meta.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: MSsgCTQ_RV9W3TcBBbeE0czSUrXs_1Mq X-Proofpoint-ORIG-GUID: MSsgCTQ_RV9W3TcBBbeE0czSUrXs_1Mq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 From: Keith Busch Make the integrity mapping more like data mapping, blk_rq_map_sg. Use the request to validate the segment count, and update the callers so they don't have to. Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Signed-off-by: Keith Busch --- block/blk-integrity.c | 15 +++++++++++---- drivers/nvme/host/rdma.c | 4 ++-- drivers/scsi/scsi_lib.c | 11 +++-------- include/linux/blk-integrity.h | 6 ++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 1d82b18e06f8e..549480aa2a069 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -62,19 +62,20 @@ int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio) * * Description: Map the integrity vectors in request into a * scatterlist. The scatterlist must be big enough to hold all - * elements. I.e. sized using blk_rq_count_integrity_sg(). + * elements. I.e. sized using blk_rq_count_integrity_sg() or + * rq->nr_integrity_segments. */ -int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio, - struct scatterlist *sglist) +int blk_rq_map_integrity_sg(struct request *rq, struct scatterlist *sglist) { struct bio_vec iv, ivprv = { NULL }; + struct request_queue *q = rq->q; struct scatterlist *sg = NULL; + struct bio *bio = rq->bio; unsigned int segments = 0; struct bvec_iter iter; int prev = 0; bio_for_each_integrity_vec(iv, bio, iter) { - if (prev) { if (!biovec_phys_mergeable(q, &ivprv, &iv)) goto new_segment; @@ -102,6 +103,12 @@ int blk_rq_map_integrity_sg(struct request_queue *q, struct bio *bio, if (sg) sg_mark_end(sg); + /* + * Something must have been wrong if the figured number of segment + * is bigger than number of req's physical integrity segments + */ + BUG_ON(segments > blk_rq_nr_phys_segments(rq)); + BUG_ON(segments > queue_max_integrity_segments(q)); return segments; } EXPORT_SYMBOL(blk_rq_map_integrity_sg); diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 256466bdaee7c..c8fd0e8f02375 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1504,8 +1504,8 @@ static int nvme_rdma_dma_map_req(struct ib_device *ibdev, struct request *rq, goto out_unmap_sg; } - req->metadata_sgl->nents = blk_rq_map_integrity_sg(rq->q, - rq->bio, req->metadata_sgl->sg_table.sgl); + req->metadata_sgl->nents = blk_rq_map_integrity_sg(rq, + req->metadata_sgl->sg_table.sgl); *pi_count = ib_dma_map_sg(ibdev, req->metadata_sgl->sg_table.sgl, req->metadata_sgl->nents, diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index c602b0af745ca..c2f6d0e1c03e7 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1163,7 +1163,6 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd) if (blk_integrity_rq(rq)) { struct scsi_data_buffer *prot_sdb = cmd->prot_sdb; - int ivecs; if (WARN_ON_ONCE(!prot_sdb)) { /* @@ -1175,19 +1174,15 @@ blk_status_t scsi_alloc_sgtables(struct scsi_cmnd *cmd) goto out_free_sgtables; } - ivecs = rq->nr_integrity_segments; - if (sg_alloc_table_chained(&prot_sdb->table, ivecs, + if (sg_alloc_table_chained(&prot_sdb->table, + rq->nr_integrity_segments, prot_sdb->table.sgl, SCSI_INLINE_PROT_SG_CNT)) { ret = BLK_STS_RESOURCE; goto out_free_sgtables; } - 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)); - + count = blk_rq_map_integrity_sg(rq, prot_sdb->table.sgl); cmd->prot_sdb = prot_sdb; cmd->prot_sdb->table.nents = count; } diff --git a/include/linux/blk-integrity.h b/include/linux/blk-integrity.h index 793dbb1e0672d..676f8f860c474 100644 --- a/include/linux/blk-integrity.h +++ b/include/linux/blk-integrity.h @@ -25,8 +25,7 @@ static inline bool queue_limits_stack_integrity_bdev(struct queue_limits *t, } #ifdef CONFIG_BLK_DEV_INTEGRITY -int blk_rq_map_integrity_sg(struct request_queue *, struct bio *, - struct scatterlist *); +int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); int blk_rq_count_integrity_sg(struct request_queue *, struct bio *); int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, ssize_t bytes, u32 seed); @@ -98,8 +97,7 @@ static inline int blk_rq_count_integrity_sg(struct request_queue *q, { return 0; } -static inline int blk_rq_map_integrity_sg(struct request_queue *q, - struct bio *b, +static inline int blk_rq_map_integrity_sg(struct request *q, struct scatterlist *s) { return 0;