From patchwork Tue Oct 29 16:23:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855185 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 AAB8119992D for ; Tue, 29 Oct 2024 17:23:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222618; cv=none; b=sdklpmUui2UWEm78B4IvenKTQ1jJnhaZnFOq1ysbt++dod+bQIU0+Kx4ZZwLGzX19LafWT+My4npSDviIS4HKCr3kGxG6PKreJkBuolm26FyHkIIxq6jOqK8hWjWMY1PVqRj1YUs3/WB+rfv1ILbUbHRdsR4/RY/6vDxFgs7vlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222618; c=relaxed/simple; bh=z3oZCEUpNWP6ssVVNnvaEMGwTgZ5HxAO2xsIC7OVOu8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=cv4i2YXP6PIOT1/TpC8KUmCq9xdecPtFMmgkfjxP3pb7N7SNdJMnYkFxG4jVYQyzYbxbu9dVshgVWijz9/ULwbH/04cY0jJtk7Tnpz1e7a1zWwQMw4CfQ2/+0QVhhuXCBDf4lJRDELXP9+1YB5t/15Nco9Tgwk0Vt8575ARg2Uc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=ZGUJdLQz; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ZGUJdLQz" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172329epoutp019e320c007dae50ca54c8cfc720eb2d54~C-EvDpSsa2983329833epoutp01B for ; Tue, 29 Oct 2024 17:23:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172329epoutp019e320c007dae50ca54c8cfc720eb2d54~C-EvDpSsa2983329833epoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222609; bh=n6LNHR2UxOEOGCqUSfrJ4D/dcAXYHqklNM5hsVN/lLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGUJdLQzXfB+Jn+OV9uPft2c3Lw7ObN4HT8krFnTomAGD7B01CsLnOSt1qnlVUFEZ dN7CLo0Sz9gTPbp5ouT21yUFK0NXeONz13meHiBsGczGrzlZB/rMN4jaGVEAFChgDZ 7nLdJIeJTmPDE6V4v7wU1gLkFNRW+fm42WSZIuGo= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241029172327epcas5p15535030cdb0b11a5fccbccc2884959e1~C-EtQ8P8J0037900379epcas5p1R; Tue, 29 Oct 2024 17:23:27 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.177]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdHCd4hSqz4x9Pp; Tue, 29 Oct 2024 17:23:25 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B1.D6.08574.D0A11276; Wed, 30 Oct 2024 02:23:25 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241029163212epcas5p343cd56d66b58a9e7e8e1faa98067891d~C_X9UiqHl1013710137epcas5p3W; Tue, 29 Oct 2024 16:32:12 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163212epsmtrp1f4a60e084ee71d4f462f7b95f77989a7~C_X9TsX_o0723107231epsmtrp1g; Tue, 29 Oct 2024 16:32:12 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-f7-67211a0d8c6c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id CB.09.18937.B0E01276; Wed, 30 Oct 2024 01:32:12 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163209epsmtip2d32c463467f446bfe0b00d6644ddd425~C_X7DJ2U50887408874epsmtip2h; Tue, 29 Oct 2024 16:32:09 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v5 01/10] block: define set of integrity flags to be inherited by cloned bip Date: Tue, 29 Oct 2024 21:53:53 +0530 Message-Id: <20241029162402.21400-2-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-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a59cern/uK1p21jXtzI+2m0ftaH7kPK2xs9 mjd3+MVvbp8y57mI45VKlisrylyMXBqu+/FWip3svhacVbLgUP+0A49u7dNY+Pj2yuPpBd8s j/Qsvb+m7O8t03c2Cu5fPzzN2rWKzX/3pLNptzdxrNDquf3u3vMwMfGFP85c+W/3ulvoo/uf to/eyyZGruLNXFzW5MduorAzUCtgX/SJM/9i+uaYGO7+qBCqeSYoYCdvWO+tCObYd5JdG5nK tnvmKLEUZyQaajEXFScCAHpm5E4dAwAA X-CMS-MailID: 20241029163212epcas5p343cd56d66b58a9e7e8e1faa98067891d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163212epcas5p343cd56d66b58a9e7e8e1faa98067891d References: <20241029162402.21400-1-anuj20.g@samsung.com> Introduce BIP_CLONE_FLAGS describing integrity flags that should be inherited in the cloned bip from the parent. Suggested-by: Christoph Hellwig Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Keith Busch --- block/bio-integrity.c | 2 +- include/linux/bio-integrity.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 2a4bd6611692..a448a25d13de 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -559,7 +559,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src, bip->bip_vec = bip_src->bip_vec; bip->bip_iter = bip_src->bip_iter; - bip->bip_flags = bip_src->bip_flags & ~BIP_BLOCK_INTEGRITY; + bip->bip_flags = bip_src->bip_flags & BIP_CLONE_FLAGS; return 0; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index dbf0f74c1529..0f0cf10222e8 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -30,6 +30,9 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; +#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ + BIP_DISK_NOCHECK | BIP_IP_CHECKSUM) + #ifdef CONFIG_BLK_DEV_INTEGRITY #define bip_for_each_vec(bvl, bip, iter) \ From patchwork Tue Oct 29 16:23:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855186 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (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 9C0C81D9A40 for ; Tue, 29 Oct 2024 17:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222619; cv=none; b=FDXnje1ASrdWhyenrPURL2hYEqiGPI9U5CZlrrUDkSOgqWAHkptQGmEVcF3NrfvIJm/dqH333Bfi+//B+IvBi2pDL5v2eJb+y2smEQGTAvNVt8F250YuDtKj1TtcfkKkKo3JjFi2/Ma1sntQA8vVon5MfoEVBlf+00+S3h22vu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222619; c=relaxed/simple; bh=u4sUcEX/k+wez75P184+zcG/4LIpxzsuKCd9h01C0oc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=Bf/8suT2YiiVSX/fIdK6/CrdQ0qCQneGNN2Ernji3S5MTRAqZGIkkNUb5/AGbydAKkIs3gUV2nUL+ndXLfGmnS5q9Sr798ki7jCeZ9Gi8MTdIWA40Aiq7IN7IAgXqTvvYB+x4ZtFHR+LhooQ0OuK6nkwUtMTIycG/Ipew6K3XJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=jeX2xZC/; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="jeX2xZC/" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241029172335epoutp0461af01ae31c3b55fc60db8e930771603~C-E1W7yYt0698406984epoutp04I for ; Tue, 29 Oct 2024 17:23:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241029172335epoutp0461af01ae31c3b55fc60db8e930771603~C-E1W7yYt0698406984epoutp04I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222616; bh=1yEesIXP8hqj3mWCayZYKotAS9KxK7WmVJifezfxMwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jeX2xZC/LBi4YoC6cDzUO00POu0r7qcvQKL9zvWCUGWP1lhqzwJnveJPhBYv8u0V2 HWhzpuf6jUxX/cQafdMm5s9vjr+MNOrvstwQzgY0IUPhOH8ZGXpolGwzPmrIGhO1Xo YH0IGb9Vj4+/xeNI/l088ZxyHCEDEERZqREFPlkc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241029172335epcas5p4b9aeaf624b86420921a9231cc1551bee~C-E0vVZsB1636716367epcas5p4B; Tue, 29 Oct 2024 17:23:35 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHCn3w11z4x9Pv; Tue, 29 Oct 2024 17:23:33 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 02.F9.09420.51A11276; Wed, 30 Oct 2024 02:23:33 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775~C_X-v4_OV2340523405epcas5p1A; Tue, 29 Oct 2024 16:32:14 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163214epsmtrp1c51dc3fc90333bdd1c5a8dcc372ba54f~C_X-vDYut0708307083epsmtrp1K; Tue, 29 Oct 2024 16:32:14 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-52-67211a15b45d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id D4.07.08227.E0E01276; Wed, 30 Oct 2024 01:32:14 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163212epsmtip2c07a03b121b4c271c42f7bd3adf8681f~C_X9alVN10998409984epsmtip2W; Tue, 29 Oct 2024 16:32:12 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v5 02/10] block: copy back bounce buffer to user-space correctly in case of split Date: Tue, 29 Oct 2024 21:53:54 +0530 Message-Id: <20241029162402.21400-3-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmpq6olGK6waXHkhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsajO2vZC87xVUzbcpulgXE9TxcjJ4eEgInE7J0r WboYuTiEBHYzSkzf+JkRwvnEKLHm4l5mCOcbo8SMXY9YYFp+P/nODpHYyyhxZeFpqP7PjBIP t79kBqliE1CXOPK8FWyWiMAeRoleqCpmgZeMEktXLQKbJSyQLDH71i+gDg4OFgFViecfC0DC vAKWEnf//IFaJy8x8xLIOk4OTgEriWNH9zBB1AhKnJz5BKyGGaimeetsZoj6CxwSzx4HQ9gu Epd6QB4CsYUlXh3fwg5hS0m87G+DstMlflx+ygRhF0g0H9sHVW8v0XqqH+w0ZgFNifW79CHC shJTT61jgljLJ9H7+wlUK6/EjnkwtpJE+8o5ULaExN5zDVC2h8Tuv2uggdXLKLHj/lHWCYwK s5C8MwvJO7MQVi9gZF7FKJlaUJybnlpsWmCYl1oOj+bk/NxNjOA0ruW5g/Hugw96hxiZOBgP MUpwMCuJ8K6OlU0X4k1JrKxKLcqPLyrNSS0+xGgKDO6JzFKiyfnATJJXEm9o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ZqakFqEUyWiYNT qoHJ8c/HDRcuyYQZXO20c5sQdmHJz3JDY8fDJu2GP2a902toc9q78m3NSybVq1uDkzlrfbQF Mu5X67H/+h654cCFv1PPrG7m9t/5w/nJ/L7De9+kGe14dZ7P7Kjjfr2KeJaMA08+7Th/8Kj7 srw7XGpdZw/esX0if+ffHFNpaXf7E7+rjn3wtmaokCxMNZ86Vyhkfgab78H9+1517LK8YGmc f52Pf4fQnG47o7ZNybZXzu1U2i4m9nD/rSibGS0z27T+/JE2EnsW/59B45xKNuvz/87ZH2fZ Zr1fu/pGpY/1OcPKF01+q42kJsoqrNoQddDh6P5//qsj5FIKzq548HChhQ+vZu753U/nZdxy vvVUUYmlOCPRUIu5qDgRAL6ZvHUhAwAA X-CMS-MailID: 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163214epcas5p1069ca93a2a9d8840e4f142cc4b713775 References: <20241029162402.21400-1-anuj20.g@samsung.com> From: Christoph Hellwig Copy back the bounce buffer to user-space in entirety when the parent bio completes. The existing code uses bip_iter.bi_size for sizing the copy, which can be modified. So move away from that and fetch it from the vector passed to the block layer. While at it, switch to using better variable names. Fixes: 492c5d455969f ("block: bio-integrity: directly map user buffers") Signed-off-by: Anuj Gupta [hch: better names for variables] Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch --- block/bio-integrity.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index a448a25d13de..4341b0d4efa1 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -118,17 +118,18 @@ static void bio_integrity_unpin_bvec(struct bio_vec *bv, int nr_vecs, static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip) { - unsigned short nr_vecs = bip->bip_max_vcnt - 1; - struct bio_vec *copy = &bip->bip_vec[1]; - size_t bytes = bip->bip_iter.bi_size; - struct iov_iter iter; + unsigned short orig_nr_vecs = bip->bip_max_vcnt - 1; + struct bio_vec *orig_bvecs = &bip->bip_vec[1]; + struct bio_vec *bounce_bvec = &bip->bip_vec[0]; + size_t bytes = bounce_bvec->bv_len; + struct iov_iter orig_iter; int ret; - iov_iter_bvec(&iter, ITER_DEST, copy, nr_vecs, bytes); - ret = copy_to_iter(bvec_virt(bip->bip_vec), bytes, &iter); + iov_iter_bvec(&orig_iter, ITER_DEST, orig_bvecs, orig_nr_vecs, bytes); + ret = copy_to_iter(bvec_virt(bounce_bvec), bytes, &orig_iter); WARN_ON_ONCE(ret != bytes); - bio_integrity_unpin_bvec(copy, nr_vecs, true); + bio_integrity_unpin_bvec(orig_bvecs, orig_nr_vecs, true); } /** From patchwork Tue Oct 29 16:23:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855187 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 9F9901DAC8E for ; Tue, 29 Oct 2024 17:23:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222629; cv=none; b=RpAy4n1CMBaNzAbX85K6UqoirgIIVP98GGQI/+r/3xvwq4Oh9q+b9fMgdNQHNIMUOYaqP4PpwocPt6BAmh/KG78CZGIMuyYGOzszDHosV+QuEB4a17Xzm4N9xcLV5S3PgRF0QUs+fKkwiP+dPahxLEj+ylAAQ4vmUm0fVhkgUrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222629; c=relaxed/simple; bh=u0IdrfpF8vfRYrAsGoJ+C8qHOzARBVDbhDH4yIhjzQU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=LwD1oDtya2NTISKSezal7jJjNRAKbjDhFVdcPMzJKDTMn2IZE1ec/90J6+S2w+rLSrXYIVFN0IVlNxb2up0dqXskRvxs/EHV/iX9AHHdXAd/4+MmhKnnDNRSkCRuGUMQJagSdLYIMNbF8vY6dqrJGIiEmYf7snIAqG1y3I6IdO8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=plhiuL6x; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="plhiuL6x" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172343epoutp017598b044121625488c68378c1fd1ee35~C-E8z0Seq2780127801epoutp01B for ; Tue, 29 Oct 2024 17:23:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172343epoutp017598b044121625488c68378c1fd1ee35~C-E8z0Seq2780127801epoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222624; bh=+220GbndM91TZYcbQfyaQ2xjcCIjE+33z1HUaPt3Dds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=plhiuL6xhBHzEhD/hK8fOUsXe6zwNxIQa4EVxNVDFpOdKzuJ2m2b7V5Y44SBOJaRw x663/w0Y/ZmJav8Ow5OqDuwnS07TREN8sXKSBp4664Nq1XSzkY0EkOmIGxsfUBRA96 TqgKy7VIT7rJUzzdzCVhV7vcb5qyhK0+viUdQKlc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241029172343epcas5p1cc4d4e88a21d0042c881a223a4344724~C-E8MSMcJ0899208992epcas5p1E; Tue, 29 Oct 2024 17:23:43 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.176]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHCx5MVVz4x9Pt; Tue, 29 Oct 2024 17:23:41 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 73.F9.09420.D1A11276; Wed, 30 Oct 2024 02:23:41 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241029163217epcas5p414d493b7a89c6bd092afd28c4eeea24c~C_YCON41I1629316293epcas5p4x; Tue, 29 Oct 2024 16:32:17 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163217epsmtrp14680812d561cbd9f9c6bf89fd9b026a5~C_YCNJO9g0723107231epsmtrp1j; Tue, 29 Oct 2024 16:32:17 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-5e-67211a1d41d8 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 09.4B.07371.11E01276; Wed, 30 Oct 2024 01:32:17 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163214epsmtip21df614ea02497a6fcd82039dc37de744~C_X-xd3zu0975909759epsmtip2W; Tue, 29 Oct 2024 16:32:14 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v5 03/10] block: modify bio_integrity_map_user to accept iov_iter as argument Date: Tue, 29 Oct 2024 21:53:55 +0530 Message-Id: <20241029162402.21400-4-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLJsWRmVeSWpSXmKPExsWy7bCmhq6slGK6wYpnKhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyM35enMhY0CdXcfmcaANjr2QXIyeHhICJ RMf6l0xdjFwcQgK7GSU+7/nCDOF8YpTYva2dHcL5xihx5+UrRpiW7/dfMkIk9jJK3Hs/jQ3C +cwoMWneI1aQKjYBdYkjz1vBqkQE9jBK9C48zQLiMAtMYJJonziHHaRKWCBeoml9A1A7BweL gKrE5heeIGFeAUuJKf23odbJS8y89B2snFPASuLY0T1MEDWCEidnPmEBsZmB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8lYxcjF4eQwG5Gia4D61kgEhISp14uY4SwhSVW/nvODlH0kVHi z5JVYEVsAuoSR563ghWJCJxglJg/0Q2kiFlgBpNEz68VbCAJYYFYibsb24FsDg4WAVWJzS88 QcK8ApYSU/pvQy2Ql5h56Ts7iM0pYCVx7OgeJpByIaCak5PcIMoFJU7OfAK2lhmovHnrbOYJ jAKzkKRmIUktYGRaxSiZWlCcm56bbFhgmJdarlecmFtcmpeul5yfu4kRHG1aGjsY783/p3eI kYmD8RCjBAezkgjv6ljZdCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8hjNmpwgJpCeWpGanphak FsFkmTg4pRqYqqvSOyyPrjTl4lffb2z2y2wGS15phOfsSefF9Yt4/5e4tXPEyUvfscmx+r5J q6MytYWxIkUsXWXJ9VO7nkjfi5rd/EHVszcpo1JrX/TE1E0SYRMXSxx5VfUt9v5qmdfH2d03 7WB0bIx+fCmwpjz0l3v672WBGl7zF/H8qpyTcjV25cyWm7e80lW2Fs652vz8RYilUM58CYcG 3/bXd3OOi1w9J3Xwfkbe7fdcfy7KaOWkF5SLqSglG+9UV/F/N02Bt7kvZV+CjtWPcwtefeH7 untTq0iVW+PsCsUveTOdvyUqyOQvTuLQ76vlVfhelblxA8cZ/afXOTkYzR9a9GpuPqvY3280 uer3xKue2UosxRmJhlrMRcWJAPnP/wIlAwAA X-CMS-MailID: 20241029163217epcas5p414d493b7a89c6bd092afd28c4eeea24c X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163217epcas5p414d493b7a89c6bd092afd28c4eeea24c References: <20241029162402.21400-1-anuj20.g@samsung.com> This patch refactors bio_integrity_map_user to accept iov_iter as argument. This is a prep patch. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig Reviewed-by: Keith Busch --- block/bio-integrity.c | 12 +++++------- block/blk-integrity.c | 10 +++++++++- include/linux/bio-integrity.h | 5 ++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4341b0d4efa1..f56d01cec689 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -302,16 +302,15 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, return nr_bvecs; } -int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) { struct request_queue *q = bdev_get_queue(bio->bi_bdev); unsigned int align = blk_lim_dma_alignment_and_pad(&q->limits); struct page *stack_pages[UIO_FASTIOV], **pages = stack_pages; struct bio_vec stack_vec[UIO_FASTIOV], *bvec = stack_vec; + size_t offset, bytes = iter->count; unsigned int direction, nr_bvecs; - struct iov_iter iter; int ret, nr_vecs; - size_t offset; bool copy; if (bio_integrity(bio)) @@ -324,8 +323,7 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) else direction = ITER_SOURCE; - iov_iter_ubuf(&iter, direction, ubuf, bytes); - nr_vecs = iov_iter_npages(&iter, BIO_MAX_VECS + 1); + nr_vecs = iov_iter_npages(iter, BIO_MAX_VECS + 1); if (nr_vecs > BIO_MAX_VECS) return -E2BIG; if (nr_vecs > UIO_FASTIOV) { @@ -335,8 +333,8 @@ int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t bytes) pages = NULL; } - copy = !iov_iter_is_aligned(&iter, align, align); - ret = iov_iter_extract_pages(&iter, &pages, bytes, nr_vecs, 0, &offset); + copy = !iov_iter_is_aligned(iter, align, align); + ret = iov_iter_extract_pages(iter, &pages, bytes, nr_vecs, 0, &offset); if (unlikely(ret < 0)) goto free_bvec; diff --git a/block/blk-integrity.c b/block/blk-integrity.c index b180cac61a9d..4a29754f1bc2 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -115,8 +115,16 @@ EXPORT_SYMBOL(blk_rq_map_integrity_sg); int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf, ssize_t bytes) { - int ret = bio_integrity_map_user(rq->bio, ubuf, bytes); + int ret; + struct iov_iter iter; + unsigned int direction; + if (op_is_write(req_op(rq))) + direction = ITER_DEST; + else + direction = ITER_SOURCE; + iov_iter_ubuf(&iter, direction, ubuf, bytes); + ret = bio_integrity_map_user(rq->bio, &iter); if (ret) return ret; diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 0f0cf10222e8..58ff9988433a 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -75,7 +75,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t gfp, unsigned int nr); int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); -int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t len); +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter); void bio_integrity_unmap_user(struct bio *bio); bool bio_integrity_prep(struct bio *bio); void bio_integrity_advance(struct bio *bio, unsigned int bytes_done); @@ -101,8 +101,7 @@ static inline void bioset_integrity_free(struct bio_set *bs) { } -static inline int bio_integrity_map_user(struct bio *bio, void __user *ubuf, - ssize_t len) +static int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) { return -EINVAL; } From patchwork Tue Oct 29 16:23:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855188 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (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 9DB7E1DBB36 for ; Tue, 29 Oct 2024 17:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222632; cv=none; b=KMmc/E+itcWfMAohz3qk0XwHcJzBVRvHRF2y5NprIQrwIkGFeE/Pm2mChuufJRTjG00g5XtD/K7rp1fdbPCFaCn7FlmPhQhcENJJiKYIy2B7sqv12N4ACGYEEZ2MbIrHrgGzDNTOaTDEgBzKzk3CrPB3THMqQ+/13cvTaWZHPe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222632; c=relaxed/simple; bh=6Jsyj+yD2Vbk8Dl+vuFoXvjbwlYWR2rPusXgpoT9Lyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=G56dPqA0LEHbhylBe3F7cIFdZJDDvBDSbI82DDIA4308OPCmBqk6YXMi5KEbpS8W8GLQHjmTT1+oF1b551J6sKlzqEecHAexMPdacixS0iMJm3m1HkXbCehoFf+EoYE8sMI9lxaYL5e/rEflXl5eq7VMAy1MOwSpThWpdUDZLUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=OUgFSPyu; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="OUgFSPyu" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241029172348epoutp044134534a7a0fa17c57a310c5309de6e6~C-FBXHTOF1007310073epoutp04V for ; Tue, 29 Oct 2024 17:23:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241029172348epoutp044134534a7a0fa17c57a310c5309de6e6~C-FBXHTOF1007310073epoutp04V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222628; bh=RUxSD6cm/2/oRpjJQ/qX5pi0ZZMenTN0KcQUO7F+Cjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUgFSPyuH99B16995/j89/QOEcBpc8oLvwV3dwk50KDnMdF7RncNZA9kwq18UZhOL DNqu2vsljSlIxA83MkAD7yEvHdiD7dfoH4HPbXT4QHMuFYVgAEey/aMg53NfMnN6UO 6A/YQi7AHnJpYIwJfomeEKLLy4FS58sp9lDagdw0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241029172348epcas5p1ef1585b46b83aa08f29a5a73359ad0f3~C-FAy1jzA0899208992epcas5p1K; Tue, 29 Oct 2024 17:23:48 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.176]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHD31511z4x9Pt; Tue, 29 Oct 2024 17:23:47 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 58.7A.18935.22A11276; Wed, 30 Oct 2024 02:23:46 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241029163220epcas5p2207d4c54b8c4811e973fca601fd7e3f5~C_YEu6-ss0970309703epcas5p2B; Tue, 29 Oct 2024 16:32:20 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163220epsmtrp184c6055921ab0b6389e5209895ed85f2~C_YEuC6yO0708307083epsmtrp1M; Tue, 29 Oct 2024 16:32:20 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-bb-67211a22e017 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 3A.4B.07371.31E01276; Wed, 30 Oct 2024 01:32:19 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163217epsmtip253344fee5699a83a61ae5feaa5096850~C_YCQ_AR70998409984epsmtip2X; Tue, 29 Oct 2024 16:32:17 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v5 04/10] fs, iov_iter: define meta io descriptor Date: Tue, 29 Oct 2024 21:53:56 +0530 Message-Id: <20241029162402.21400-5-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbVRzHc+69tBdczbV7nTWC5caJsJVRRrsDwjbDolddIovGZLrZVbgp taWtfQxnRDpIV8HQls1ltnTIJo5H4zQdEBgghmfGVhgiGghkL1pxWJUR3SsMW1p0/33P73y/ v09+50Hi/GscAanUGFm9Rq6mOXFEW19ykogWJCrSekdfQAt/PyRQmWMJR+7mNoA8M3YOmu+7 A9DkDx0YavIMYOgPywiBak6VY2hgOchBx3t/Bqh7agvq6r5EoC/P+bnos1/aOahh6BGGRpeG YtCoy83dzWc6XDNcZtxnYrzNFRzmQn0p0zlp5jAL/imCsbU0A+ZKXT+XWfQmMN7ZIJYX97Yq u5CVF7B6IavJ1xYoNYoc+rU3ZLkyiT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: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163220epcas5p2207d4c54b8c4811e973fca601fd7e3f5 References: <20241029162402.21400-1-anuj20.g@samsung.com> Add flags to describe checks for integrity meta buffer. Also, introduce a new 'uio_meta' structure that upper layer can use to pass the meta/integrity information. Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta --- include/linux/uio.h | 10 ++++++++++ include/uapi/linux/fs.h | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 853f9de5aa05..eb3eee957a7d 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -82,6 +82,16 @@ struct iov_iter { }; }; +/* flags for integrity meta */ +typedef __u16 __bitwise uio_meta_flags_t; + +struct uio_meta { + uio_meta_flags_t flags; + u16 app_tag; + u64 seed; + struct iov_iter iter; +}; + static inline const struct iovec *iter_iov(const struct iov_iter *iter) { if (iter->iter_type == ITER_UBUF) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 753971770733..9070ef19f0a3 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -40,6 +40,15 @@ #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1< X-Patchwork-Id: 13855189 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (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 7DFDA1DC04A for ; Tue, 29 Oct 2024 17:23:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222637; cv=none; b=agLpnej+eyuXTHnN6xWPimWM49PofXwSIO3FglUMLX5sz+sAdOvIvNTeeTdvafN5eVTgP/nW79byDPxW/rdLWoP29uqWq03MbhuzcXePxQkcFrieboVcmJVyBwfSdh8YSzaeUeT+6plxY/91iZ/DcF5lHT18XBO/obIRiias5/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222637; c=relaxed/simple; bh=PPDNMGOuEvkJDIU7LllEytV2427zo9AzbP3ebXn9pJ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=Ue60YFi/0pKaLCNwxxaFOpGLT7tLYL6nGOScZ5qzwuaHFltZ3nfdtqBMwKjo1sxaWnQBs3Ofibi9TUcJJqsq99nSZZro2+H+bu8RKcuiGQINqeNDpT7QnHt0Dppi0r0uGZvvbJ1QCqbiA0TdG6jGnYWZ66YYS3JzztJN8ocovAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=KWZ27hw5; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="KWZ27hw5" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241029172353epoutp037eca7ad2f414c1fbf6120a8a73c6671c~C-FF1IhyQ0223102231epoutp03b for ; Tue, 29 Oct 2024 17:23:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241029172353epoutp037eca7ad2f414c1fbf6120a8a73c6671c~C-FF1IhyQ0223102231epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222633; bh=0Qev84oB/WNNKAORKgHjGWYS6Jca41BG3ZIzsvdmNNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWZ27hw5oS9faQkRuFYeijnhnnmdQcuulTdhLsGRWNPBkSvkI1JIrYHEOBF8djrUw pCDNHsCIgbd/cCo7H0Z+x1Hyu8+CfenjjHUsal8saWCUJWayfvKQnYIehsVdeXtlkd pju8kqHsYz1AfcIbL9kMYJfk+2+S0cpBZaXg6vnk= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241029172352epcas5p486cd4227fbfaf2132339288c04dd1c92~C-FEuMWFQ1636616366epcas5p4P; Tue, 29 Oct 2024 17:23:52 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.174]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XdHD71jzwz4x9Pp; Tue, 29 Oct 2024 17:23:51 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 5D.D1.09770.72A11276; Wed, 30 Oct 2024 02:23:51 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241029163222epcas5p4f46c83e92322214e00212cec15d29489~C_YHA9KY21629316293epcas5p45; Tue, 29 Oct 2024 16:32:22 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241029163222epsmtrp2f7ab7bd9f58f48551453104a414ef873~C_YHAG0HE1621316213epsmtrp26; Tue, 29 Oct 2024 16:32:22 +0000 (GMT) X-AuditID: b6c32a4a-e25fa7000000262a-b4-67211a27707c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id F5.07.08227.61E01276; Wed, 30 Oct 2024 01:32:22 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163220epsmtip258ddab2cdea3fe699614b56f614f2efb~C_YExiXqj0975909759epsmtip2X; Tue, 29 Oct 2024 16:32:20 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v5 05/10] fs: introduce IOCB_HAS_METADATA for metadata Date: Tue, 29 Oct 2024 21:53:57 +0530 Message-Id: <20241029162402.21400-6-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNJsWRmVeSWpSXmKPExsWy7bCmhq66lGK6wY2JHBYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsba02sYC66wVqy/1cLYwHiNpYuRk0NCwESi4+0a 9i5GLg4hgd2MEvcfXWSGcD4xSrz+tY8JwvnGKHFs90xGmJaPk96zQCT2MkpM/LmCFcL5zCjR fH8zM0g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rOtk8Ni+p99h9s4HN4+PT WywefVtWMXqcWXCE3ePzJjmPTU/eMgVwRXHZpKTmZJalFunbJXBlrD29hrHgCmvF+lstjA2M 11i6GDk5JARMJD5Oeg9kc3EICexmlGja0skOkZCQOPVyGSOELSyx8t9zdoiij4wSS5+vZgZJ sAmoSxx53gpWJCJwglFi/kQ3kCJmkKIJX2aDrRAWcJP4/OQeE4jNIqAqMevBPVYQm1fAUmLG 12NMEBvkJWZe+g62mVPASuLY0T1AcQ6gbZYSJye5QZQLSpyc+QRsJDNQefPW2cwTGAVmIUnN QpJawMi0ilEytaA4Nz232LDAKC+1XK84Mbe4NC9dLzk/dxMjOM60tHYw7ln1Qe8QIxMH4yFG CQ5mJRHe1bGy6UK8KYmVValF+fFFpTmpxYcYpTlYlMR5v73uTRESSE8sSc1OTS1ILYLJMnFw SjUwaWdsKb+XYjg3Z0ZXa5PhiRWe55aHnmSVFuu9MP3FtCclHf8mec6sv5wm3iFUKXbh3aOP U6QbNA6FVOy01pWaOSNCTviJ/+aSzvMH9JdnR/EmqqdqbNKLb1rcmNEq9iIzinvX3q2/OXv9 jUzcZNWNdzna68+4Nj3gYRezmKrgsssXjXyyNfq91NdsFNVceuRL978z/GfcZ2cr9Xy9/mHC zq76qSxhYVc67Jf9aDsiELqhed9FqV0ORpwT1q3fXKil315dszhP3LL/ac5x00cCd5O/bNw+ Z31UwvGQXrkJO8+5Mk78clNxreKnr0f/aTPqul98vuVhzl2DlhBj5ppPL2z5P0+X/nyve+Pd 5TtmKbEUZyQaajEXFScCAMuhadwiAwAA X-CMS-MailID: 20241029163222epcas5p4f46c83e92322214e00212cec15d29489 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163222epcas5p4f46c83e92322214e00212cec15d29489 References: <20241029162402.21400-1-anuj20.g@samsung.com> Introduce an IOCB_HAS_METADATA flag for the kiocb struct, for handling requests containing meta payload. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- include/linux/fs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index 4b5cad44a126..7f14675b02df 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -346,6 +346,7 @@ struct readahead_control; #define IOCB_DIO_CALLER_COMP (1 << 22) /* kiocb is a read or write operation submitted by fs/aio.c. */ #define IOCB_AIO_RW (1 << 23) +#define IOCB_HAS_METADATA (1 << 24) /* for use in trace events */ #define TRACE_IOCB_STRINGS \ From patchwork Tue Oct 29 16:23:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855190 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 6AC7D1DBB0D for ; Tue, 29 Oct 2024 17:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222643; cv=none; b=IldNS9FKnV2+j8LIrK460X3n/VeGzFSKBkq0GjPoRZL8+dOtS66hLIvA5xRzlDto3crjhu2+YdZANRUoQb73GZ6odha1JvzLqc7Dn5/buq7YMA13UqKdUVS7svamuwPyh+dSJoQnC/NFWRlYTinnv+dXb3gp/qwE/hG3kaeIa48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222643; c=relaxed/simple; bh=kVVqpch4W3C7vaedFKwtfznSdsSPmraBgqU1G7FqsVc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=i7yBQXInLyULxFTQlQ9Y4nXSaG9fjyZdRhI4gnFksgK0gJmlAtC6b0kqhUxtaQjBD2gDanQ8sgw3nc6YsVeTq9mGctsKgmfFWUUqUBFnT4EqxMynYPAHbZOFh5jjZYAaWv7ckduIY2zRofqGEma2de42HSsYysN4Fup+1Q6OiuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=J9U1lBMr; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="J9U1lBMr" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172357epoutp01b5275a6c309a4392b192ad153ffa47ce~C-FJk-x9P2917429174epoutp01b for ; Tue, 29 Oct 2024 17:23:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172357epoutp01b5275a6c309a4392b192ad153ffa47ce~C-FJk-x9P2917429174epoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222637; bh=tHAbilR2K4P3xVmFkTJzSdUKF5Ld+Fwe7sWbBnlCjJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9U1lBMrOzHQ5+anQTCPkUUrXW35rOGWLafYJ99tjZE1IP+ESkb05kwW8SxuaEhjC fJqAqeufHbM8wEaDtF+QeQqk1yBWkkafRGPWo748Jz0XoPmdCrT2X7Ec4VYcuu0Ygj E3CZZHaWhA3lD8BEda1G1QN0JYM7JyyuLxlImw+k= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241029172357epcas5p2015b9120eb423b446185217025ccc962~C-FJDQ9Wj0233702337epcas5p2S; Tue, 29 Oct 2024 17:23:57 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdHDC6PQJz4x9Pv; Tue, 29 Oct 2024 17:23:55 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 60.6F.09800.B2A11276; Wed, 30 Oct 2024 02:23:55 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c~C_YJmJnkX2264422644epcas5p2M; Tue, 29 Oct 2024 16:32:25 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163225epsmtrp1e30ac6a04ff99e5320275f75c8cd10e5~C_YJkUSfC0708307083epsmtrp1T; Tue, 29 Oct 2024 16:32:25 +0000 (GMT) X-AuditID: b6c32a4b-23fff70000002648-e6-67211a2bacfd Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id DD.09.18937.91E01276; Wed, 30 Oct 2024 01:32:25 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163222epsmtip2b2e748905798ff147e75e4ebcfa74b85~C_YHIAakw0998409984epsmtip2Y; Tue, 29 Oct 2024 16:32:22 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v5 06/10] io_uring/rw: add support to send metadata along with read/write Date: Tue, 29 Oct 2024 21:53:58 +0530 Message-Id: <20241029162402.21400-7-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJsWRmVeSWpSXmKPExsWy7bCmlq62lGK6wY3t+hYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyM3p2X2Ar6HGq2Lx+JlMD4z7TLkZODgkB E4l7C9+xdDFycQgJ7GaU2N86lR3C+cQo8fjeVwRn86kzbDAt037PZoNI7GSU2LB0DZTzmVHi 29EtLCBVbALqEkeetzKCJEQE9jBK9C48DbaFWWACk0T7xDnsIFXCAtESc75tZQKxWQRUJaat vsIMYvMKWErc23eUFWKfvMTMS9/B6jkFrCSOHd3DBFEjKHFy5hOwbcxANc1bZzND1N/gkHjQ 7AVhu0jcPzMZ6m5hiVfHt7BD2FISL/vboOx0iR+XnzJB2AUSzcf2MULY9hKtp/qBZnIAzdeU WL9LHyIsKzH11DomiLV8Er2/n0C18krsmAdjK0m0r5wDZUtI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mLmpe/sIDangJXEsaN7mEBahYBqTk5ygygXlDg58wkLiM0MVN68 dTbzBEaBWUhSs5CkFjAyrWIUTS0ozk3PTS4w1CtOzC0uzUvXS87P3cQIjjOtoB2My9b/1TvE yMTBeIhRgoNZSYR3daxsuhBvSmJlVWpRfnxRaU5q8SFGaQ4WJXFe5ZzOFCGB9MSS1OzU1ILU IpgsEwenVAPTxIkKPFaWL+7s+GjK6qB/JurNMaPlL2IucLE8Wnh617FXsTsMribe07OR8s5r YVw+K2bS9vw9m3YIz/RZzrhAZ9qq9oPPu9xOBN+MydzP8nWl1gYx55yZ54qcli73nap436wy r+GlxOnJRtI8P8UDP7Sv6w3edMyt5YLJlyOtCu2xCccnbNSwblGfn8v2d69Y/NnjZTIP3txg PrznUaqjTHIZj7dzoWzq/msPmd399Ut+K5X4pnQndYb13PrQvVS76Hi+TsuCY46b1m6Ts3u2 bWFrhbzO78IlRx7MyeHdF7Ks0odt/4EHEgKW7/f+TP5UNu3qpWg7+wgtxrY9xXMMa5OuNb8z DppsFVJTJ/lCiaU4I9FQi7moOBEAqUTueSIDAAA= X-CMS-MailID: 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163225epcas5p24ec51c7a9b6b115757ed99cadcc3690c References: <20241029162402.21400-1-anuj20.g@samsung.com> This patch adds the capability of sending metadata along with read/write. A new meta_type field is introduced in SQE which indicates the type of metadata being passed. This meta is represented by a newly introduced 'struct io_uring_meta_pi' which specifies information such as flags,buffer length,seed and apptag. Application sets up a SQE128 ring, prepares io_uring_meta_pi within the second SQE. The patch processes the user-passed information to prepare uio_meta descriptor and passes it down using kiocb->private. Meta exchange is supported only for direct IO. Also vectored read/write operations with meta are not supported currently. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi --- include/uapi/linux/io_uring.h | 29 +++++++++++++ io_uring/io_uring.c | 9 ++++ io_uring/rw.c | 79 ++++++++++++++++++++++++++++++++++- io_uring/rw.h | 14 ++++++- 4 files changed, 128 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 024745283783..4dab2b904394 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -92,6 +92,10 @@ struct io_uring_sqe { __u16 addr_len; __u16 __pad3[1]; }; + struct { + __u16 meta_type; + __u16 __pad4[1]; + }; }; union { struct { @@ -105,6 +109,31 @@ struct io_uring_sqe { */ __u8 cmd[0]; }; + /* + * If the ring is initialized with IORING_SETUP_SQE128, then + * this field is starting offset for 64 bytes of data. For meta io + * this contains 'struct io_uring_meta_pi' + */ + __u8 big_sqe[0]; +}; + +enum io_uring_sqe_meta_type_bits { + META_TYPE_PI_BIT, + /* not a real meta type; just to make sure that we don't overflow */ + META_TYPE_LAST_BIT, +}; + +/* meta type flags */ +#define META_TYPE_PI (1U << META_TYPE_PI_BIT) + +/* this goes to SQE128 */ +struct io_uring_meta_pi { + __u16 pi_flags; + __u16 app_tag; + __u32 len; + __u64 addr; + __u64 seed; + __u64 rsvd; }; /* diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 4514644fdf52..b3aeddeaba2f 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3875,10 +3875,13 @@ static int __init io_uring_init(void) BUILD_BUG_SQE_ELEM(44, __s32, splice_fd_in); BUILD_BUG_SQE_ELEM(44, __u32, file_index); BUILD_BUG_SQE_ELEM(44, __u16, addr_len); + BUILD_BUG_SQE_ELEM(44, __u16, meta_type); BUILD_BUG_SQE_ELEM(46, __u16, __pad3[0]); + BUILD_BUG_SQE_ELEM(46, __u16, __pad4[0]); BUILD_BUG_SQE_ELEM(48, __u64, addr3); BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd); BUILD_BUG_SQE_ELEM(56, __u64, __pad2); + BUILD_BUG_SQE_ELEM_SIZE(64, 0, big_sqe); BUILD_BUG_ON(sizeof(struct io_uring_files_update) != sizeof(struct io_uring_rsrc_update)); @@ -3902,6 +3905,12 @@ static int __init io_uring_init(void) /* top 8bits are for internal use */ BUILD_BUG_ON((IORING_URING_CMD_MASK & 0xff000000) != 0); + BUILD_BUG_ON(sizeof(struct io_uring_meta_pi) > + sizeof(struct io_uring_sqe)); + + BUILD_BUG_ON(META_TYPE_LAST_BIT > + 8 * sizeof_field(struct io_uring_sqe, meta_type)); + io_uring_optable_init(); /* diff --git a/io_uring/rw.c b/io_uring/rw.c index 7ce1cbc048fa..bcff3ae76268 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -257,11 +257,58 @@ static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) return 0; } +static inline void io_meta_save_state(struct io_async_rw *io) +{ + io->meta_state.seed = io->meta.seed; + iov_iter_save_state(&io->meta.iter, &io->meta_state.iter_meta); +} + +static inline void io_meta_restore(struct io_async_rw *io) +{ + io->meta.seed = io->meta_state.seed; + iov_iter_restore(&io->meta.iter, &io->meta_state.iter_meta); +} + +static int io_prep_rw_meta(struct io_kiocb *req, const struct io_uring_sqe *sqe, + struct io_rw *rw, int ddir, u16 meta_type) +{ + const struct io_uring_meta_pi *md = (struct io_uring_meta_pi *)sqe->big_sqe; + const struct io_issue_def *def; + struct io_async_rw *io; + int ret; + + if (READ_ONCE(sqe->__pad4[0])) + return -EINVAL; + if (!(meta_type & META_TYPE_PI)) + return -EINVAL; + if (!(req->ctx->flags & IORING_SETUP_SQE128)) + return -EINVAL; + if (READ_ONCE(md->rsvd)) + return -EINVAL; + + def = &io_issue_defs[req->opcode]; + if (def->vectored) + return -EOPNOTSUPP; + + io = req->async_data; + io->meta.flags = READ_ONCE(md->pi_flags); + io->meta.app_tag = READ_ONCE(md->app_tag); + io->meta.seed = READ_ONCE(md->seed); + ret = import_ubuf(ddir, u64_to_user_ptr(READ_ONCE(md->addr)), + READ_ONCE(md->len), &io->meta.iter); + if (unlikely(ret < 0)) + return ret; + rw->kiocb.ki_flags |= IOCB_HAS_METADATA; + io_meta_save_state(io); + return ret; +} + static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, int ddir, bool do_import) { struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); unsigned ioprio; + u16 meta_type; int ret; rw->kiocb.ki_pos = READ_ONCE(sqe->off); @@ -279,11 +326,20 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, rw->kiocb.ki_ioprio = get_current_ioprio(); } rw->kiocb.dio_complete = NULL; + rw->kiocb.ki_flags = 0; rw->addr = READ_ONCE(sqe->addr); rw->len = READ_ONCE(sqe->len); rw->flags = READ_ONCE(sqe->rw_flags); - return io_prep_rw_setup(req, ddir, do_import); + ret = io_prep_rw_setup(req, ddir, do_import); + + if (unlikely(ret)) + return ret; + + meta_type = READ_ONCE(sqe->meta_type); + if (meta_type) + ret = io_prep_rw_meta(req, sqe, rw, ddir, meta_type); + return ret; } int io_prep_read(struct io_kiocb *req, const struct io_uring_sqe *sqe) @@ -410,7 +466,10 @@ static inline loff_t *io_kiocb_update_pos(struct io_kiocb *req) static void io_resubmit_prep(struct io_kiocb *req) { struct io_async_rw *io = req->async_data; + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + if (rw->kiocb.ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); iov_iter_restore(&io->iter, &io->iter_state); } @@ -795,7 +854,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) if (!(req->flags & REQ_F_FIXED_FILE)) req->flags |= io_file_get_flags(file); - kiocb->ki_flags = file->f_iocb_flags; + kiocb->ki_flags |= file->f_iocb_flags; ret = kiocb_set_rw_flags(kiocb, rw->flags, rw_type); if (unlikely(ret)) return ret; @@ -824,6 +883,18 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type) kiocb->ki_complete = io_complete_rw; } + if (kiocb->ki_flags & IOCB_HAS_METADATA) { + struct io_async_rw *io = req->async_data; + + /* + * We have a union of meta fields with wpq used for buffered-io + * in io_async_rw, so fail it here. + */ + if (!(req->file->f_flags & O_DIRECT)) + return -EOPNOTSUPP; + kiocb->private = &io->meta; + } + return 0; } @@ -898,6 +969,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) * manually if we need to. */ iov_iter_restore(&io->iter, &io->iter_state); + if (kiocb->ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); do { /* @@ -1102,6 +1175,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) } else { ret_eagain: iov_iter_restore(&io->iter, &io->iter_state); + if (kiocb->ki_flags & IOCB_HAS_METADATA) + io_meta_restore(io); if (kiocb->ki_flags & IOCB_WRITE) io_req_end_write(req); return -EAGAIN; diff --git a/io_uring/rw.h b/io_uring/rw.h index 3f432dc75441..2d7656bd268d 100644 --- a/io_uring/rw.h +++ b/io_uring/rw.h @@ -2,6 +2,11 @@ #include +struct io_meta_state { + u32 seed; + struct iov_iter_state iter_meta; +}; + struct io_async_rw { size_t bytes_done; struct iov_iter iter; @@ -9,7 +14,14 @@ struct io_async_rw { struct iovec fast_iov; struct iovec *free_iovec; int free_iov_nr; - struct wait_page_queue wpq; + /* wpq is for buffered io, while meta fields are used with direct io */ + union { + struct wait_page_queue wpq; + struct { + struct uio_meta meta; + struct io_meta_state meta_state; + }; + }; }; int io_prep_read_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe); From patchwork Tue Oct 29 16:23:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855191 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 94C2E1FF618 for ; Tue, 29 Oct 2024 17:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222644; cv=none; b=jquKgNSHMUMv75UJ9m8YbGu42zmOyGH/u9TuZjrOw1DOi/+rKfei1vj10kR96P94htYGDXm+gl/92vO4TVx03EyKGxpEvFN5vGFd5XsVqdjRYErX0a/MfVeNmtme0toHev2a5ttqGSYtTlpXxa/gbfLnZncDArVQxMW+ZqX8umY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222644; c=relaxed/simple; bh=uhVUanvHeNYpdl7oe+2xBoF7IHpOF3ppOQIE4lSGydA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=gFNIXmayNn0pRq7c9w4OsAomgPHsTft4ixKvIq4nGpWEN6lfc7xPoIPBwtiY/sua/NJ4HmKr2Rrh/HpSfKO9fT7NMHinTgzXN4/cijNTJ0GWgbBaah9woHlgai6e7Nr7+C+r8LoTBosb3KomiTaza/YFm9DbdoiYISMSr2rXkYQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=mzwrcwJo; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="mzwrcwJo" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172400epoutp01eba704a6e602f0d7677cb65605cb1a53~C-FMkkRYC2780127801epoutp01N for ; Tue, 29 Oct 2024 17:24:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172400epoutp01eba704a6e602f0d7677cb65605cb1a53~C-FMkkRYC2780127801epoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222640; bh=OdnEOzPmE6BW4EwF3Q4T8kgPZcMcp2ktM4WfhkvkMt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzwrcwJoWpx3qi0WD6meqjI8n2fVLo8UNY8mkWBoUL6CwRti739qaPo/KpVPLmaH1 IL+6nqR1f86fdtXFPx36tM1TLn2/sbdUv9VIlWB/A4y6tnDXzk5B8jDZQq5PTrG05A zOgQ3bDF+ujc81rqWRurTWVd1DFgG0kRfsbAregY= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241029172400epcas5p35e10bdeb507f2be65e1525872191a877~C-FL3KKcU2485924859epcas5p3E; Tue, 29 Oct 2024 17:24:00 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.179]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdHDG3KqKz4x9Pp; Tue, 29 Oct 2024 17:23:58 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 35.D6.08574.E2A11276; Wed, 30 Oct 2024 02:23:58 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241029163228epcas5p1cd9d1df3d8000250d58092ba82faa870~C_YMG540n2488624886epcas5p1x; Tue, 29 Oct 2024 16:32:28 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163228epsmtrp139fca113c34f528ccc23763785f13784~C_YMF-1lz0723107231epsmtrp1z; Tue, 29 Oct 2024 16:32:27 +0000 (GMT) X-AuditID: b6c32a44-6dbff7000000217e-2d-67211a2e9da0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 24.67.08229.B1E01276; Wed, 30 Oct 2024 01:32:27 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163225epsmtip2d329feefdeb3e08ac163b88a9a07b6eb~C_YJpfwvB0998409984epsmtip2b; Tue, 29 Oct 2024 16:32:25 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH v5 07/10] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Date: Tue, 29 Oct 2024 21:53:59 +0530 Message-Id: <20241029162402.21400-8-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xbdRTH97v3cltQzF1B+dEER++y1DFh7SjlstCxRDQ3m1GimyYshl3p TWEtbdMWNsncYJWHQ2ghWxgdk/kkPJSIUMFS0AIr4ADnlMdMBRTsWAEDiNuCoC0tuv8+5/y+ 53x/5/fgorxpnM/NVhtYnZpRkXgIZu3dK4yN4wsUopKKCGp5bR2jLpg3UKq20QqoJpcJpzy9 K4Ca/KYToRqa+hFqqWgEo65WGxGq/59FnKpyjAHKfmcf1WUfxKi6T+c4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Tjd2EiJpTgj0VCLuag4EQDbS0EhJgMAAA== X-CMS-MailID: 20241029163228epcas5p1cd9d1df3d8000250d58092ba82faa870 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163228epcas5p1cd9d1df3d8000250d58092ba82faa870 References: <20241029162402.21400-1-anuj20.g@samsung.com> This patch introduces BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags which indicate how the hardware should check the integrity payload. BIP_CHECK_GUARD/REFTAG are conversion of existing semantics, while BIP_CHECK_APPTAG is a new flag. The driver can now just rely on block layer flags, and doesn't need to know the integrity source. Submitter of PI decides which tags to check. This would also give us a unified interface for user and kernel generated integrity. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch Reviewed-by: Christoph Hellwig --- block/bio-integrity.c | 5 +++++ drivers/nvme/host/core.c | 11 +++-------- include/linux/bio-integrity.h | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index f56d01cec689..3bee43b87001 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -434,6 +434,11 @@ bool bio_integrity_prep(struct bio *bio) if (bi->csum_type == BLK_INTEGRITY_CSUM_IP) bip->bip_flags |= BIP_IP_CHECKSUM; + /* describe what tags to check in payload */ + if (bi->csum_type) + bip->bip_flags |= BIP_CHECK_GUARD; + if (bi->flags & BLK_INTEGRITY_REF_TAG) + bip->bip_flags |= BIP_CHECK_REFTAG; if (bio_integrity_add_page(bio, virt_to_page(buf), len, offset_in_page(buf)) < len) { printk(KERN_ERR "could not attach integrity payload\n"); diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 3de7555a7de7..79bd6b22e88d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1004,18 +1004,13 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, control |= NVME_RW_PRINFO_PRACT; } - switch (ns->head->pi_type) { - case NVME_NS_DPS_PI_TYPE3: + if (bio_integrity_flagged(req->bio, BIP_CHECK_GUARD)) control |= NVME_RW_PRINFO_PRCHK_GUARD; - break; - case NVME_NS_DPS_PI_TYPE1: - case NVME_NS_DPS_PI_TYPE2: - control |= NVME_RW_PRINFO_PRCHK_GUARD | - NVME_RW_PRINFO_PRCHK_REF; + if (bio_integrity_flagged(req->bio, BIP_CHECK_REFTAG)) { + control |= NVME_RW_PRINFO_PRCHK_REF; if (op == nvme_cmd_zone_append) control |= NVME_RW_APPEND_PIREMAP; nvme_set_ref_tag(ns, cmnd, req); - break; } } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index 58ff9988433a..fe2bfe122db2 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -11,6 +11,9 @@ enum bip_flags { BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 6, /* guard check */ + BIP_CHECK_REFTAG = 1 << 7, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 8, /* apptag check */ }; struct bio_integrity_payload { @@ -31,7 +34,8 @@ struct bio_integrity_payload { }; #define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM) + BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ + BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY From patchwork Tue Oct 29 16:24:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855192 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (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 4FA551DD539 for ; Tue, 29 Oct 2024 17:24:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222648; cv=none; b=SqGkOjehG5LiizGW0950zQzO0MKpdxWNEIOMmUK0R2BgjpiAsXUeMAjwKU24xBVmFnyAQsamfCcTuVtiVehwAZafnx18BZl9CZYZEoPBhHErXNER6zjiXaWQRttB4hRRFB98/Br61K9m+AvK9N8BaOV8XQXPDNB65TNWgw1Rv2w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222648; c=relaxed/simple; bh=eiTbYrSDASnf8+i0nVkgeEha1QL2SQUQBBcwJPGXWRs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=o8qqgI093nh1xCcAdD/hqIRBUZgyb8sE3TkN49PVmjbNLETojNfU894dX6MydKxLPTBe0N9OyiM96CBawLZSXatmgEaW5eQtfzeLlYB+v6qCoRuG30Pcanj+SRzt36idmiq7OZU3sMwj0F0qCb3GyLsiWAIVTXCNUzbP00+y2tE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=fQfyaWt5; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="fQfyaWt5" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241029172404epoutp04c996ef98800c048e7604b7effee4a84e~C-FQI2nBz0884608846epoutp04z for ; Tue, 29 Oct 2024 17:24:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241029172404epoutp04c996ef98800c048e7604b7effee4a84e~C-FQI2nBz0884608846epoutp04z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222644; bh=1dbtQAeD0iePlfKD3yxWUWqgeSMIvmMv0CUHvF3cEGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQfyaWt5QR8k3fv5ogj6/an6walPzCAHRoGuXWVeCN0NOEqblHl4eeX0Yz/EnsPyE NWhSGRADdDmFage7kZnEVqngolVSFOgymohhLPWZwDUe6GjmOB7yoSuvOhMs8lUOWq 1awnOui8XMpYGmH+tV3r7ElQCbMchWQ4xJ97cNDc= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241029172403epcas5p3e118afcce8ac877e372e8c257bfd9c69~C-FPN9CyA0894708947epcas5p3s; Tue, 29 Oct 2024 17:24:03 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.177]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XdHDL4R9rz4x9Pp; Tue, 29 Oct 2024 17:24:02 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 9D.7A.18935.23A11276; Wed, 30 Oct 2024 02:24:02 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e~C_YOm1YX-2993629936epcas5p1r; Tue, 29 Oct 2024 16:32:30 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241029163230epsmtrp2df03d4cb640586cc2c056461a4be9506~C_YOjdbyZ1621316213epsmtrp2J; Tue, 29 Oct 2024 16:32:30 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-d9-67211a32078b Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 98.07.08227.E1E01276; Wed, 30 Oct 2024 01:32:30 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163228epsmtip2eb473021666d8b3baa91fd6557a9a56d~C_YMIvhm01387713877epsmtip2F; Tue, 29 Oct 2024 16:32:27 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH v5 08/10] nvme: add support for passing on the application tag Date: Tue, 29 Oct 2024 21:54:00 +0530 Message-Id: <20241029162402.21400-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Tf0xTVxTHc98r/cEoebaYXZsp9S1mKQtIWeleiTg30Lwome26ZRtxgRf6 UgjltesPcW5jBFYMvwTxJ235FRcNJWMOKgEtBAuIVYGpmUwUNgidCyAGcGBG0LW0bP73Oed8 z/3mnHsvFxVMsEXcHMZMGxlKh7PDW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YvSeVq2wNDjB6+PIVPj/0YEA40UNxbKXDA6mFV+8bO2Z+eiQ4ibOwKvdKu9DmYzU F3Gz9H1zyVdiKc5INNRiLipOBAB+d6zPJgMAAA== X-CMS-MailID: 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163230epcas5p18172a7e54687e454e4ecb65840810c4e References: <20241029162402.21400-1-anuj20.g@samsung.com> From: Kanchan Joshi With user integrity buffer, there is a way to specify the app_tag. Set the corresponding protocol specific flags and send the app_tag down. Reviewed-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch --- drivers/nvme/host/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 79bd6b22e88d..3b329e036d33 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -872,6 +872,12 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, return BLK_STS_OK; } +static void nvme_set_app_tag(struct request *req, struct nvme_command *cmnd) +{ + cmnd->rw.lbat = cpu_to_le16(bio_integrity(req->bio)->app_tag); + cmnd->rw.lbatm = cpu_to_le16(0xffff); +} + static void nvme_set_ref_tag(struct nvme_ns *ns, struct nvme_command *cmnd, struct request *req) { @@ -1012,6 +1018,10 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, control |= NVME_RW_APPEND_PIREMAP; nvme_set_ref_tag(ns, cmnd, req); } + if (bio_integrity_flagged(req->bio, BIP_CHECK_APPTAG)) { + control |= NVME_RW_PRINFO_PRCHK_APP; + nvme_set_app_tag(req, cmnd); + } } cmnd->rw.control = cpu_to_le16(control); From patchwork Tue Oct 29 16:24:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855193 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (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 239D9206517 for ; Tue, 29 Oct 2024 17:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222751; cv=none; b=PA6PN2lO/0mHCbtlOZUcbYzQjXaMVNoaAlsXa/iK+7emidoWd8Y128iMS0Vc+y1YW4HZ0s4SV7UrqHuF/Zuri39M4HB13etcQc588AFF5LBAe0xo0xNpwNmrXfuUM+GvYNR9WnlsjqbxEu3kKrF00a5bdHnThf/7v39FLoUrZoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222751; c=relaxed/simple; bh=LnaNhp0NkZ+h1x7hNoh8dcamhZlSIZfnMvMK0uvlcQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=ueGViEBxTPLcXFgRMfJfvQ/GKd2h/P+n/P2zos8owhp0BFFmYP0zL0JXZmv+G3MY+eLExd5kXkDp51OdNtZqmoeyec+gHNopm/zOC4miYN9Sn91jvlEeFcL80GLHUvtjph3bEkwXQL66GogqNRmjm/d2ONqt5eN4EYKAa5jM5WY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=r7ivlmEC; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="r7ivlmEC" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241029172547epoutp03bc0ddd03fda8ef7af97f8c9f041149b4~C-GvxzU4Y0537505375epoutp03D for ; Tue, 29 Oct 2024 17:25:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241029172547epoutp03bc0ddd03fda8ef7af97f8c9f041149b4~C-GvxzU4Y0537505375epoutp03D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222747; bh=8JozZTu1XSCEABsX3TkivbzX6vM8WnvmIwslWwYHbLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7ivlmECaV8wf5QrHiLPI+XMiUlv1fnlU4mGueqZn92jyQhmcCRe240PO3jBlj1Bc vy4Q5EVH1OXMus+/oS1O+ouFM+NmS80Vw5AFLXVPQEICRq2aBQsr0YgEmtiovubdnH jxNNeizemzNBOoj2IgYDTFmDiJ69UDSEMaNjmlJg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241029172546epcas5p3bec90d67d624ce23cd583d1956e0b8ce~C-Gu44GIQ2484924849epcas5p3P; Tue, 29 Oct 2024 17:25:46 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdHGK1qJTz4x9Pq; Tue, 29 Oct 2024 17:25:45 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 00.1A.09420.99A11276; Wed, 30 Oct 2024 02:25:45 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241029163233epcas5p497b3c81dcdf3c691a6f9c461bf0da7ac~C_YQ3_uT52670526705epcas5p4X; Tue, 29 Oct 2024 16:32:33 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241029163233epsmtrp1799296227aa898eaa6db6202340f0d68~C_YQ3LOAg0723107231epsmtrp10; Tue, 29 Oct 2024 16:32:33 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-2a-67211a99c54a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 0D.4B.07371.02E01276; Wed, 30 Oct 2024 01:32:33 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163230epsmtip2b37587e74672e6bf9f7f3d746f1ccbb8~C_YOnT_e90998409984epsmtip2c; Tue, 29 Oct 2024 16:32:30 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Anuj Gupta Subject: [PATCH v5 09/10] scsi: add support for user-meta interface Date: Tue, 29 Oct 2024 21:54:01 +0530 Message-Id: <20241029162402.21400-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJJsWRmVeSWpSXmKPExsWy7bCmhu5MKcV0g6aX7BYfv/5msWia8JfZ Ys6qbYwW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g9IqgtG9MWjP18gx7X11MuSxlU6/3 JmLNu2c/PpbaCrg+m/SBjXOJH7+Z+OnpVmzcj1UfCWzL3LczUtmze2f6x3CRs+4LKjvnHOiV qo84Zc1hoXzlntAb0yCPLUvKSj65WPzN6PgmKa4wac+1WQ5xp3af+ufi7zjrSsmWoJ64Tasu n/z3UomlOCPRUIu5qDgRAM91qNEhAwAA X-CMS-MailID: 20241029163233epcas5p497b3c81dcdf3c691a6f9c461bf0da7ac X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163233epcas5p497b3c81dcdf3c691a6f9c461bf0da7ac References: <20241029162402.21400-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ca4bc0ac76ad..d1a2ae0d4c29 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd, if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM)) scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_GUARD)) scmd->prot_flags |= SCSI_PROT_GUARD_CHECK; } if (dif != T10_PI_TYPE3_PROTECTION) { /* DIX/DIF Type 0, 1, 2 */ scmd->prot_flags |= SCSI_PROT_REF_INCREMENT; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG)) scmd->prot_flags |= SCSI_PROT_REF_CHECK; } From patchwork Tue Oct 29 16:24:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13855194 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (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 883C81FF7C2 for ; Tue, 29 Oct 2024 17:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222759; cv=none; b=urd+I8wdsiucY9dhLz8WAl1K56sqBJMgMrNS/kfKrtWLS9bFpYjnKfbi8f+rXSRUZhM+mS3VjnUzN1GnNKhY+30jWhAhCvmJNiubDtcDNubz5NanZ5qtHYgmWjyhnsz9mqbhybziXErXeUoW5uv5aWM6vo+R+e3/QsWiz/aT7EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730222759; c=relaxed/simple; bh=L7o3ib0+EsbTdZxLS11SB4JXmC4qf7Dn9qpf4MMoYGI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=gh3EHaxq6zWCD/CygE/hHXSvNpkGs86PjrQdwKM+dW6E3HoVddhakBF+qJqjXT6/SJ+GC09V7r4SRV2Iw75D9wiUMPQ9QZn0QKuN3b5ncDH2PMyyi5krSgIdIdZvk4u7qD0WFXDzrxVtsu8VE5/8qTKR0EWX5FDDjAUi1wcdtAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=tXdogbB3; arc=none smtp.client-ip=203.254.224.24 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="tXdogbB3" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241029172554epoutp01e8b7582607c015f40be034fc75b34214~C-G2YtdSl3157231572epoutp01I for ; Tue, 29 Oct 2024 17:25:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241029172554epoutp01e8b7582607c015f40be034fc75b34214~C-G2YtdSl3157231572epoutp01I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730222754; bh=2foZeewvSQYZTb+J5+1KUDb+ESQXlAssFb4T+K85poc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tXdogbB3ZMMdjpH+E9ZGb5NdI34Jk+c6X+R+Uc5r9zHQXYrSh+rUFJbo6ao2OGT3x CAncO8uG2NM934W9vhgt6+uHsqFnfdPMZRAz3eepRGa6iyRl2zK+b/rFImzddc+RLN AAXa6C4UiYq8qM8fahO5aO/XRmkpGonjFQ6fa4RQ= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241029172553epcas5p4be7f2012462fdcf2c5a921c761e36c88~C-G1S8JvQ1348313483epcas5p4d; Tue, 29 Oct 2024 17:25:53 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdHGR4Nnnz4x9Pp; Tue, 29 Oct 2024 17:25:51 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 97.7F.09800.F9A11276; Wed, 30 Oct 2024 02:25:51 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241029163235epcas5p340ce6d131cc7bf220db978a2d4dc24c2~C_YTZ8EHL1013110131epcas5p3j; Tue, 29 Oct 2024 16:32:35 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241029163235epsmtrp22684874ace9623df1e50818911f04cd8~C_YTY_V5G1621316213epsmtrp2K; Tue, 29 Oct 2024 16:32:35 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-a9-67211a9f88a6 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id D0.19.18937.32E01276; Wed, 30 Oct 2024 01:32:35 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241029163233epsmtip23d279260c8fc2654bbb56d837ab74132~C_YQ_LO9c0998409984epsmtip2d; Tue, 29 Oct 2024 16:32:33 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH v5 10/10] block: add support to pass user meta buffer Date: Tue, 29 Oct 2024 21:54:02 +0530 Message-Id: <20241029162402.21400-11-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241029162402.21400-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDJsWRmVeSWpSXmKPExsWy7bCmlu58Kc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fmQdn3fVPmzF2UrFD577ZrCX7cl4ElSkV2v57JHrosc3/e8+eN408+OTTff9+SX3Jb6Zqp92 5MbOuB1e/nEy6wymy4gKV4XubD/sK3bgG1dJ4dPdtWwdXxaorz8tE8ltdW7R3ZzkVbNUJ8Xn a6Xlv8pZe//Yy4zHPfxXGP74ud38bb5dwCiEq0mvwMp8vrztvbMPhDgEL9yf66OZu7hO6M3f 2p28DEosxRmJhlrMRcWJAGAapGAjAwAA X-CMS-MailID: 20241029163235epcas5p340ce6d131cc7bf220db978a2d4dc24c2 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241029163235epcas5p340ce6d131cc7bf220db978a2d4dc24c2 References: <20241029162402.21400-1-anuj20.g@samsung.com> From: Kanchan Joshi If an iocb contains metadata, extract that and prepare the bip. Based on flags specified by the user, set corresponding guard/app/ref tags to be checked in bip. Reviewed-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch --- block/bio-integrity.c | 50 +++++++++++++++++++++++++++++++++++ block/fops.c | 42 ++++++++++++++++++++++------- include/linux/bio-integrity.h | 7 +++++ 3 files changed, 90 insertions(+), 9 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3bee43b87001..5d81ad9a3d20 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -364,6 +364,55 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) return ret; } +static void bio_uio_meta_to_bip(struct bio *bio, struct uio_meta *meta) +{ + struct bio_integrity_payload *bip = bio_integrity(bio); + + if (meta->flags & IO_INTEGRITY_CHK_GUARD) + bip->bip_flags |= BIP_CHECK_GUARD; + if (meta->flags & IO_INTEGRITY_CHK_APPTAG) + bip->bip_flags |= BIP_CHECK_APPTAG; + if (meta->flags & IO_INTEGRITY_CHK_REFTAG) + bip->bip_flags |= BIP_CHECK_REFTAG; + + bip->app_tag = meta->app_tag; +} + +int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta) +{ + struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); + unsigned int integrity_bytes; + int ret; + struct iov_iter it; + + if (!bi) + return -EINVAL; + /* + * original meta iterator can be bigger. + * process integrity info corresponding to current data buffer only. + */ + it = meta->iter; + integrity_bytes = bio_integrity_bytes(bi, bio_sectors(bio)); + if (it.count < integrity_bytes) + return -EINVAL; + + /* should fit into two bytes */ + BUILD_BUG_ON(IO_INTEGRITY_VALID_FLAGS >= (1 << 16)); + + if (meta->flags && (meta->flags & ~IO_INTEGRITY_VALID_FLAGS)) + return -EINVAL; + + it.count = integrity_bytes; + ret = bio_integrity_map_user(bio, &it); + if (!ret) { + bio_uio_meta_to_bip(bio, meta); + bip_set_seed(bio_integrity(bio), meta->seed); + iov_iter_advance(&meta->iter, integrity_bytes); + meta->seed += bio_integrity_intervals(bi, bio_sectors(bio)); + } + return ret; +} + /** * bio_integrity_prep - Prepare bio for integrity I/O * @bio: bio to prepare @@ -564,6 +613,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src, bip->bip_vec = bip_src->bip_vec; bip->bip_iter = bip_src->bip_iter; bip->bip_flags = bip_src->bip_flags & BIP_CLONE_FLAGS; + bip->app_tag = bip_src->app_tag; return 0; } diff --git a/block/fops.c b/block/fops.c index 2d01c9007681..3cf7e15eabbc 100644 --- a/block/fops.c +++ b/block/fops.c @@ -54,6 +54,7 @@ static ssize_t __blkdev_direct_IO_simple(struct kiocb *iocb, struct bio bio; ssize_t ret; + WARN_ON_ONCE(iocb->ki_flags & IOCB_HAS_METADATA); if (nr_pages <= DIO_INLINE_BIO_VECS) vecs = inline_vecs; else { @@ -128,6 +129,9 @@ static void blkdev_bio_end_io(struct bio *bio) if (bio->bi_status && !dio->bio.bi_status) dio->bio.bi_status = bio->bi_status; + if (dio->iocb->ki_flags & IOCB_HAS_METADATA) + bio_integrity_unmap_user(bio); + if (atomic_dec_and_test(&dio->ref)) { if (!(dio->flags & DIO_IS_SYNC)) { struct kiocb *iocb = dio->iocb; @@ -221,14 +225,16 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, * a retry of this from blocking context. */ if (unlikely(iov_iter_count(iter))) { - bio_release_pages(bio, false); - bio_clear_flag(bio, BIO_REFFED); - bio_put(bio); - blk_finish_plug(&plug); - return -EAGAIN; + ret = -EAGAIN; + goto fail; } bio->bi_opf |= REQ_NOWAIT; } + if (!is_sync && (iocb->ki_flags & IOCB_HAS_METADATA)) { + ret = bio_integrity_map_iter(bio, iocb->private); + if (unlikely(ret)) + goto fail; + } if (is_read) { if (dio->flags & DIO_SHOULD_DIRTY) @@ -269,6 +275,12 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, bio_put(&dio->bio); return ret; +fail: + bio_release_pages(bio, false); + bio_clear_flag(bio, BIO_REFFED); + bio_put(bio); + blk_finish_plug(&plug); + return ret; } static void blkdev_bio_end_io_async(struct bio *bio) @@ -286,6 +298,9 @@ static void blkdev_bio_end_io_async(struct bio *bio) ret = blk_status_to_errno(bio->bi_status); } + if (iocb->ki_flags & IOCB_HAS_METADATA) + bio_integrity_unmap_user(bio); + iocb->ki_complete(iocb, ret); if (dio->flags & DIO_SHOULD_DIRTY) { @@ -330,10 +345,8 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, bio_iov_bvec_set(bio, iter); } else { ret = bio_iov_iter_get_pages(bio, iter); - if (unlikely(ret)) { - bio_put(bio); - return ret; - } + if (unlikely(ret)) + goto out_bio_put; } dio->size = bio->bi_iter.bi_size; @@ -346,6 +359,13 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, task_io_account_write(bio->bi_iter.bi_size); } + if (iocb->ki_flags & IOCB_HAS_METADATA) { + ret = bio_integrity_map_iter(bio, iocb->private); + WRITE_ONCE(iocb->private, NULL); + if (unlikely(ret)) + goto out_bio_put; + } + if (iocb->ki_flags & IOCB_ATOMIC) bio->bi_opf |= REQ_ATOMIC; @@ -360,6 +380,10 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, submit_bio(bio); } return -EIOCBQUEUED; + +out_bio_put: + bio_put(bio); + return ret; } static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index fe2bfe122db2..96ec559c24ef 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -24,6 +24,7 @@ struct bio_integrity_payload { unsigned short bip_vcnt; /* # of integrity bio_vecs */ unsigned short bip_max_vcnt; /* integrity bio_vec slots */ unsigned short bip_flags; /* control flags */ + u16 app_tag; /* application tag value */ struct bvec_iter bio_iter; /* for rewinding parent bio */ @@ -80,6 +81,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, gfp_t gfp, int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter); +int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta); void bio_integrity_unmap_user(struct bio *bio); bool bio_integrity_prep(struct bio *bio); void bio_integrity_advance(struct bio *bio, unsigned int bytes_done); @@ -110,6 +112,11 @@ static int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter) return -EINVAL; } +static inline int bio_integrity_map_iter(struct bio *bio, struct uio_meta *meta) +{ + return -EINVAL; +} + static inline void bio_integrity_unmap_user(struct bio *bio) { }