From patchwork Wed Oct 30 18:01:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856992 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 531961C9EBB for ; Wed, 30 Oct 2024 18:10:10 +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=1730311812; cv=none; b=A+DGNGfA2si1zIIFezyvFOEOURXtos0ZaqxEv9U6N4ADG/MDDnRWxAOAmaQKCp6sykyIs+hKqXRyZO7WphJjmYxDYeUahdrZ/TiUV9uOHWjmgXiAMuU9ytETIY0+SnxKlwBTffZegnw2NLBNacaZAGsL68B/hpxejA6TZXZ217c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311812; c=relaxed/simple; bh=+pH+R0JLSo9zCRylUri4bjQjSVlwjajO0NDILV+o0LM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=jiWg0kYC/AdS0KhZGufkC6+BkRpsAagHIpgV4CZglU4Us0fxPn1IJhjp6Jm9MAWxXpN8UKYy0+7FPkaAj8Vc0w56oKU2Ige71jIVTrRhJ+bZiQUc6HfPuVUBRk5M5pbhzWXo1IvDnlhoyRyd5vLq6injo5rLrI0uq8bw//QwzQI= 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=ooQouuMB; 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="ooQouuMB" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241030181003epoutp04e3082d2d10b9031934a00f13a5d204ea~DTWrjnJ433218332183epoutp04e for ; Wed, 30 Oct 2024 18:10:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241030181003epoutp04e3082d2d10b9031934a00f13a5d204ea~DTWrjnJ433218332183epoutp04e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311803; bh=qlGQO+VBfRMV7p/1S/16PyYIBPumquj+mnc3pi8o4zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooQouuMBj/0xC0mlCGqkrg0vM8PrU47GBsMAhDuxAAaK7liGHBH2mfLNJzRyKSdov pXOa7iAIYg9vEMpaaZ/V9kd5uWiCcwDlUzI8b1kKLzmKqtGGyzBv2dugsllDdE6Mr/ 291uqFVh4W4f5CNkhGIEyLO53StGUmCz9+nKJRic= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241030181002epcas5p12c90229c3774a81f82dc1b86c5a0d711~DTWrDg_MC2159521595epcas5p16; Wed, 30 Oct 2024 18:10:02 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.177]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdwBx2RJ6z4x9Pp; Wed, 30 Oct 2024 18:10:01 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id F1.2C.18935.97672276; Thu, 31 Oct 2024 03:10:01 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241030181000epcas5p2bfb47a79f1e796116135f646c6f0ccc7~DTWo1LXbV2064920649epcas5p2m; Wed, 30 Oct 2024 18:10:00 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241030181000epsmtrp1340bdeb7bf891dcb84a3a6709330a72b~DTWo0WDiS0151201512epsmtrp1Y; Wed, 30 Oct 2024 18:10:00 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-9d-67227679628a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 01.69.07371.87672276; Thu, 31 Oct 2024 03:10:00 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030180957epsmtip20e86f2a78cce70206388c78df4a944ad~DTWmeJLbB0686406864epsmtip2K; Wed, 30 Oct 2024 18:09:57 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta Subject: [PATCH v6 01/10] block: define set of integrity flags to be inherited by cloned bip Date: Wed, 30 Oct 2024 23:31:03 +0530 Message-Id: <20241030180112.4635-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAA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dJXJnx0rjzFzXqqf2J9a2Ogb4 PDnt73Lw/lNeV1WhSWH/c6yeBjlMWOVdp/qiqC748P60FMMJmY3p5WH2eaZT2reG/8x7sauo 3eFeovS3iu+6IlXrz7t85BO7/ZLlevbTuSILml9NnnMpIHbK61UNnCUbLeo/RtrVru1jDN2+ /Hkl78MLeyR+KqrOybaxsA8ra/QyybbXSvzJIl/t+mPrAmf14N48xq61VQt+LqqomnfoylyX j053nDyUWIozEg21mIuKEwFfjkWgIgMAAA== X-CMS-MailID: 20241030181000epcas5p2bfb47a79f1e796116135f646c6f0ccc7 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181000epcas5p2bfb47a79f1e796116135f646c6f0ccc7 References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta 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 Wed Oct 30 18:01:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856991 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 D31341C4635 for ; Wed, 30 Oct 2024 18:10:07 +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=1730311810; cv=none; b=bc//IYeluxKzRkywFEFJTr6l1+pTgUTyZu+rIzDH6uwrF2D6RJllajEdhvj4pNnok2OslVD/1JHcv+lo8Cw6rCIWJcYbzkrNTLocRsTzw51KDJHscoxlBUJtm7IyYczsUB8XdNCyuLREMo0y/fV359jgcz0gy+XOAUIm4qp8saI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311810; 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=po574K4xxTZIp6Mgxee9kMQLOBrLbSxtpWRgt6JkjSPnaxj/qyOiFIoh2ZFZvAC+XF/9lROfIplbhOod7CY2wXIQcx3/gRbV5kLBxptn3rDdrHU4iZtZ0TYUDFsap4uAN/+fTbgrve5T/vppYQOLZYvfkpBD7YJJj/DnL66BG2M= 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=B+b75B7Y; 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="B+b75B7Y" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241030181005epoutp03fddf4fbea8f629a4a83bd4eee97f00e5~DTWt9_B_X2983429834epoutp039 for ; Wed, 30 Oct 2024 18:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241030181005epoutp03fddf4fbea8f629a4a83bd4eee97f00e5~DTWt9_B_X2983429834epoutp039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311805; bh=1yEesIXP8hqj3mWCayZYKotAS9KxK7WmVJifezfxMwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+b75B7Y2U7RwWRjYvXr0VrYOUyJT0BWU8vIsl0FOjgKrP4ZSurKNQgONXerI4BDB fM+tL/7MUbQ2FChdnWWsVP4RsYTJ/MAyTq+brtWrjTjNdXwDCsbaKNRaVVJcUR0a4V ctiQiwRAXXXLlkethsI33z4zqiLBJYcKesOUIz40= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241030181005epcas5p2e52c1e3d150255a45c61820871d80dd3~DTWtU-U2T1352813528epcas5p2F; Wed, 30 Oct 2024 18:10:05 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.179]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4XdwBz46l5z4x9Pp; Wed, 30 Oct 2024 18:10:03 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 46.10.09420.B7672276; Thu, 31 Oct 2024 03:10:03 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241030181002epcas5p2b44e244bcd0c49d0a379f0f4fe07dc3f~DTWrP0boz2064320643epcas5p2p; Wed, 30 Oct 2024 18:10:02 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241030181002epsmtrp280269c041b62b74f9eb055f94dba84f1~DTWrPD-KR0895708957epsmtrp2h; Wed, 30 Oct 2024 18:10:02 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-e3-6722767b242c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 54.B8.18937.A7672276; Thu, 31 Oct 2024 03:10:02 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181000epsmtip210691a6ad2b351cf1479df74fe80be57~DTWo54p830487504875epsmtip25; Wed, 30 Oct 2024 18:10:00 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta Subject: [PATCH v6 02/10] block: copy back bounce buffer to user-space correctly in case of split Date: Wed, 30 Oct 2024 23:31:04 +0530 Message-Id: <20241030180112.4635-3-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJJsWRmVeSWpSXmKPExsWy7bCmlm51mVK6wbnnMhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsajO2vZC87xVUzbcpulgXE9TxcjJ4eEgInEtQM3 2bsYuTiEBHYzSnx7fosJwvnEKPF4xkIWOGf7ztWsMC2tG+8wQiR2Mkr8vv+RDSQhJPAZqOp/ UhcjBwebgKbEhcmlIGERgaWMEiuvR4PUMws0MEn03u1lBkkICyRLzLo1ix2knkVAVeLkFbB6 XgFzielzX7FB7JKXmHnpOzuIzSlgIfFhx00WiBpBiZMzn4DZzEA1zVtnM0PUn+GQ6PnsD2G7 SGx5OBUqLizx6vgWdghbSuLzu71Q87MlHjx6wAJh10js2NwH9aO9RMOfG6wgpzEDvbJ+lz7E Kj6J3t9PmEDCEgK8Eh1tQhDVihL3Jj2F6hSXeDhjCZTtIfG5dwE0PLsZJbbOusg0gVF+FpIP ZiH5YBbCtgWMzKsYJVMLinPTU4tNCwzzUsvh0Zqcn7uJEZymtTx3MN598EHvECMTB+MhRgkO ZiURXssgxXQh3pTEyqrUovz4otKc1OJDjKbAEJ7ILCWanA/MFHkl8YYmlgYmZmZmJpbGZoZK 4ryv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SjUw 2apJXTp18v/GaaVGE56lhrQbvi2T6VN4X27F9e2CvuCSxO9TjtR79Sr/FHlXnxTTFp3O9W8H 7zbuKY1utd5SHQYLK2WrvE7apn3pvvdc1fLw4sXtYeqfpnTzXXgSH5getiD6crvpkp0rJs6I vP5JbmLW7+Mal1nmNZ9OqnGVCGnoXCxd2dGyXOBV6O5L7mvM0x2ZGV4rft7xQnBJfpLDG1tV +yX75th5zRBe0eF5J40z8NGit+YcT8KenDb5b/HmuMVKx/gVy79ka54M1vX0nma84cvta4/u 7LigWm8QI5Iglq4hW10ge4ftIr/+jXburO6JH3/G28uvefBUdfGPTp3wM2dfnKivT2I8nPRd iaU4I9FQi7moOBEAo8YKiRsDAAA= X-CMS-MailID: 20241030181002epcas5p2b44e244bcd0c49d0a379f0f4fe07dc3f X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181002epcas5p2b44e244bcd0c49d0a379f0f4fe07dc3f References: <20241030180112.4635-1-joshi.k@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 Wed Oct 30 18:01:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856993 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 5E4E21C3308 for ; Wed, 30 Oct 2024 18:10:10 +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=1730311813; cv=none; b=nmtlFdqq9ncOzo/+vw7PjMnDZ+8W/D1iEz8A748mIiEYM+7DTquMzavA+5rQXL7bA2/XsGuhn2Lyox5KpSwu6xtD0KPPvDUEQn3T/CSwRUguwQ0kgJPRRdXfqk3UMuKxdDr8cdxNUJActC28dnALLDqntQKeJboUOlvz4chkpQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311813; c=relaxed/simple; bh=oVxnfy+l2Dk2dYUOGC+cFgPvC9iJ1gjhIdA6qvU+rm4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=CXmdnf0KPn9+5Dp6gvqAAObGvoMYaQbLv/0yhQqCwmu3kdggc+OIAMoPG2GGTIH2ChSSoUlufPqYw/7CdnrvJ8TY3CbnOUmA1w+jyAks6GCv9nir1nELaaukigxfloxpIfThY6ZPmFBSc+k7RIXAgSAT2CQ6dmeiugoLoSRejbc= 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=k8iA0A3L; 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="k8iA0A3L" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241030181008epoutp037b39dd427ff604b8da93e50c23024179~DTWwVbsoO2895828958epoutp03Q for ; Wed, 30 Oct 2024 18:10:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241030181008epoutp037b39dd427ff604b8da93e50c23024179~DTWwVbsoO2895828958epoutp03Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311808; bh=4844NLpBgRyqsjekSJDaeGrgKQYqhURgJQKrPEO2Wk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8iA0A3LwWW/buMJLn9M9lIPNFdQKlSQe3QwP2u5NuyQqrvI9lFcwFoHLV/Y3Ku6n 6Sc0jWhPhmlS0S5f/IxtExUzY18a6ixyNimHgRBZvcm4ve2JSoW6mw/8TFWCusHFEc 9vkkntn0tiDD3HJievlD3Ar2ENptuUrmZIBfudvw= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241030181007epcas5p1b05f34e88b7a2a5d8b7afd7faa795f9d~DTWvz7_E21837718377epcas5p19; Wed, 30 Oct 2024 18:10:07 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdwC21K62z4x9Pr; Wed, 30 Oct 2024 18:10:06 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.10.09420.E7672276; Thu, 31 Oct 2024 03:10:06 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20241030181005epcas5p43b40adb5af1029c9ffaecde317bf1c5d~DTWt1c6zh0638906389epcas5p4z; Wed, 30 Oct 2024 18:10:05 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241030181005epsmtrp257d2df1a049654f1f5b7a212d65968ba~DTWt0gxw_1079210792epsmtrp2D; Wed, 30 Oct 2024 18:10:05 +0000 (GMT) X-AuditID: b6c32a49-33dfa700000024cc-e8-6722767e8a1c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AF.B6.08227.D7672276; Thu, 31 Oct 2024 03:10:05 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181003epsmtip2551cf31ab80c506859e5f51aa38f5c1e~DTWrT_WMg0487504875epsmtip26; Wed, 30 Oct 2024 18:10:02 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi Subject: [PATCH v6 03/10] block: modify bio_integrity_map_user to accept iov_iter as argument Date: Wed, 30 Oct 2024 23:31:05 +0530 Message-Id: <20241030180112.4635-4-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDJsWRmVeSWpSXmKPExsWy7bCmlm5dmVK6wZynrBYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyMy5vOMNc8Fyu4uAvmwbGW5JdjJwcEgIm Ev8/fWXuYuTiEBLYzSgxf+V6NpCEkMAnRonJp5MhEt8YJd5/eAZUxQHWcW13MkTNXkaJ00ci IWo+M0qsPL+IEaSGTUBT4sLkUpAaEYGlQPHr0SA1zALLmSTerZ/CCJIQFoiXWLjiBtgyFgFV ic43vSwgNq+AucSZ84+ZIa6Tl5h56Ts7iM0pYCHxYcdNqBpBiZMzn4DZzEA1zVtng30g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AkUF5dovvaDHcIWllj57zk7RNFH Rol5K3czgjSzCWhKXJhcChIXEVjPKHF27wQWEIdZYCOTxJSN58AmCQvESkx/18sEYrMIqEp0 vullAbF5Bcwlzpx/zAyxQV5i5qXvYNs4BSwkPuy4CVYjBFRzfeEZdoh6QYmTM5+AxZmB6pu3 zmaewCgwC0lqFpLUAkamVYySqQXFuem5xYYFRnmp5XrFibnFpXnpesn5uZsYwfGmpbWDcc+q D3qHGJk4GA8xSnAwK4nwWgYppgvxpiRWVqUW5ccXleakFh9ilOZgURLn/fa6N0VIID2xJDU7 NbUgtQgmy8TBKdXANJuD6cimOMP4lxNsi2tC44p2mq3mZorUKM571pD+yIGH4dmlztL9S0+H nQ85seeF/Ly572d4vmNb/JtfRSct+/YBvW/LLB/Pml+4c4f2mbfyC3bqiake6XTPi9dRbD8+ 0SBAiTkmkuu7zbO80wJbnVWbIvZ8sj92fjZzzKG8vOsrZgnvV4xLjdbeeeGaQ/38HvZnvN9i td4cD9/y4Jm7mOnsVwcPr74lxRTCVLp3Brea/H6m2PKKcvXf7HvqGGfLXJxSnSx9O4HtfqlK i1DQHs+M5/1dszlnp7gJ3N3S4LRH0kKxJGvpNiOJfp7rBS/CJ2y9vMdpgcXDWZInGN8WlRd4 meXJNXZF2fc0LFFQYinOSDTUYi4qTgQAChGJXyYDAAA= X-CMS-MailID: 20241030181005epcas5p43b40adb5af1029c9ffaecde317bf1c5d X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181005epcas5p43b40adb5af1029c9ffaecde317bf1c5d References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta 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 Wed Oct 30 18:01:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856994 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 1D60D1CCB4A for ; Wed, 30 Oct 2024 18:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311816; cv=none; b=QqXZcGLryV6elV5ptzQ6Fwsoz6Aq2BKZL3ilu/MWL7yff5yIiQzbulS1ExOSs+TB7RycHOjIJjD7hjriUO6u25jZEsxv2ARALlrisKpNMKRdCMrHBbkWbXbTWMw8OOKt4OInBNz33qqtQUt/QQW6u82MQlTgzrHu23+oG1sMo3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311816; c=relaxed/simple; bh=hG8FiFxjxXyHm56h0ScdIRfLd6/tK9OnEVj8jZ9gfhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=TyIgXedqGB4qaaPaO48IZewsbS12/MJ8NQ7/RIbJJ4B5Qzdwxg13Ntp+NMg4gLZZVP5hfX6USF07dhEa0sWo3H8ZKPCYzwuMUgqIypoWKDk3O3/eGEvaqQRleoKJtmEJtEnuh4ogmRK1p4lEa1zxUEipiC1wNfIStG+D9hQlmqU= 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=c0a6J53k; arc=none smtp.client-ip=203.254.224.25 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="c0a6J53k" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241030181010epoutp02cf78149d930e14689cd0c1f7c84d8be3~DTWyrAkda2034620346epoutp02W for ; Wed, 30 Oct 2024 18:10:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241030181010epoutp02cf78149d930e14689cd0c1f7c84d8be3~DTWyrAkda2034620346epoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311811; bh=FoqnIJwb0Z3BnzujRfjpSNb42rOvps9u7WH0JkZKm6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0a6J53kQrvpkw4H3N36rP6hx2PHTDRbkQbDWb8ahLiNn6psOcWc1KKHK/HDzBgwg BlVlu/Mxx8Zf+52Kk40DP16UMI0u4yI6BHJM71Wc6w32mX2SLqikE7a2a07MyZwm6O kySpznkTwkvUj6TUNFxSkUAT3E8lSJ1hV6qTyG5A= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241030181010epcas5p4abd6dbdfe08bded4bc46cd5a8c29a441~DTWx4z0jp0638906389epcas5p49; Wed, 30 Oct 2024 18:10:10 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.176]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdwC46dSXz4x9Pq; Wed, 30 Oct 2024 18:10:08 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 07.ED.08574.08672276; Thu, 31 Oct 2024 03:10:08 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241030181008epcas5p333603fdbf3afb60947d3fc51138d11bf~DTWwVJnWa1475114751epcas5p3f; Wed, 30 Oct 2024 18:10:08 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241030181008epsmtrp2606d4ffa7080df4891ded85dec9cad92~DTWwP4H8P1079210792epsmtrp2G; Wed, 30 Oct 2024 18:10:08 +0000 (GMT) X-AuditID: b6c32a44-93ffa7000000217e-e9-67227680801c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AB.78.08229.08672276; Thu, 31 Oct 2024 03:10:08 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181005epsmtip267b17ad271ee69c5084ac7f152967aaf~DTWt2IfN90238402384epsmtip2p; Wed, 30 Oct 2024 18:10:05 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi Subject: [PATCH v6 04/10] fs, iov_iter: define meta io descriptor Date: Wed, 30 Oct 2024 23:31:06 +0530 Message-Id: <20241030180112.4635-5-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLJsWRmVeSWpSXmKPExsWy7bCmhm5DmVK6wbmF+hYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0Mj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s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUVw2Kak5mWWpRfp2CVwZOw+sYy24xFvx as1vpgbG6dxdjJwcEgImEjM+PWDrYuTiEBLYzSix4MM7NoiEuETztR/sELawxMp/z8FsIYGP jBIPPnl1MXJwsAloSlyYXArSKyKwnlHi7N4JLCAOs8BGJokpG88xghQJCzhKfDqvD9LLIqAq 0fPvMAuIzStgLnH/4WwmiPnyEjMvfQebzylgIfFhx00WiF3mEtcXnmGHqBeUODnzCVicGai+ eets5gmMArOQpGYhSS1gZFrFKJlaUJybnltsWGCYl1quV5yYW1yal66XnJ+7iREcb1qaOxi3 r/qgd4iRiYPxEKMEB7OSCK9lkGK6EG9KYmVValF+fFFpTmrxIUZpDhYlcV7xF70pQgLpiSWp 2ampBalFMFkmDk6pBqajO/kY6lWvq+zc2Vbtwsg8J9qxOKeCc/WbpGkPHPXvtPR/qr8UJm6b ui/ZzmsrE8/HVaWS2xY8+y7SOr3orYpm6I7nrxd2P9C8yq5nsFtfciqnzanpjzbITWOq3Ldn 3uG8MvNpn6OPMlkzJBS9eS50ielPp5Sp39Sv9//NmRYVHZ+fLbrcdTH380y5aJMXZjv2Hlrt spRBMW3upimc2gHcxf613YuFrv20Ppv0s+ysyZ42g01+d/ZfupXePbe/JGH9rn2v2WMN7MJ2 JU9aV+YqoitxxnPqeavLNX8lO48y/M1lW3VnTvNW5sz0+SIRz+1nrnL69PfHlb/bXi1UrH3/ ZJd/jPKhh9wbJa5du/NOiaU4I9FQi7moOBEAYQnKiyYDAAA= X-CMS-MailID: 20241030181008epcas5p333603fdbf3afb60947d3fc51138d11bf X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181008epcas5p333603fdbf3afb60947d3fc51138d11bf References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta 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 Reviewed-by: Christoph Hellwig --- include/linux/uio.h | 9 +++++++++ include/uapi/linux/fs.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 853f9de5aa05..8ada84e85447 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -82,6 +82,15 @@ struct iov_iter { }; }; +typedef __u16 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: 13856996 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 2C8661CF5F6 for ; Wed, 30 Oct 2024 18:10:20 +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=1730311822; cv=none; b=gpdOSuKJrZcTtKtWUXP0k1mT7Nnt3BTbMoz6PItzCZSJFNjptUdR5O2v3KPRks5gNP+YF1Lxuj4Tp/WPe3+UUGIMgC6Avmh9BRXm6h2V5DB9yj7w8fDP6ygqrn/qNbKDaZGgZ0REq7Fxs6iIK+kN3tjf18zj5gaEf0jZWEstthQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311822; c=relaxed/simple; bh=+Hl8/FkKAij0Fs7hEyhj8RCHLWnzeYSlHRk6+aYEOkA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=kZAYl5io+GAiDd4iM11FXWuG3d03Rd5oZcS6khgS91HOnI7n/otVNdl0QRwih/Q8MZ6Af2qluFS/OSpFfYWjkhZbWYHhd/U1YKfntRRAQnn2ws7sMgwaBQqxZkNOkYwaH65TffbqNWOxlfISqLqkCKuOSF4HpqbNapuIyaVnfaw= 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=KXRiKmVu; 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="KXRiKmVu" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241030181013epoutp019d1e2da3123a98341feba7205ba24b23~DTW0y-yyu2632026320epoutp01P for ; Wed, 30 Oct 2024 18:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241030181013epoutp019d1e2da3123a98341feba7205ba24b23~DTW0y-yyu2632026320epoutp01P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311813; bh=+pFos/OWvKOhSOsUibfKD4fjufgTGmZIusPrIWBykfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KXRiKmVuVtFbRGRbgRfhuXwvPhl1lQOb+DcOSZnUHlERlXLhaKM6931rb0lDM07c5 1FPAcEq/MhPphvP1/i6qjQPwRHwbnOx8eWe0uTYvN0BbODhGuUNP4VfrQikxGOtGVF iWgQ631duDoGmktFmh2pjEOPxvWWi4hLKUiIyI6k= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241030181012epcas5p2c9f727ddd4cd0152825e35069b4bc259~DTW0GPB2m1352913529epcas5p28; Wed, 30 Oct 2024 18:10:12 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.177]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdwC73HMxz4x9Pq; Wed, 30 Oct 2024 18:10:11 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 56.2C.18935.38672276; Thu, 31 Oct 2024 03:10:11 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241030181010epcas5p2c399ecea97ed6d0e5fb228b5d15c2089~DTWyrqkP32064920649epcas5p29; Wed, 30 Oct 2024 18:10:10 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241030181010epsmtrp144594a938e5a3b5dc907e3cd9e711d0b~DTWyq15Oh0197101971epsmtrp1Y; Wed, 30 Oct 2024 18:10:10 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-ad-6722768310b0 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 81.C6.08227.28672276; Thu, 31 Oct 2024 03:10:10 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181008epsmtip2041cf624a73380ec5b48a3723e1f1247~DTWwXwSCT0430604306epsmtip26; Wed, 30 Oct 2024 18:10:08 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta Subject: [PATCH v6 05/10] fs: introduce IOCB_HAS_METADATA for metadata Date: Wed, 30 Oct 2024 23:31:07 +0530 Message-Id: <20241030180112.4635-6-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNJsWRmVeSWpSXmKPExsWy7bCmpm5zmVK6wZsTQhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsal123sBf9ZKz7M7GFpYPzF0sXIySEhYCIxuXEF UxcjF4eQwB5Gic67l1khnE+MEr2z70BlvjFKPO96yN7FyAHWcvBwOER8L6PEsxlvGSGcz4wS b4/0M4MUsQloSlyYXAqyQkR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ZxehxZsERdo/Pm+Q8Nj15yxTAFcVlk5Kak1mWWqRvl8CVcel1G3vBf9aKDzN7WBoY f7F0MXJwSAiYSBw8HN7FyMUhJLCbUWLKon6mLkZOoLi4RPO1H+wQtrDEyn/P2SGKPjJKnPvz iBWkmU1AU+LC5FKQuIjAekaJs3snsIA0MAt0MUlc3sANYgsLuEl86+5mA7FZBFQlOv79ZgTp 5RUwl1i6VApivrzEzEvfwXZxClhIfNhxE2yMEFDJ9YVnwOK8AoISJ2c+gRovL9G8dTbzBEaB WUhSs5CkFjAyrWKUTC0ozk3PLTYsMMpLLdcrTswtLs1L10vOz93ECI4xLa0djHtWfdA7xMjE wXiIUYKDWUmE1zJIMV2INyWxsiq1KD++qDQntfgQozQHi5I477fXvSlCAumJJanZqakFqUUw WSYOTqkGpkBr576Kxlg316JFMtO+aBziWLFVPUJYatnZs3Ni7732W7VO1kn3d8ZeibKyJPsJ s3dOfGL396XfoxZvpqDJb4P7L97d8TU94N626b4mHUyXjkacOXogZ+4T1/Ye03q5aMcXOhEX H+3znHrqbHPQa+kfz+pXBPheubv6+YlHaSofPr+axHmxcH3p6Xj366c+pUWdqWwpq0hY8EfV iffCSwbLrVqfnop0/vTTzJwubMLtP3un4T+J5Z9nbfJJnXph+rIdYcZTeN4GaaqrdJV9Dw+t ejzF6sNRNRlPU3OWP+E/M8uUbXV63n4qtMne9ojxZKN6y297j/NqLvJ7t1Ut8/mwfe/Bk8lL uVfbfH47r0CJpTgj0VCLuag4EQBLblizIAMAAA== X-CMS-MailID: 20241030181010epcas5p2c399ecea97ed6d0e5fb228b5d15c2089 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181010epcas5p2c399ecea97ed6d0e5fb228b5d15c2089 References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta 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 Wed Oct 30 18:01:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856995 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 C4FCC1CF7B6 for ; Wed, 30 Oct 2024 18:10:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311820; cv=none; b=ULw0z9duO7tyymB9N0RCYDTguYS8pprric6rIcguman3zeindlFehcL9NKzlw+RyuBGUIJNqk4fuxTSdQoYf0YQsVnh7OkQV14ANjtm3Z+U2FxpvBj91l+lLeW87+lpMb1eoTN0FTbqglMd4n60m9ZRCymvDtF5+gSsZnTg+BoU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311820; c=relaxed/simple; bh=h61XHxtGBrHbySmSN02hKHgmG5g4G7WHzdsPAzbYfm8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=LUvHdZHrEF0ux+2RT87ycfIpy8BWnJ5MtT2F5i7bwfNwp41yRa48JEIAqApyoqP9CTkECZnnJy5ea2JLvxrkWNT2vPEoQSpFPCoyrHxtOvKxs7Y9tL0jZoGfQPyq5zndbxsp5VpG5+UL8ABxeQKGv3uuGiwXH44nDAHo4tHmt+4= 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=D4Za6GJp; arc=none smtp.client-ip=203.254.224.25 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="D4Za6GJp" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241030181016epoutp02a4d528c7b399206d5c727a9a3375245d~DTW3dt4kH2034820348epoutp02V for ; Wed, 30 Oct 2024 18:10:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241030181016epoutp02a4d528c7b399206d5c727a9a3375245d~DTW3dt4kH2034820348epoutp02V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311816; bh=5dd6k7v+UY0om6PeVSUR7s0B1t3uJAXmfinngCFpk1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4Za6GJpWfyf4nCcwWCbr5+X9LhoM1ZMxeMRXxPlgxoDOHzSpIHkNzTQjj5EIiZqj iA6z+PhqzXdChhXnnWrns07OSoxqSwwSZ7462se6a7o+bDvzyETn7kZkZxPUcGUkLU UkKcN+kusNri58GnLZNpWU0jk1rYLusWqxwJN+4k= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241030181015epcas5p2794e489d89aa91e8f2874c02a9fe9736~DTW2wncmu2064320643epcas5p2D; Wed, 30 Oct 2024 18:10:15 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.178]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdwCB1Dn5z4x9Pt; Wed, 30 Oct 2024 18:10:14 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.84.09800.68672276; Thu, 31 Oct 2024 03:10:14 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241030181013epcas5p2762403c83e29c81ec34b2a7755154245~DTW1PNGss2977629776epcas5p2B; Wed, 30 Oct 2024 18:10:13 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241030181013epsmtrp214ca5e4a527ae130fe7e2b15a6fc637e~DTW1N4vn81079110791epsmtrp2K; Wed, 30 Oct 2024 18:10:13 +0000 (GMT) X-AuditID: b6c32a4b-23fff70000002648-b8-67227686650c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 28.69.07371.58672276; Thu, 31 Oct 2024 03:10:13 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181011epsmtip223d455f1a907e45b745108614a8aeb73~DTWywP6is0686406864epsmtip2i; Wed, 30 Oct 2024 18:10:10 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi Subject: [PATCH v6 06/10] io_uring/rw: add support to send metadata along with read/write Date: Wed, 30 Oct 2024 23:31:08 +0530 Message-Id: <20241030180112.4635-7-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrAJsWRmVeSWpSXmKPExsWy7bCmhm5bmVK6wZVlrBYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJouj/9+yWUw6dI3RYu8tbYs9 e0+yWMxf9pTdovv6DjaL5cf/MVmc/3uc1eL8rDnsDkIeO2fdZfe4fLbUY9OqTjaPzUvqPXbf bGDz+Pj0FotH35ZVjB5nFhxh9/i8Sc5j05O3TAFcUdk2GamJKalFCql5yfkpmXnptkrewfHO 8aZmBoa6hpYW5koKeYm5qbZKLj4Bum6ZOUA/KSmUJeaUAoUCEouLlfTtbIryS0tSFTLyi0ts lVILUnIKTAr0ihNzi0vz0vXyUkusDA0MjEyBChOyM/53nWUvaLWqmNj8ma2BsUu/i5GTQ0LA RGJ63x32LkYuDiGB3YwSezbfYYNwPjFKrNozgRXC+cYocbb7BQtMy8yH0xghEnsZJY5+mgDV /5lR4sXXJ0AtHBxsApoSFyaXgjSICCxllFh5PRqkhllgOZPEu/VTGEESwgLREj0LtoFNZRFQ ldg3ewcziM0rYC6x5MxVRoht8hIzL31nB7E5BSwkPuy4yQJRIyhxcuYTMJsZqKZ562xmiPo7 HBKH9qVA2C4S6760Ql0tLPHq+BZ2CFtK4vO7vWwQdrbEg0cPoGpqJHZs7mOFsO0lGv7cAPuF GeiX9bv0IVbxSfT+fsIEEpYQ4JXoaBOCqFaUuDfpKVSnuMTDGUugbA+JLW93QMOqGxg8G9pZ JjDKz0L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qub7wDDtEvaDEyZlPwOLMQPXN W2czT2AUmIUkNQtJagEj0ypGydSC4tz03GTDAsO81HK94sTc4tK8dL3k/NxNjOCY09LYwXhv /j+9Q4xMHIyHGCU4mJVEeC2DFNOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8xrOmJ0iJJCeWJKa nZpakFoEk2Xi4JRqYEp4f3Plbunbpxs9mr0Pnu/z7uT607BkV4n3bjbZsnkN/hwX2+2aaqVy 003TtiQLh/NK886L+RO4PLo2sVNU2d3saYnOL2tn+YUpm0/FSZ389CTSgOVH7lHWdq4wc52z c4+5ZFawO99c8mda3dXeL1lBDp0xui+OHXr6hvGZwqOC/jjBZuOemoprB/d9O1AkI/lc0U78 qOnxXwuXhQWsOvCzXYvZ7RlfzepJKdbSflazNWdmuvmUMYhxBN9x4hHZ/eTKXDvd3zMN3B+d jLF2WHVnMU+91ul3yUUnvtftzFpy1+3+7+kPslOd+Zd/Ed3/85fIIvv2lTpnbXd9vXK59Lpt n7zAt6DvQcU/vNa9VmIpzkg01GIuKk4EAFI9WC8oAwAA X-CMS-MailID: 20241030181013epcas5p2762403c83e29c81ec34b2a7755154245 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181013epcas5p2762403c83e29c81ec34b2a7755154245 References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta This patch adds the capability of passing integrity metadata along with read/write. Introduce a new 'struct io_uring_meta_pi' that contains following: - pi_flags: integrity check flags namely IO_INTEGRITY_CHK_{GUARD/APPTAG/REFTAG} - len: length of the pi/metadata buffer - buf: address of the metadata buffer - seed: seed value for reftag remapping - app_tag: application defined 16b value Application sets up a SQE128 ring, prepares io_uring_meta_pi within the second SQE. The patch processes this 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 Reviewed-by: Christoph Hellwig --- include/uapi/linux/io_uring.h | 16 ++++++++ io_uring/io_uring.c | 4 ++ io_uring/rw.c | 71 ++++++++++++++++++++++++++++++++++- io_uring/rw.h | 14 ++++++- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 024745283783..48dcca125db3 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -105,6 +105,22 @@ 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]; +}; + +/* this is placed in SQE128 */ +struct io_uring_meta_pi { + __u16 pi_flags; + __u16 app_tag; + __u32 len; + __u64 addr; + __u64 seed; + __u64 rsvd[2]; }; /* diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 44a772013c09..c5fd74e42c04 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3879,6 +3879,7 @@ static int __init io_uring_init(void) 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 +3903,9 @@ 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)); + io_uring_optable_init(); /* diff --git a/io_uring/rw.c b/io_uring/rw.c index 30448f343c7f..cbb74fcfd0d1 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -257,6 +257,46 @@ 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) +{ + 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(md->rsvd[0]) || READ_ONCE(md->rsvd[1])) + 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) { @@ -279,11 +319,19 @@ 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; + + if (req->ctx->flags & IORING_SETUP_SQE128) + ret = io_prep_rw_meta(req, sqe, rw, ddir); + return ret; } int io_prep_read(struct io_kiocb *req, const struct io_uring_sqe *sqe) @@ -409,7 +457,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); } @@ -794,7 +845,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; @@ -823,6 +874,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; } @@ -897,6 +960,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 { /* @@ -1101,6 +1166,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 Wed Oct 30 18:01:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856998 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 33D9C1D0DC0 for ; Wed, 30 Oct 2024 18:10:24 +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=1730311826; cv=none; b=KSsAbev90MRl/xIhfEFiYmo7Mr0WyeybU20qtouK55SSJoefC9TXG+g+t8fJRmm4oQKi6QTqXnPFmQQpVpVdtfNdzwZqaDXi8LIgiMKQxTEAk3uIU5jnXkgVSaovkZuz6A9ZqzjQ90B5jWQ8qmQEHOQJOlkInjOFRqqEhVujogQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311826; c=relaxed/simple; bh=YXb7qnO3lu5vkwg1bZcdx5PFo4CJX/dp1xu0WKlJFxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=b/0W9JZRJ9rRTwTi7l53EHGbiJHL5bvGUMwFbaINhbaNyDvUEnpXIsIRRC0rbm0n3GytNB/dK5gCQPLUL6CuiaDEj5qg+HaiAO4b1t5c2L2NMTM7nwU6El2dSKayhY6gQGpHmuVqNytS0yjlMZ6JyPrdh7UUdad+MLWIYJ4qdlY= 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=PExMpOWM; 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="PExMpOWM" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20241030181019epoutp0405c9be8a8d025c192c02e0b15a2cc389~DTW6QHYaT0208902089epoutp04o for ; Wed, 30 Oct 2024 18:10:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20241030181019epoutp0405c9be8a8d025c192c02e0b15a2cc389~DTW6QHYaT0208902089epoutp04o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311819; bh=1mlKPMPKFIJBhlmH3o5xGb/9qatIJGaThyCajlxzjfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PExMpOWMWYHvT5UCN3TUMoRTmBIducyLf+QJvlxHgsTIwTOi2NjgE0ceO4GWa6lup j/tzE8ID/bYQD5vuEHQFFeflLHmseE8dNG/0++tEiQhFIKJIATcEGo6z7v9MMZPRid jvJTKBWLfGUWGgSBCEyOhHpufEvWjK95EDYfSDkE= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20241030181018epcas5p147bd46c689df9a0893db55d290631dc6~DTW5uEoup1452514525epcas5p1G; Wed, 30 Oct 2024 18:10:18 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XdwCD695wz4x9Pt; Wed, 30 Oct 2024 18:10:16 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id B7.2C.18935.88672276; Thu, 31 Oct 2024 03:10:16 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241030181016epcas5p3da284aa997e81d9855207584ab4bace3~DTW3ybWDS3027830278epcas5p3D; Wed, 30 Oct 2024 18:10:16 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241030181016epsmtrp141d51540d875f3db54687f7596e4f268~DTW3xl6V00151201512epsmtrp1-; Wed, 30 Oct 2024 18:10:16 +0000 (GMT) X-AuditID: b6c32a50-cb1f8700000049f7-b5-6722768892c4 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A2.C6.08227.88672276; Thu, 31 Oct 2024 03:10:16 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181013epsmtip267fc962ebcf5efff16e5a37bbf763948~DTW1USSch0238402384epsmtip2q; Wed, 30 Oct 2024 18:10:13 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi Subject: [PATCH v6 07/10] block: introduce BIP_CHECK_GUARD/REFTAG/APPTAG bip_flags Date: Wed, 30 Oct 2024 23:31:09 +0530 Message-Id: <20241030180112.4635-8-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHJsWRmVeSWpSXmKPExsWy7bCmlm5HmVK6Qd8ZPYuPX3+zWDRN+Mts MWfVNkaL1Xf72SxeH/7EaHHzwE4mi5WrjzJZvGs9x2Ixe3ozk8XR/2/ZLCYdusZosfeWtsWe vSdZLOYve8pu0X19B5vF8uP/mCzO/z3OanF+1hx2ByGPnbPusntcPlvqsWlVJ5vH5iX1Hrtv NrB5fHx6i8Wjb8sqRo8zC46we3zeJOex6clbpgCuqGybjNTElNQihdS85PyUzLx0WyXv4Hjn eFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKCflBTKEnNKgUIBicXFSvp2NkX5pSWpChn5xSW2 SqkFKTkFJgV6xYm5xaV56Xp5qSVWhgYGRqZAhQnZGffer2AqmChVce78ZbYGxtOiXYycHBIC JhInNlxj72Lk4hAS2MMoce7XbTaQhJDAJ0aJO490IBLfGCUart1j7WLkAOu4OCsaIr6XUaJx /n9WCOczo8T2ya3sIEVsApoSFyaXggwSEVjKKLHyOlgDs8ByJol366cwgiSEBUIk/rXcYgGx WQRUJW6evcIC0ssrYC5xeachxHXyEjMvfWcHsTkFLCQ+7LgJVs4rIChxcuYTMJsZqKZ562xm kPkSAg84JBZP38YM0ewi8frkZEYIW1ji1fEt7BC2lMTL/jYoO1viwaMHLBB2jcSOzX2sELa9 RMOfG2APMwP9sn6XPsQuPone30+YIOHAK9HRJgRRrShxb9JTqE5xiYczlkCDykOi/UYoJHS6 GSXmbv3NPIFRfhaSD2Yh+WAWwrIFjMyrGKVSC4pz01OTTQsMdfNSy+HRmpyfu4kRnLC1AnYw rt7wV+8QIxMH4yFGCQ5mJRFeyyDFdC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B uGfVB71DjEwcjIcYJTiYlUR4LYMU04V4UxIrq1KL8uOLSnNSiw8xSnOwKInzfnvdmyIkkJ5Y kpqdmlqQWgSTZeLglGpgciqbE7Uycknay4OmrBIBqZnyD9/4RR3w23hzquTyEnHONi0dO5O3 HhLn6hpYbk6/29Ln/7B8pemKc4b7HC3Px8WGTcvlzqwqmvZR92qkOVugxuzi3JVbBVq0Zroy 2FWbb9cM+rbW04b5SuWCe592Wlopnuq/Juy29aarslydIMvO57a1pSaru/fwRcl7mMw+3/BM 7G7k7TCxJ5INO0+muK1f9P/ti7ZrP59XF71dae5RVrHzc+S9d1s8XrGU+C0Q2O+iYzkvIeXb Skmu2IXaKz7rip171X1E4c0F6xcxHivXnCxWqm2ZF9EnZ9ono3zRpKV32XFT6Q/T36r9XpH2 aP/2s8/WC276dHV209oNSizFGYmGWsxFxYkAFlkzZSYDAAA= X-CMS-MailID: 20241030181016epcas5p3da284aa997e81d9855207584ab4bace3 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181016epcas5p3da284aa997e81d9855207584ab4bace3 References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta 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: Christoph Hellwig Reviewed-by: Keith Busch --- 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 Wed Oct 30 18:01:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856997 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 759CB1CBE92 for ; Wed, 30 Oct 2024 18:10:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311825; cv=none; b=f2bMSPJ0bSCAGlJYXo02xf6EA9axDyzebFe8P/pgFgROIH03+JRGn3sokC8tKoCk69AFXklG2V4CSetL7/HU80ydFE1dOLlcQyubWM3zr9n8V8y7Z7yVyjDm6rvw40l+sU7RPOpSl+q63txCCYlYT0fvPllWcKMCCcQeHyRiinI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311825; c=relaxed/simple; bh=8jIRO6c2zH9FenFN6dJIwf6/40j3vDnIZ8qwXmiThLo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=hecvsvL4yeMGkavn6iRZkQhRHU2bS+joI23TG4xEHWUnntbLlBBvTygHOFXABCRM6xdg/Ai2r9Nco6O89XXgPB4CFFxgJ1T0h445bxtmWJtVHKE5EKCLIn8CWhcxcndACIRdMknU2L2sNRF+ycuy3fiFcpgBQFa5UmFcsW8A3u8= 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=QQOQqZpA; arc=none smtp.client-ip=203.254.224.25 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="QQOQqZpA" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241030181021epoutp02730fd647d216785aef90275158a3ee5c~DTW848Z2D2034620346epoutp02c for ; Wed, 30 Oct 2024 18:10:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241030181021epoutp02730fd647d216785aef90275158a3ee5c~DTW848Z2D2034620346epoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311821; bh=3zdls5Iu7dt/fb3DAkxYZFdYirBlPjLOr6/nLEkVVNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QQOQqZpAsw8XkZFO3ZKtXFpgnje5np99WrU+/QDPyDq/vJjAO7adP4vMeFOSaf85F BLs5WoUV9ETKSeYxvhxsw4T1ZTpa9PdWwTBzTsDavCcadC6w8QZQvTVEIrGovrImc2 QJrAtzQ5l2yrkZWms9Q6MrtfDy4nbHUMyPT4liLI= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241030181021epcas5p4cea036251f5b3d3acdf1eeabcff49d67~DTW8U-awJ1337513375epcas5p4S; Wed, 30 Oct 2024 18:10:21 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.181]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdwCJ1StGz4x9Pq; Wed, 30 Oct 2024 18:10:20 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4A.10.09420.C8672276; Thu, 31 Oct 2024 03:10:20 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241030181019epcas5p135961d721959d80f1f60bd4790ed52cf~DTW6QmZX-0989809898epcas5p1c; Wed, 30 Oct 2024 18:10:19 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241030181019epsmtrp2c438cc97667ed37f2776ae04c2d1308c~DTW6Pw6Y41079210792epsmtrp2K; Wed, 30 Oct 2024 18:10:19 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-f9-6722768c816e Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.78.08229.A8672276; Thu, 31 Oct 2024 03:10:18 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181016epsmtip2c10f0e1bb68f28d52711b13fe48bccae~DTW32YEvM0487504875epsmtip2_; Wed, 30 Oct 2024 18:10:16 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Kanchan Joshi , Anuj Gupta Subject: [PATCH v6 08/10] nvme: add support for passing on the application tag Date: Wed, 30 Oct 2024 23:31:10 +0530 Message-Id: <20241030180112.4635-9-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrIJsWRmVeSWpSXmKPExsWy7bCmum5PmVK6QV8Hu8XHr79ZLJom/GW2 mLNqG6PF6rv9bBavD39itLh5YCeTxcrVR5ks3rWeY7GYPb2ZyeLo/7dsFpMOXWO02HtL22LP 3pMsFvOXPWW36L6+g81i+fF/TBbn/x5ntTg/aw67g5DHzll32T0uny312LSqk81j85J6j903 G9g8Pj69xeLRt2UVo8eZBUfYPT5vkvPY9OQtUwBXVLZNRmpiSmqRQmpecn5KZl66rZJ3cLxz vKmZgaGuoaWFuZJCXmJuqq2Si0+ArltmDtBPSgpliTmlQKGAxOJiJX07m6L80pJUhYz84hJb pdSClJwCkwK94sTc4tK8dL281BIrQwMDI1OgwoTsjL/T9jMWtHNXXL9zhbWBcT5nFyMnh4SA icT7uR9Zuhi5OIQEdjNKPL1/ixnC+cQosfTXMjYI5xujxKX9j1hgWi48a4Cq2ssosWbNV1YI 5zOjxOpLPexdjBwcbAKaEhcml4I0iAgsZZRYeT0apIZZYDmTxIH7u8EmCQsESPQ962QCsVkE VCXWzjrNBmLzCphLNO19yASxTV5i5qXv7CA2p4CFxIcdN1kgagQlTs58AmYzA9U0b50NdpGE wB0Oia9TV7FDNLtIrPvZCzVIWOLV8S1QcSmJz+/2skHY2RIPHj2Aeq1GYsfmPlYI216i4c8N VpBnmIGeWb9LH2IXn0Tv7ydMIGEJAV6JjjYhiGpFiXuTnkJ1iks8nLEEyvaQ+PnqKxMkfLoZ JbbNm8Q0gVF+FpIXZi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yBUWAWktQsJKkFjEyrGCVTC4pz03OLDQsM81LL9YoTc4tL89L1kvNzNzGCI05Lcwfj9lUf 9A4xMnEwHmKU4GBWEuG1DFJMF+JNSaysSi3Kjy8qzUktPsQozcGiJM4r/qI3RUggPbEkNTs1 tSC1CCbLxMEp1cCkP+X3m64PNa8fhuYqTmxXPpE6+xrDiV2LLkVq30hcpft274l4/6VbdH5t v1ziPufA0RAprjWXj634taX43o+zMlF1q79e+Vh75f+TYxXvH51YsCHjZgjX8alifVqW1foL si8vmSVq+1IgSHyV+4mgbbypipEm0kfbV97hCn717Fmd0xGL2xz1Gy1X8ql67gxTcPztIuF9 dWLKP61tDzZ2idy9Z6zq0s8lFbA0KlpCgpMldO6BqZZCVbKM7DcvMh5u/3HTdEH+4o7lsjzZ ab0+Mqc/2/JfeDMx+/DNVNfJ33qN1xnY103IjXjW/MmT7VeYm+RBzot+LO8ui1iEuEuZzM2s EFrE+u3z1I2cpVwblViKMxINtZiLihMBAM4v/ycDAAA= X-CMS-MailID: 20241030181019epcas5p135961d721959d80f1f60bd4790ed52cf X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181019epcas5p135961d721959d80f1f60bd4790ed52cf References: <20241030180112.4635-1-joshi.k@samsung.com> 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 Wed Oct 30 18:01:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13856999 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 496B81D0E1B for ; Wed, 30 Oct 2024 18:10:26 +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=1730311828; cv=none; b=t/eqsyJmi9/tH4kEhlUUvWLRtl25LFzKa8vREoLcHGMeTBSz1e4dX3vvjp/Ezm9hel1ucx2YxAY99oAigV82JCNAZJq+1p1a7RmH6KzyrchSuGPyJjS5lCRoZAo58UlnFZ+b119eW5++RXJKlyRfQbf51rKEBt9xPDGtE8YMD3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311828; c=relaxed/simple; bh=sQxwKRZlHhNgwu0txpT3fwJ+Hu21CWymOAy7nWG4zDM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=dbo27K/XgdfMT6Oadu8vDRrI8ktqq7JFFd841bTB7ch3ZSpi6K0m+60TnrvK2rfvAGmRYqNv9AiDGENnP4wSUwv+jMf1eciuoonYdLSk54VMBru1cHohRVtXTdEotGT/cpvMkpJ0poJpNAc1P8ScyJqLDqvynQObMO8EXe1BWKQ= 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=DarVl7UE; 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="DarVl7UE" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20241030181024epoutp01dc07da7a860de587da7c07ab64d27b31~DTW-bliMo2841628416epoutp01i for ; Wed, 30 Oct 2024 18:10:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20241030181024epoutp01dc07da7a860de587da7c07ab64d27b31~DTW-bliMo2841628416epoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311824; bh=9c3rZENSKdkXmC+Y3kw02fQnQ6vNnysPx+30NOoEsu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DarVl7UE/diJY5MbNvUNcfEWSuTB5KKnUk1y05KYV+JzUI0mHmqIePshlLyO8IBEf s+MtiQhwJIBD7i7kGekHu5Esfgto/yxW424z+oRVGmw+/XIuVIjLeohl+3am/Pmp4X DIxV2kN3P56bXriYaBlDN5AT95czJ0TwRLqe1gQc= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241030181023epcas5p49db274db2b4b25e1ae9120d610e9d65b~DTW_k0gMP1541015410epcas5p4G; Wed, 30 Oct 2024 18:10:23 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.183]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4XdwCL3wYNz4x9Pq; Wed, 30 Oct 2024 18:10:22 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 51.76.09770.E8672276; Thu, 31 Oct 2024 03:10:22 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241030181021epcas5p1c61b7980358f3120014b4f99390d1595~DTW8rfk241837718377epcas5p1W; Wed, 30 Oct 2024 18:10:21 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241030181021epsmtrp199e7663d2fadc8cc15bb501dc62f18cb~DTW8qsdqQ0197101971epsmtrp1a; Wed, 30 Oct 2024 18:10:21 +0000 (GMT) X-AuditID: b6c32a4a-e25fa7000000262a-0f-6722768e1a3c Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 7E.78.08229.D8672276; Thu, 31 Oct 2024 03:10:21 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181019epsmtip2cb564bdb3fa071b80e23e2d436037294~DTW6XM2mN0238402384epsmtip2s; Wed, 30 Oct 2024 18:10:19 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Anuj Gupta Subject: [PATCH v6 09/10] scsi: add support for user-meta interface Date: Wed, 30 Oct 2024 23:31:11 +0530 Message-Id: <20241030180112.4635-10-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFJsWRmVeSWpSXmKPExsWy7bCmhm5fmVK6wb4bEhYfv/5msWia8JfZ Ys6qbYwWq+/2s1m8PvyJ0eLmgZ1MFitXH2WyeNd6jsVi9vRmJotJh64xWuy9pW2xZ+9JFov5 y56yW3Rf38Fmsfz4PyaL83+Ps1qcnzWH3UHQY+esu+wel8+Wemxa1cnmsXlJvcfumw1sHh+f 3mLx6NuyitHjzIIj7B6fN8l5bHrylimAKyrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ 19DSwlxJIS8xN9VWycUnQNctMwfoHSWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpO gUmBXnFibnFpXrpeXmqJlaGBgZEpUGFCdsbb9VtYCy6KVkw+d5GlgfGsYBcjJ4eEgInE+7Y1 TF2MXBxCArsZJTZv7WWFcD4xSjQu3cYC4XxjlJg+dysLTMu1WTMZIRJ7GSUuP5zMDpIQEvjM KDFlg2cXIwcHm4CmxIXJpSBhEYGljBIrr0eD1DMLNDBJ9N7tZQapERZwlli+PwWkhkVAVeLS 1yuMIDavgIXEt7272CF2yUvMvPQdzOYEin/YcZMFokZQ4uTMJ2A2M1BN89bZzCDzJQSucEjs et7DBtHsInFn5ypGCFtY4tXxLVBDpSRe9rdB2dkSDx49gHqsRmLH5j5WCNteouHPDVaQO5mB flm/Sx9iF59E7+8nTCBhCQFeiY42IYhqRYl7k55CdYpLPJyxBMr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mpe9gNidQ/MOOm2BjhATMJa4vPMMOUS8ocXLmE6jx8hLNW2czT2AUmIUk NQtJagEj0ypGydSC4tz03GLDAsO81HK94sTc4tK8dL3k/NxNjOAo09Lcwbh91Qe9Q4xMHIyH GCU4mJVEeC2DFNOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ84q/6E0REkhPLEnNTk0tSC2CyTJx cEo1MJWEPhBJ1Cvg3/NtPteiyNrqW2EhN27Pe/NPnzvr+5zA77uFaoXX1oh91imTaWJetV35 x5/k5ac/dm4IkLiTw/DjRarRor23NIo+p14Ik13a91CY9WjZT2Zn69jqLVPFDFaod3cs8722 7OKpqWKSUold3SaJ76LUlieH5QnubTv62JtHL2T6JtYU/pA/W+Ybx1mrRd9X+qj+4r7ih0LO +rhlrM8ucR2tXLpY79+pP5d2zPvz4enT2nXm3LlnW5cIWy8TkP5c8If15bUrc2bFXJs776aM 53P55o/FIdHsfx9mmqv/uNiy/ObPaVPO/r3EY9Gw8n6Q2ZH+sz+PcS39eDFtg5wP67kDkbOC pl04o7xIiaU4I9FQi7moOBEA7niN9SEDAAA= X-CMS-MailID: 20241030181021epcas5p1c61b7980358f3120014b4f99390d1595 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181021epcas5p1c61b7980358f3120014b4f99390d1595 References: <20241030180112.4635-1-joshi.k@samsung.com> From: Anuj Gupta Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. With this change, BIP_CTRL_NOCHECK becomes unused. Remove it. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- include/linux/bio-integrity.h | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 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; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index fe2bfe122db2..0046c744ea53 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -7,13 +7,12 @@ enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ - BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */ - 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 */ + BIP_DISK_NOCHECK = 1 << 2, /* disable disk integrity checking */ + BIP_IP_CHECKSUM = 1 << 3, /* IP checksum */ + BIP_COPY_USER = 1 << 4, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 5, /* guard check */ + BIP_CHECK_REFTAG = 1 << 6, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 7, /* apptag check */ }; struct bio_integrity_payload { @@ -34,8 +33,8 @@ struct bio_integrity_payload { }; #define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ - BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) + BIP_IP_CHECKSUM | BIP_CHECK_GUARD | \ + BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY From patchwork Wed Oct 30 18:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13857000 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 2C58A213137 for ; Wed, 30 Oct 2024 18:10:28 +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=1730311832; cv=none; b=I4cUJg5lETPnPM5K9aNp9mcHnKMVkXZ48cdAVSSwuO6wUb5CKzUqerCo8vugi8/W6VFEV/fVkS4P9gD/3hzK/0dGjbXR47N+o5MccrwGWtLaklZdepTRAE2we6D0NkZKiZ6LvducXFJ4HuiS0lITjKJ6LOun6GFTXC+CZU893x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730311832; c=relaxed/simple; bh=BPC9QfnCUK7/s4TcRVufyO+i0XBKDsn5DH/1T4BMbuw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=YVCyyuyllBLPbV9ehFOHVcRwFPwaUn9/SS3d9IfEtuQbz5aKXQYz0TetOKiBnraGwziH1qZn/dj4Gjc9ibGoLXeLm7jm4f2E1XeR0C30KE5AviyEqqBAoaB4BXm/0rPbNyI70MdngMDC2FLyA6LlUdo1DsXrh+OY423wdqjAuz8= 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=QWE0WHPt; 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="QWE0WHPt" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241030181027epoutp030389a0d992f8d5401637bdbf6774628e~DTXCDnBoK3081030810epoutp03h for ; Wed, 30 Oct 2024 18:10:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241030181027epoutp030389a0d992f8d5401637bdbf6774628e~DTXCDnBoK3081030810epoutp03h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730311827; bh=6pisa7CqgV+3Ji79lmJB+2Ri7+98WW38tiiGMkWrIyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWE0WHPtMNUKYj/ojP3rJ/uMkWM83TafJvgZd+vnSQEbQtR8WgZp86Icefz/oQ04p Wx3GZGkTZxwfGJp8Ov87cegAGzRCEoSIDEJpWoxKJ52IQw2T7OnFvy/pWtDhMfVOp7 0GtfJiVGRa1qSrJWYkjIumw+7BKqPCTc4TEUYGU4= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20241030181026epcas5p370b50f7a4e3c989922db0c76ace9f85a~DTXBXS8IJ3148631486epcas5p3K; Wed, 30 Oct 2024 18:10:26 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.178]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XdwCP04xQz4x9Pp; Wed, 30 Oct 2024 18:10:25 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id FB.10.09420.09672276; Thu, 31 Oct 2024 03:10:24 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241030181024epcas5p3964697a08159f8593a6f94764f77a7f3~DTW-St93v1475114751epcas5p39; Wed, 30 Oct 2024 18:10:24 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241030181024epsmtrp1a10cae8d245639d8d65820f82c49722b~DTW-R3qtN0151201512epsmtrp1A; Wed, 30 Oct 2024 18:10:24 +0000 (GMT) X-AuditID: b6c32a49-0d5ff700000024cc-01-67227690d601 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 9F.78.08229.09672276; Thu, 31 Oct 2024 03:10:24 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241030181021epsmtip24b0ee33856d7ce1e54ed3e737bc522d5~DTW8xCjos0487504875epsmtip2-; Wed, 30 Oct 2024 18:10:21 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, gost.dev@samsung.com, vishak.g@samsung.com, anuj1072538@gmail.com, Kanchan Joshi , Anuj Gupta Subject: [PATCH v6 10/10] block: add support to pass user meta buffer Date: Wed, 30 Oct 2024 23:31:12 +0530 Message-Id: <20241030180112.4635-11-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241030180112.4635-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02TfUxTVxjGc+4tbcEUL9WFM0y0XpUFtmKrpR4WYSwgXIYjKDOZksDu6E1h 0N6mt0WcGOoQwteQ4YwrsOkMRSxbMYgMB0wsEkYyYcNtfCwM3IpDGAtK5HOy9cvN/5487+89 73nOhxAX3+UHCbO0BkavpXNIvh+vrSckVFqVS6pllh4FevRkjYc+qHqKozprG0BN42f5aLbn MUCj3TcxdLWpF0N/FQ3wUO2FQgz1/jPHR9X2nwHqGnsZdXb189DFhikBKh9u56MrfesYGnza 54MGa+oE0WLqZs24gLp310i1WEv51PX6Aqpj1MSnHk2N8ajKViugvrt0R0AttGylWhxzWLLf sez9mQytYvQSRpvBqrK06kgyMSU9Jj1cKZNL5RFoHynR0homkow9mCyNy8pxZiIluXSO0Wkl 0xxH7o7ar2eNBkaSyXKGSJLRqXJ0Cl0YR2s4o1YdpmUMr8plsj3hTvCd7MzqxdOYrmJfXtGF FWACJdIy4CuEhAJeXpsBZcBPKCY6ADx/7TRwFcTEYwAtsz6ewiKAEzcqBc86GlYbMQ/UBWBF mdwDLQC41vQlXgaEQj4RAr8/Z3QxmwkLgFeHU10MTlzBYPdEB89V2EQcgI7VCfeiPGIXNH9e 6NYiAkG7tRl4hm2D5qElt+/r9OfbR3keJgD2mx1ujTuZwhu1uGsAJEaE8LPaCp6nORZ+a7/m 3fUmONPX6tVB8OHZYq/OhpO/TXr5fNh+vdLHo1+Dpr9HfFxhcGeY5q93e2b5ww/XHJjLhoQI lhSLPfR2+Gv1lLczEN7/pN6rKTgzUepeRUyUA9h9rApsq3kuQM1zAWr+n3UJ4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cYsMCw7zUcr3ixNzi0rx0veT83E2M4IjT0tzBuH3VB71D jEwcjIcYJTiYlUR4LYMU04V4UxIrq1KL8uOLSnNSiw8xSnOwKInzir/oTRESSE8sSc1OTS1I LYLJMnFwSjUwrYs5cK6PoeXk8WqVsmNrX3aHvZA6lJjRwrXEY+2BS85ftizR0AhuupY5xSd4 txTXyrjSRyyTHUz6NNjN/O3LzJf4b5wSOD3h/da/HGkvNr7QYpA5K8/31rPQLoUjoH1n6JS0 HtX4WP7pzpaLjyb1c93LvBq5lEOm/UntkherGTq6ppZNP3NswpfKs1s37zvJPO+rsVUA05NJ W9tfHk6x1Z3wLvBIxsXPjF8nrX66T36H5suqfsYlbh8apct1i80/me68nqaacc5y/fVDzWrv 60XYumTsuW22vPj7e/lVL/k7H/JuFi9fIt2/tTp0+96Hv9by7VRd+E2vr6a5MrqmPPhN+oaz p9IM1Rt/FT+xUWIpzkg01GIuKk4EAPmYgdwnAwAA X-CMS-MailID: 20241030181024epcas5p3964697a08159f8593a6f94764f77a7f3 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241030181024epcas5p3964697a08159f8593a6f94764f77a7f3 References: <20241030180112.4635-1-joshi.k@samsung.com> 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 0046c744ea53..a42b7fe0eee9 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -23,6 +23,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 */ @@ -79,6 +80,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); @@ -109,6 +111,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) { }