From patchwork Fri Mar 22 18:50:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13600389 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 D3F6C762D6 for ; Fri, 22 Mar 2024 18:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.24 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133859; cv=none; b=uyt3vP50NRw7iUpmbt1UrDzYglTMNDsa7yDHMBYb1/IQ/s6UPRYaBjTTllM3i+fr9/AVZlcn6GLcheInEAZ3CbT5JkkcD45Pn0Pwz3oIA3SW4JwBbjP3uxXhLF6BDJeQJC+vH/qjTPhWaq7nhrcP4D2iEuh/s8gEA44yZ/4R+/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133859; c=relaxed/simple; bh=/SP/jJnUyBDiMYaQ9ijXfSzW7CRoMmzrlD+8HEWGV0U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=hqE2706AxVLCLtsG0QgO46tgcYSVJdkwXXwJTO3dGDP8qAkRrKJMiNlkPeKOm9ygnq9X5F707DxBXL/If5L+Ra/Xt/daqM4szCiXy0WzTb3SOHinAHtl/yLtf6LMOGewV6wvzbQ1/puJh3kh00PRUthj2ZYdPGYWsmMNze3GZv8= 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=Jn0uj8hy; 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="Jn0uj8hy" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240322185734epoutp0181891dfcc081821ae5ffd26ba2e3d6a4~-KyzAL5mH2534625346epoutp01K for ; Fri, 22 Mar 2024 18:57:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240322185734epoutp0181891dfcc081821ae5ffd26ba2e3d6a4~-KyzAL5mH2534625346epoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711133854; bh=tBADbgXJvTUccByZhMHOUzX145TVT1OvGWukt8bDhNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jn0uj8hyEcJ7YgupBa5LyEmMcGVtIJVk64DnkhZ1Qlns7eL46H06Exm98NwE1APIf e1/PrOZaOPkZ0iRQeLmYQytOxUt9HYpiSMv/cwcOZJ1dZgtq2jYtQPvC+ifiiaApSX vilSxSXgdbT6a7E3a9KFusS6wO6Kl9hdC3I9rrWo= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240322185733epcas5p22970b83ba7f542afe09b77eae1126860~-Kyx1T-nP0149101491epcas5p2c; Fri, 22 Mar 2024 18:57:33 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.180]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4V1WmD1H83z4x9Pt; Fri, 22 Mar 2024 18:57:32 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id B0.BD.09665.C94DDF56; Sat, 23 Mar 2024 03:57:32 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20240322185731epcas5p20fc525f793a537310f7b3ae5ba5bc75b~-Kyv5UzQI0149101491epcas5p2b; Fri, 22 Mar 2024 18:57:31 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240322185731epsmtrp21f882f0d89d52513af9c609747365eb5~-Kyv4lu2S0597405974epsmtrp25; Fri, 22 Mar 2024 18:57:31 +0000 (GMT) X-AuditID: b6c32a4b-829fa700000025c1-e9-65fdd49ca9b5 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id D3.94.08924.B94DDF56; Sat, 23 Mar 2024 03:57:31 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240322185729epsmtip1d25fd2efd4ef6454c38b868def3ad50c~-KyudL0KY1491214912epsmtip1a; Fri, 22 Mar 2024 18:57:29 +0000 (GMT) From: Kanchan Joshi To: martin.petersen@oracle.com, axboe@kernel.dk, kbusch@kernel.org, hch@lst.de Cc: io-uring@vger.kernel.org, linux-block@vger.kernel.org, anuj1072538@gmail.com, Anuj Gupta Subject: [RFC PATCH 1/4] io_uring/rw: Get rid of flags field in struct io_rw Date: Sat, 23 Mar 2024 00:20:20 +0530 Message-Id: <20240322185023.131697-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240322185023.131697-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupik+LIzCtJLcpLzFFi42LZdlhTXXfOlb+pBu9ns1t8/PqbxaJpwl9m i9V3+9ksVq4+ymTxrvUci8WkQ9cYLfbe0rZYfvwfk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nv0O26Xky31dTdFaR1vmSb3M+HmsJs9gTumTe9wR DoLBbnas9/huHz+eq8RSnJFoqMVcVJwIAGQb/qodBAAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsWy7bCSnO7sK39TDQ5c57X4+PU3i0XThL/M Fqvv9rNZrFx9lMniXes5FotJh64xWuy9pW2x/Pg/JgcOj52z7rJ7XD5b6rFpVSebx+6bDWwe H5/eYvHo27KK0ePzJrkA9igum5TUnMyy1CJ9uwSujGs3eQvahSsOrjZpYNzA38XIySEhYCLx d9d89i5GLg4hgd2MEj03Z7BDJMQlmq/9gLKFJVb+ew5V9JFR4vqpG2xdjBwcbAKaEhcml4LU iAiESCxrncAMYjMLVEos2TwXrFdYwEfi5u4lzCDlLAKqEnPeuYOEeQUsJf5PPcgKMV5eYual 72DlnAJWEtev/mQBsYWAaqY/X80KUS8ocXLmExaI8fISzVtnM09gFJiFJDULSWoBI9MqRsnU guLc9NxiwwLDvNRyveLE3OLSvHS95PzcTYzgQNfS3MG4fdUHvUOMTByMhxglOJiVRHh3/P+T KsSbklhZlVqUH19UmpNafIhRmoNFSZxX/EVvipBAemJJanZqakFqEUyWiYNTqoFpYuSqRba/ vV1Oxsp9Y9C8de/FrC5WOat12qESvvF+ujP5Xl+fdof34YMFj9Lc17aflXJf2L3QeyL3tRc6 G/br856+uMn0UUxNv9EF3uZOK4FXHFnq+Y2JHJt0/r9Kbe/LmqM15UzxxZ/rl+zj3Kp151aX Yypz2qNWs+K8ss1hdxuvdx2Y65a3/SRLjFXq9+/bc/SExVkOh+5deNtOdcm++nMW/l/2KFo8 rVjnkz+hY2VAETvH1OSM+bMk2+M2zP7owH+PKUTjw3/ZM98+1yXfvSb+KeTV47Ibl1xe1ShZ cBk8m1cwQyx667kDSRmTpLvOMm2zEZFZMH/p3UmsHa3HlU/uWFPWX22otCbiVvAMJZbijERD Leai4kQAd0Gv1eMCAAA= X-CMS-MailID: 20240322185731epcas5p20fc525f793a537310f7b3ae5ba5bc75b X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240322185731epcas5p20fc525f793a537310f7b3ae5ba5bc75b References: <20240322185023.131697-1-joshi.k@samsung.com> From: Anuj Gupta Get rid of the flags field in io_rw. Flags can be set in kiocb->flags during prep rather than doing it while issuing the I/O in io_read/io_write. Signed-off-by: Anuj Gupta --- io_uring/rw.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/io_uring/rw.c b/io_uring/rw.c index 47e097ab5d7e..40f6c2a59928 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -27,7 +27,6 @@ struct io_rw { struct kiocb kiocb; u64 addr; u32 len; - rwf_t flags; }; static inline bool io_file_supports_nowait(struct io_kiocb *req) @@ -78,10 +77,16 @@ static int io_iov_buffer_select_prep(struct io_kiocb *req) int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) { struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + struct kiocb *kiocb = &rw->kiocb; unsigned ioprio; int ret; - rw->kiocb.ki_pos = READ_ONCE(sqe->off); + kiocb->ki_flags = 0; + ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags)); + if (unlikely(ret)) + return ret; + + kiocb->ki_pos = READ_ONCE(sqe->off); /* used for fixed read/write too - just read unconditionally */ req->buf_index = READ_ONCE(sqe->buf_index); @@ -91,15 +96,14 @@ int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) if (ret) return ret; - rw->kiocb.ki_ioprio = ioprio; + kiocb->ki_ioprio = ioprio; } else { - rw->kiocb.ki_ioprio = get_current_ioprio(); + kiocb->ki_ioprio = get_current_ioprio(); } - rw->kiocb.dio_complete = NULL; + kiocb->dio_complete = NULL; rw->addr = READ_ONCE(sqe->addr); rw->len = READ_ONCE(sqe->len); - rw->flags = READ_ONCE(sqe->rw_flags); return 0; } @@ -720,7 +724,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) struct kiocb *kiocb = &rw->kiocb; struct io_ring_ctx *ctx = req->ctx; struct file *file = req->file; - int ret; if (unlikely(!(file->f_mode & mode))) return -EBADF; @@ -728,10 +731,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) if (!(req->flags & REQ_F_FIXED_FILE)) req->flags |= io_file_get_flags(file); - kiocb->ki_flags = file->f_iocb_flags; - ret = kiocb_set_rw_flags(kiocb, rw->flags); - if (unlikely(ret)) - return ret; + kiocb->ki_flags |= file->f_iocb_flags; kiocb->ki_flags |= IOCB_ALLOC_CACHE; /* From patchwork Fri Mar 22 18:50:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13600390 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 1838C768F4 for ; Fri, 22 Mar 2024 18:57:38 +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=1711133861; cv=none; b=sTx91SprqhX+hG3N5IZjUctzZTv8P1PRSfLaHprq+Vn+svNxmSeUWD9qJKOipacWKhk3elqJYVXPJxBYUSDV8l/GKOVectSK+4zqe5jMl5yJKQzhCk66pnGX8M7+cNz91d4Hpjqbeu3SFFEMnUtg3pVDLEd1+F213gFhlXaVA/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133861; c=relaxed/simple; bh=na/CenVLb5Xu/o39DMpZBv4uvSTAi9NHfTka/puvBWM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=mVOcg0hCmUQIQ9pto8g7WLWfUsae/H+xUrHxsEyJnH16opv55Lwgzy2xG22GE65bK64mO3ZGd8fJ/gOE30TwcCJvAoO3ko+fJpCPAg6RqfijDjvBNCi0U3qW3lX9gEIJkvhfWSHvs/fs7BVOslipuPmN/W/VD+34H5I+H/V7AAw= 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=W99mHN2K; 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="W99mHN2K" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20240322185736epoutp01017182bc94864ca4d6ba3d2bc6bd61c9~-Ky1MiUCt2534625346epoutp01M for ; Fri, 22 Mar 2024 18:57:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20240322185736epoutp01017182bc94864ca4d6ba3d2bc6bd61c9~-Ky1MiUCt2534625346epoutp01M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711133857; bh=WbJRm7ihfrQleNCaP9iJo5NVm6Oew/wSd0fYC2SwHjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W99mHN2KTYBwI+DwbA/5LqgfNtn6/wojD1KnYJW+p360C1hKJ6M4slNvoFQu3oYd4 /tVHnw36iv1tt1hegAZQEa0o4kT2VEJ7Y0xW5T+rlVhcsoqalaAYNgYDLK9Eo9uNqv ECGoLfPLOk/RvR0Fx0NAYoIfMZcIuzilQxH74Zz4= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240322185736epcas5p443ec97f425f93a33323d011834e90c4c~-Ky0X0-Jv2613626136epcas5p4x; Fri, 22 Mar 2024 18:57:36 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.182]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4V1WmG6RD3z4x9Pv; Fri, 22 Mar 2024 18:57:34 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 18.A1.08600.E94DDF56; Sat, 23 Mar 2024 03:57:34 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20240322185734epcas5p2cd407dac97cd157c1833c4022ea84805~-KyytCQe71964119641epcas5p2F; Fri, 22 Mar 2024 18:57:34 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240322185734epsmtrp143c54e9b3662640908b2ed37cb6ee018~-KyysWezb0917909179epsmtrp1p; Fri, 22 Mar 2024 18:57:34 +0000 (GMT) X-AuditID: b6c32a44-921fa70000002198-e0-65fdd49e416a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id A8.B3.19234.E94DDF56; Sat, 23 Mar 2024 03:57:34 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240322185731epsmtip1a3c5625e966ca33a68d133fe951f6461~-KywKWXNp1992619926epsmtip1e; Fri, 22 Mar 2024 18:57:31 +0000 (GMT) From: Kanchan Joshi To: martin.petersen@oracle.com, axboe@kernel.dk, kbusch@kernel.org, hch@lst.de Cc: io-uring@vger.kernel.org, linux-block@vger.kernel.org, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi , Nitesh Shetty Subject: [RFC PATCH 2/4] io_uring/rw: support read/write with metadata Date: Sat, 23 Mar 2024 00:20:21 +0530 Message-Id: <20240322185023.131697-3-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240322185023.131697-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOJsWRmVeSWpSXmKPExsWy7bCmhu68K39TDT6d07T4+PU3i0XThL/M Fqvv9rNZrFx9lMniXes5Fouj/9+yWUw6dI3RYu8tbYvlx/8xWWz7PZ/Zgctj56y77B6Xz5Z6 bFrVyeax+2YDm8fHp7dYPPq2rGL0+LxJLoA9KtsmIzUxJbVIITUvOT8lMy/dVsk7ON453tTM wFDX0NLCXEkhLzE31VbJxSdA1y0zB+g6JYWyxJxSoFBAYnGxkr6dTVF+aUmqQkZ+cYmtUmpB Sk6BSYFecWJucWleul5eaomVoYGBkSlQYUJ2xuQu34IzwRVz/29jb2Bscu5i5OSQEDCRmDHn EFsXIxeHkMBuRom5928ygiSEBD4xSrzo8odIANkfd05ghOnYfO4xVMdORonWX8uZIDo+M0o0 H4/qYuTgYBPQlLgwuRQkLCIQIPH09zmwemaBw4wSU3euZgZJCAu4Saw/+gCsl0VAVeLW4Utg cV4BS4mjm69ALZOXmHnpOzuIzSlgJXH96k8WiBpBiZMzn4DZzEA1zVtnM4MskBBo5ZD40DCP GaLZReJk2wUmCFtY4tXxLewQtpTEy/42KDtZ4tLMc1A1JRKP9xyEsu0lWk/1M4M8wwz0zPpd +hC7+CR6fz9hAglLCPBKdLQJQVQrStyb9JQVwhaXeDhjCStEiYfE+2+CkKDqZZQ4cOkN2wRG +VlIPpiF5INZCMsWMDKvYpRMLSjOTU9NNi0wzEsth8dqcn7uJkZwCtVy2cF4Y/4/vUOMTByM hxglOJiVRHh3/P+TKsSbklhZlVqUH19UmpNafIjRFBjEE5mlRJPzgUk8ryTe0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fTnfOYtyWmKT0wnuH99NMH n4O271QE134z1e2NVjxyOzd+gaXC+ce9japJp11S6td2XwoWsGix3yXocXUGp++f8q+Hdp/i XvzDf1LK/D/zrkubGT06wnPw6y9rpsTL72W+hYeJ/azqDO61MOV6IfxNf4PVNqa3if0ai6yd P241W++5gC3HnsG8YMelD6u23J3lKL15Uq4Dv7WZ+rliS7/8ajv3ErkZ04IF15f0ets8OqJa /TnQtn8K4/u8vOhb5mclTq4WrksS+SEUlLH1VZ2dW5UN5/Ofi7iXMi+5fsnyemLdKn2+exMl Cxd2KbEUZyQaajEXFScCAK4Eg9jsAgAA X-CMS-MailID: 20240322185734epcas5p2cd407dac97cd157c1833c4022ea84805 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240322185734epcas5p2cd407dac97cd157c1833c4022ea84805 References: <20240322185023.131697-1-joshi.k@samsung.com> From: Anuj Gupta This patch introduces IORING_OP_READ_META and IORING_OP_WRITE_META opcodes which allow sending a meta buffer along with read/write. Application can do that by using the newly added meta_buf and meta-len fields of the SQE. These opcodes are supported only for direct IO. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Signed-off-by: Nitesh Shetty --- include/linux/fs.h | 1 + include/uapi/linux/io_uring.h | 6 +++ io_uring/io_uring.c | 2 + io_uring/opdef.c | 29 ++++++++++++ io_uring/rw.c | 86 +++++++++++++++++++++++++++++++++-- io_uring/rw.h | 8 ++++ 6 files changed, 129 insertions(+), 3 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 0a22b7245982..c3a483a4fdac 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -327,6 +327,7 @@ struct readahead_control; #define IOCB_NOIO (1 << 20) /* can use bio alloc cache */ #define IOCB_ALLOC_CACHE (1 << 21) +#define IOCB_USE_META (1 << 22) /* * IOCB_DIO_CALLER_COMP can be set by the iocb owner, to indicate that the * iocb completion can be passed back to the owner for execution from a safe diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 7bd10201a02b..87bd44098037 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -97,6 +97,10 @@ struct io_uring_sqe { __u64 addr3; __u64 __pad2[1]; }; + struct { + __u64 meta_addr; + __u32 meta_len; + }; __u64 optval; /* * If the ring is initialized with IORING_SETUP_SQE128, then @@ -256,6 +260,8 @@ enum io_uring_op { IORING_OP_FUTEX_WAITV, IORING_OP_FIXED_FD_INSTALL, IORING_OP_FTRUNCATE, + IORING_OP_READ_META, + IORING_OP_WRITE_META, /* this goes last, obviously */ IORING_OP_LAST, diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 49a124daa359..7c380cac4465 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -4134,7 +4134,9 @@ static int __init io_uring_init(void) BUILD_BUG_SQE_ELEM(44, __u16, addr_len); BUILD_BUG_SQE_ELEM(46, __u16, __pad3[0]); BUILD_BUG_SQE_ELEM(48, __u64, addr3); + BUILD_BUG_SQE_ELEM(48, __u64, meta_addr); BUILD_BUG_SQE_ELEM_SIZE(48, 0, cmd); + BUILD_BUG_SQE_ELEM(56, __u32, meta_len); BUILD_BUG_SQE_ELEM(56, __u64, __pad2); BUILD_BUG_ON(sizeof(struct io_uring_files_update) != diff --git a/io_uring/opdef.c b/io_uring/opdef.c index 9c080aadc5a6..cb31573ac4ad 100644 --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -146,6 +146,26 @@ const struct io_issue_def io_issue_defs[] = { .prep = io_eopnotsupp_prep, #endif }, + [IORING_OP_READ_META] = { + .needs_file = 1, + .plug = 1, + .audit_skip = 1, + .ioprio = 1, + .iopoll = 1, + .iopoll_queue = 1, + .prep = io_prep_rw_meta, + .issue = io_rw_meta, + }, + [IORING_OP_WRITE_META] = { + .needs_file = 1, + .plug = 1, + .audit_skip = 1, + .ioprio = 1, + .iopoll = 1, + .iopoll_queue = 1, + .prep = io_prep_rw_meta, + .issue = io_rw_meta, + }, [IORING_OP_RECVMSG] = { .needs_file = 1, .unbound_nonreg_file = 1, @@ -501,6 +521,15 @@ const struct io_cold_def io_cold_defs[] = { .cleanup = io_readv_writev_cleanup, .fail = io_rw_fail, }, + [IORING_OP_READ_META] = { + .async_size = sizeof(struct io_async_rw), + .name = "READ_META", + .fail = io_rw_fail, + }, + [IORING_OP_WRITE_META] = { + .async_size = sizeof(struct io_async_rw), + .name = "WRITE_META", + }, [IORING_OP_FSYNC] = { .name = "FSYNC", }, diff --git a/io_uring/rw.c b/io_uring/rw.c index 40f6c2a59928..87a6304052f0 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -27,6 +27,7 @@ struct io_rw { struct kiocb kiocb; u64 addr; u32 len; + u32 meta_len; }; static inline bool io_file_supports_nowait(struct io_kiocb *req) @@ -107,6 +108,22 @@ int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) return 0; } +int io_prep_rw_meta(struct io_kiocb *req, const struct io_uring_sqe *sqe) +{ + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + struct kiocb *kiocb = &rw->kiocb; + int ret; + + ret = io_prep_rw(req, sqe); + if (unlikely(ret)) + return ret; + kiocb->private = u64_to_user_ptr(READ_ONCE(sqe->meta_addr)); + rw->meta_len = READ_ONCE(sqe->meta_len); + + kiocb->ki_flags |= IOCB_USE_META; + return 0; +} + int io_prep_rwv(struct io_kiocb *req, const struct io_uring_sqe *sqe) { int ret; @@ -571,9 +588,18 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec, } } +static inline void io_req_map_meta(struct io_async_rw *iorw, struct io_rw_state_meta *sm) +{ + memcpy(&iorw->s_meta.iter_meta, &sm->iter_meta, sizeof(struct iov_iter)); + iov_iter_save_state(&iorw->s_meta.iter_meta, &iorw->s_meta.iter_state_meta); +} + static int io_setup_async_rw(struct io_kiocb *req, const struct iovec *iovec, struct io_rw_state *s, bool force) { + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + struct kiocb *kiocb = &rw->kiocb; + if (!force && !io_cold_defs[req->opcode].prep_async) return 0; /* opcode type doesn't need async data */ @@ -591,6 +617,11 @@ static int io_setup_async_rw(struct io_kiocb *req, const struct iovec *iovec, iorw = req->async_data; /* we've copied and mapped the iter, ensure state is saved */ iov_iter_save_state(&iorw->s.iter, &iorw->s.iter_state); + if (unlikely(kiocb->ki_flags & IOCB_USE_META)) { + struct io_rw_state_meta *sm = kiocb->private; + + io_req_map_meta(iorw, sm); + } } return 0; } @@ -747,7 +778,8 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) if (!(kiocb->ki_flags & IOCB_DIRECT) || !file->f_op->iopoll) return -EOPNOTSUPP; - kiocb->private = NULL; + if (likely(!(kiocb->ki_flags & IOCB_USE_META))) + kiocb->private = NULL; kiocb->ki_flags |= IOCB_HIPRI; kiocb->ki_complete = io_complete_rw_iopoll; req->iopoll_completed = 0; @@ -766,6 +798,7 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) struct io_rw_state __s, *s = &__s; struct iovec *iovec; struct kiocb *kiocb = &rw->kiocb; + struct io_rw_state_meta *sm = kiocb->private; bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK; struct io_async_rw *io; ssize_t ret, ret2; @@ -840,13 +873,16 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) /* no retry on NONBLOCK nor RWF_NOWAIT */ if (req->flags & REQ_F_NOWAIT) goto done; + if (kiocb->ki_flags & IOCB_USE_META) + kiocb->private = sm; ret = 0; } else if (ret == -EIOCBQUEUED) { if (iovec) kfree(iovec); return IOU_ISSUE_SKIP_COMPLETE; } else if (ret == req->cqe.res || ret <= 0 || !force_nonblock || - (req->flags & REQ_F_NOWAIT) || !need_complete_io(req)) { + (req->flags & REQ_F_NOWAIT) || !need_complete_io(req) || + (kiocb->ki_flags & IOCB_USE_META)) { /* read all, failed, already did sync or don't want to retry */ goto done; } @@ -857,6 +893,12 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags) * manually if we need to. */ iov_iter_restore(&s->iter, &s->iter_state); + if (unlikely(kiocb->ki_flags & IOCB_USE_META)) { + /* don't handle partial completion for read + meta */ + if (ret > 0) + goto done; + iov_iter_restore(&sm->iter_meta, &sm->iter_state_meta); + } ret2 = io_setup_async_rw(req, iovec, s, true); iovec = NULL; @@ -1070,7 +1112,8 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) if (ret2 == -EAGAIN && (req->ctx->flags & IORING_SETUP_IOPOLL)) goto copy_iov; - if (ret2 != req->cqe.res && ret2 >= 0 && need_complete_io(req)) { + if (ret2 != req->cqe.res && ret2 >= 0 && need_complete_io(req) + && !(kiocb->ki_flags & IOCB_USE_META)) { struct io_async_rw *io; trace_io_uring_short_write(req->ctx, kiocb->ki_pos - ret2, @@ -1111,6 +1154,43 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags) return ret; } +int io_rw_meta(struct io_kiocb *req, unsigned int issue_flags) +{ + struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); + void __user *meta_addr = u64_to_user_ptr((u64)rw->kiocb.private); + struct io_rw_state_meta __sm, *sm = &__sm; + struct kiocb *kiocb = &rw->kiocb; + int ret; + + if (!(req->file->f_flags & O_DIRECT)) + return -EOPNOTSUPP; + /* prepare iter for meta-buffer */ + if (!req_has_async_data(req)) { + ret = import_ubuf(ITER_SOURCE, meta_addr, rw->meta_len, &sm->iter_meta); + iov_iter_save_state(&sm->iter_meta, &sm->iter_state_meta); + if (unlikely(ret < 0)) + return ret; + } else { + struct io_async_rw *io = req->async_data; + + sm = &io->s_meta; + iov_iter_restore(&sm->iter_meta, &sm->iter_state_meta); + } + /* Store iter for meta-buf in private, will be used later*/ + kiocb->private = sm; + if (req->opcode == IORING_OP_READ_META) { + ret = __io_read(req, issue_flags); + if (ret >= 0) + return kiocb_done(req, ret, issue_flags); + } else { + ret = io_write(req, issue_flags); + } + if (ret == -EAGAIN) + kiocb->private = meta_addr; + return ret; + +} + void io_rw_fail(struct io_kiocb *req) { int res; diff --git a/io_uring/rw.h b/io_uring/rw.h index f9e89b4fe4da..7c12216776bc 100644 --- a/io_uring/rw.h +++ b/io_uring/rw.h @@ -8,19 +8,27 @@ struct io_rw_state { struct iovec fast_iov[UIO_FASTIOV]; }; +struct io_rw_state_meta { + struct iov_iter iter_meta; + struct iov_iter_state iter_state_meta; +}; + struct io_async_rw { struct io_rw_state s; + struct io_rw_state_meta s_meta; const struct iovec *free_iovec; size_t bytes_done; struct wait_page_queue wpq; }; int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe); +int io_prep_rw_meta(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_prep_rwv(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_prep_rw_fixed(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_read(struct io_kiocb *req, unsigned int issue_flags); int io_readv_prep_async(struct io_kiocb *req); int io_write(struct io_kiocb *req, unsigned int issue_flags); +int io_rw_meta(struct io_kiocb *req, unsigned int issue_flags); int io_writev_prep_async(struct io_kiocb *req); void io_readv_writev_cleanup(struct io_kiocb *req); void io_rw_fail(struct io_kiocb *req); From patchwork Fri Mar 22 18:50:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13600392 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 70E1C7603E for ; Fri, 22 Mar 2024 18:57:41 +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=1711133863; cv=none; b=F4TDvjaPlEKQRa4QsP0LoBZzB15BvleBFaf16ZWhLL8isc/nDHcgAIsmQvQ+3btodsjomXn37nA+pR+Q/R26MiaoFPhUXMd5f6ygg10O0rE0qmCL0/G+F+Tz70/HrrGOrOUqTnFHrDUw5mSJkhCOb4kONf1U/q+14Chj/mDlXXg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133863; c=relaxed/simple; bh=syu/InlwIWqqihQMOD2qdHzhCd/aLGFAsPn8K8olr94=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=sIBV4/n+OwT05dOt+uRkdWWpXS7Pou+WyJhJ0m1k5k+fVZEarmx5P+cpEX+xv9wWB349m5Dgj9eF1Pk8PurwqitYi27nvMhUDnKW4U4QOm4ehNEU+1Vu2CGJdlAgysC43DSR7V6Ww3dLEayiRtN4ZmHChkc4DYlFsCUwJLUvEtA= 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=pliPrxC9; 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="pliPrxC9" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240322185739epoutp026491bdd585ae54aaed30994c5e659f4f~-Ky3fhC9M0890208902epoutp02R for ; Fri, 22 Mar 2024 18:57:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240322185739epoutp026491bdd585ae54aaed30994c5e659f4f~-Ky3fhC9M0890208902epoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711133859; bh=u9x1Pfw1Q0EhKD2Isnc1MhcBzy/Nfy+GN5tL8AhSIzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pliPrxC9QEQLttDWOShCy1+5Szg76rBdX0HBQqCTQoT8VxzAUbW+bqSqz/7xy/MmZ TMuDJ9DiFOawZmgJ8okc2gQ2gnJf1PLvDnoEzQbaIEqYEDeDCYjylwcvPhhh05KRJh MFZA3ML+0moqKbu2hVJMxXJdeu3Qs3UZOdrZXqEI= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20240322185738epcas5p2ae10171c40bf8046d39d1e6731fa35da~-Ky23G1TY0149101491epcas5p2n; Fri, 22 Mar 2024 18:57:38 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.182]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4V1WmK0Mrmz4x9Pt; Fri, 22 Mar 2024 18:57:37 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AC.70.09688.0A4DDF56; Sat, 23 Mar 2024 03:57:36 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20240322185736epcas5p3d0093948e9904e775994bcbe735ea0c5~-Ky03RhUL3147731477epcas5p3s; Fri, 22 Mar 2024 18:57:36 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240322185736epsmtrp2594f807cda2318093b4a32970e017d89~-Ky02nfzM0597405974epsmtrp27; Fri, 22 Mar 2024 18:57:36 +0000 (GMT) X-AuditID: b6c32a4a-837fa700000025d8-37-65fdd4a01eec Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 33.23.08390.0A4DDF56; Sat, 23 Mar 2024 03:57:36 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240322185734epsmtip1d4df9abc3cf12a412156b2431b22dc79~-KyyxbKpl1491214912epsmtip1b; Fri, 22 Mar 2024 18:57:34 +0000 (GMT) From: Kanchan Joshi To: martin.petersen@oracle.com, axboe@kernel.dk, kbusch@kernel.org, hch@lst.de Cc: io-uring@vger.kernel.org, linux-block@vger.kernel.org, anuj1072538@gmail.com, Anuj Gupta , Kanchan Joshi Subject: [RFC PATCH 3/4] block: modify bio_integrity_map_user to accept iov_iter as argument Date: Sat, 23 Mar 2024 00:20:22 +0530 Message-Id: <20240322185023.131697-4-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240322185023.131697-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKJsWRmVeSWpSXmKPExsWy7bCmlu6CK39TDQ48Mrf4+PU3i0XThL/M Fqvv9rNZrFx9lMniXes5Fouj/9+yWUw6dI3RYu8tbYvlx/8xOXB67Jx1l93j8tlSj02rOtk8 dt9sYPP4+PQWi0ffllWMHp83yQWwR2XbZKQmpqQWKaTmJeenZOal2yp5B8c7x5uaGRjqGlpa mCsp5CXmptoqufgE6Lpl5gAdpqRQlphTChQKSCwuVtK3synKLy1JVcjILy6xVUotSMkpMCnQ K07MLS7NS9fLSy2xMjQwMDIFKkzIzpjzoJmpYL98xe5/C9kaGD9IdjFyckgImEj0nvvJCmIL CexmlNh+Ia2LkQvI/sQoMfv3bVYI5xujxJUDfawwHU8/P2OCSOxllDg6YzqU85lRomfeZyCH g4NNQFPiwuRSkAYRgQCJp7/PsYHUMAvMYZRYPq+fCSQhLBAn8fr2DRYQm0VAVWLOixZmEJtX wFLi+p99TBDb5CVmXvrODmJzClhJXL/6kwWiRlDi5MwnYDYzUE3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7mUFsFgFViTkvWsBsXgFLiet/ 9jFBzJeXmHnpO9h8TgErietXf7JA7LKUmP58NStEvaDEyZlPwOLMQPXNW2czT2AUmIUkNQtJ agEj0ypGydSC4tz03GLDAqO81HK94sTc4tK8dL3k/NxNjOCw19Lawbhn1Qe9Q4xMHIyHGCU4 mJVEeHf8/5MqxJuSWFmVWpQfX1Sak1p8iFGag0VJnPfb694UIYH0xJLU7NTUgtQimCwTB6dU A1PGUhZVhYS2Sd5LRI5zHXyxYPb3SX5W4U+ePbRhmJyxP+rEw4gzKxUSiwy2WC7N1CvgX6wQ wb619fz3z2rh59iKnfwcm1csa01p/eb/rsiYdVHppb83v0wKVi2VV2HmT70/8Vkr51KBnESJ c5sY3/19Lz0jrXThL8cn+asf7v9Ue1piv1niYeXvG6otJ+zyqvK7cLdC12HfHMbfu81nOt6a rDutuoRJXWL23vd1bKyL3i9PVSlK++TucWj369cJv5RvSLfeDzC7Eyx9Ompn1qGe1H9ZIgXb Zi3ayDtZ+236j6kdzKt+qulNUnsyQe2HrJPFLeGHDE3WP/vvT5rgv7Tl8xuew92Nps4nFRQb hCWVWIozEg21mIuKEwGUv7H76gIAAA== X-CMS-MailID: 20240322185736epcas5p3d0093948e9904e775994bcbe735ea0c5 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240322185736epcas5p3d0093948e9904e775994bcbe735ea0c5 References: <20240322185023.131697-1-joshi.k@samsung.com> From: Anuj Gupta Refactor 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 --- block/bio-integrity.c | 14 ++++++-------- drivers/nvme/host/ioctl.c | 11 +++++++++-- include/linux/bio.h | 7 ++++--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 2e3e8e04961e..e340b5a03cdf 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -308,17 +308,16 @@ 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, - u32 seed) +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, + u32 seed) { struct request_queue *q = bdev_get_queue(bio->bi_bdev); unsigned int align = q->dma_pad_mask | queue_dma_alignment(q); 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)) @@ -331,8 +330,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) { @@ -342,8 +340,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/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 3dfd5ae99ae0..deee13000f08 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -145,8 +145,15 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, if (bdev) { bio_set_dev(bio, bdev); if (meta_buffer && meta_len) { - ret = bio_integrity_map_user(bio, meta_buffer, meta_len, - meta_seed); + struct iov_iter iter; + unsigned int direction; + + if (bio_data_dir(bio) == READ) + direction = ITER_DEST; + else + direction = ITER_SOURCE; + iov_iter_ubuf(&iter, direction, meta_buffer, meta_len); + ret = bio_integrity_map_user(bio, &iter, meta_seed); if (ret) goto out_unmap; req->cmd_flags |= REQ_INTEGRITY; diff --git a/include/linux/bio.h b/include/linux/bio.h index 875d792bffff..20cf47fc851f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -723,7 +723,7 @@ static inline bool bioset_initialized(struct bio_set *bs) for_each_bio(_bio) \ bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) -int bio_integrity_map_user(struct bio *bio, void __user *ubuf, ssize_t len, u32 seed); +int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, u32 seed); extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); extern bool bio_integrity_prep(struct bio *); @@ -795,8 +795,9 @@ static inline int bio_integrity_add_page(struct bio *bio, struct page *page, return 0; } -static inline int bio_integrity_map_user(struct bio *bio, void __user *ubuf, - ssize_t len, u32 seed) +static inline int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, + u32 seed) + { return -EINVAL; } From patchwork Fri Mar 22 18:50:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 13600393 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 7057576913 for ; Fri, 22 Mar 2024 18:57:43 +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=1711133865; cv=none; b=sDsMF2TNZ8s9TFfkxhswwkUYA16ZymGu2fl/j0SMarZWQjxGLP2TH+lc6xwbmQmNOQG4zOjZqw2kVe8c5U/PB6Hz1VbZ5R5WR3dIj/cG+e2xnuiboYGOtS4Gwu1m7xR0neos5oTh3gKhiLyVCto9J87fc1pfsNzLtUhfQg1p5oQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711133865; c=relaxed/simple; bh=JL3MeFU+adshHszYv2h17eowSxBs6lNLRFzE98JHChY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=crm9XAYwcZkGZm65djuM03qB9MVwtXfuFynYqZ6wq+nMx73XsMdSYUj5rvnlO62Die8rtKlCw2xnA3rt0Nruv9YPVffYNyXXv7MJyEIYNresN1GHKz9u16z4SAQUAa0SI7xwSqzFhstzCz+Ba/8FEEw3vlsIBekK+5dFU0wIwqg= 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=Qbm6XYEM; 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="Qbm6XYEM" Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20240322185741epoutp029839b89c094ff2345850b4b4c069e69c~-Ky5g7zkU0890208902epoutp02S for ; Fri, 22 Mar 2024 18:57:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20240322185741epoutp029839b89c094ff2345850b4b4c069e69c~-Ky5g7zkU0890208902epoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711133861; bh=wHvTeaDpfgYiveEbszV3ymTJuM8INq7WUKPuWJ7ZLwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qbm6XYEMsBWRcGaFxrlL1agt/tcjmvo/bI+EKQayIYwaFumZ9+5sVxSqC+zZamLbs L+6ryO+yVh5SjF/2YAuom0USUeulvqkrPbPhqEJ7BM3r0ATXjNHEjewkYl2ou5FY3T d416RERpgdpWY0bOCYXgyWLN207o+f8JoPLiH1x8= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240322185740epcas5p49c00b147191d2a8b43b191974276efe5~-Ky42eVVJ2613626136epcas5p45; Fri, 22 Mar 2024 18:57:40 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.175]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4V1WmM1fkpz4x9Pp; Fri, 22 Mar 2024 18:57:39 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id 19.F6.19431.3A4DDF56; Sat, 23 Mar 2024 03:57:39 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20240322185738epcas5p20e5bd448ce83350eb9e79c929c4a9b2b~-Ky2zk4od0284402844epcas5p2I; Fri, 22 Mar 2024 18:57:38 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240322185738epsmtrp28b4f072d32029456cca4c811de06c728~-Ky2yuB8G0597405974epsmtrp28; Fri, 22 Mar 2024 18:57:38 +0000 (GMT) X-AuditID: b6c32a50-f57ff70000004be7-15-65fdd4a36e93 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 59.B3.19234.2A4DDF56; Sat, 23 Mar 2024 03:57:38 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240322185736epsmtip139deaba879c59af89b84af8413656577~-Ky0-Feiv1992619926epsmtip1g; Fri, 22 Mar 2024 18:57:36 +0000 (GMT) From: Kanchan Joshi To: martin.petersen@oracle.com, axboe@kernel.dk, kbusch@kernel.org, hch@lst.de Cc: io-uring@vger.kernel.org, linux-block@vger.kernel.org, anuj1072538@gmail.com, Kanchan Joshi , Anuj Gupta Subject: [RFC PATCH 4/4] block: add support to pass the meta buffer Date: Sat, 23 Mar 2024 00:20:23 +0530 Message-Id: <20240322185023.131697-5-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240322185023.131697-1-joshi.k@samsung.com> Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGJsWRmVeSWpSXmKPExsWy7bCmlu7iK39TDd694rT4+PU3i0XThL/M Fqvv9rNZrFx9lMniXes5Fouj/9+yWUw6dI3RYu8tbYvlx/8xOXB67Jx1l93j8tlSj02rOtk8 dt9sYPP4+PQWi0ffllWMHp83yQWwR2XbZKQmpqQWKaTmJeenZOal2yp5B8c7x5uaGRjqGlpa mCsp5CXmptoqufgE6Lpl5gAdpqRQlphTChQKSCwuVtK3synKLy1JVcjILy6xVUotSMkpMCnQ K07MLS7NS9fLSy2xMjQwMDIFKkzIztgwr5mlYIFsxaMjF5gaGN+JdzFyckgImEgcfTqXtYuR i0NIYA+jxOH5x9ghnE+MEgsfPGaEc06tPMYM09KzdQcLRGIno8TDmyehqj4zSvxb8oSti5GD g01AU+LC5FKQBhGBAImnv8+xgdQwC8xhlNi5rZcdpEZYwFli6st6kBoWAVWJJU0vWEFsXgFL iV1dy5kglslLzLz0nR3E5hSwkrh+9ScLRI2gxMmZT8BsZqCa5q2zmUHmSwj8ZZeYfugiG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UnrEFKhAWcJaa+rAcJswioSixpesEKYvMKWErs 6lrOBDFeXmLmpe9gqzgFrCSuX/0JdoIQUM3056uh6gUlTs58wgIxXl6ieets5gmMArOQpGYh SS1gZFrFKJpaUJybnptcYKhXnJhbXJqXrpecn7uJERzuWkE7GJet/6t3iJGJg/EQowQHs5II 747/f1KFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8yrndKYICaQnlqRmp6YWpBbBZJk4OKUamLoD 3Kx2NfOXt+9webM2a+7Fm+u/FW8+GZh2uuHfb9O1U1Onn5LYddEpuJvBvuYl13p1Kx+Jkudz +579cdBIV5KeuHFVZGBVzvYFB9usWvN5D/ZKM4q23G4Iz3lW8G+TnmBBjpemQ/r8T9n5vxif ft66U5xT6+6Lj3c/7CuPLYqa9OWqTHW+3JXQ5eWRX1l8eOL03xV1SLWsUuFqM57T96Gpwon5 tdzEV3z3hA+cXf7aWTIjQaHjyvYyoQ38PqZlcbKX/3Iq3zRLM1p3aHXciuASdj6zvBXbeoNe 9CpJRcXLqz2ceXeBVI7lXqV/Fmc4jC24uGzndDXtji5KEz+fM+XZBz4WH8bW458f2x5WYinO SDTUYi4qTgQAthAiUeYCAAA= X-CMS-MailID: 20240322185738epcas5p20e5bd448ce83350eb9e79c929c4a9b2b X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240322185738epcas5p20e5bd448ce83350eb9e79c929c4a9b2b References: <20240322185023.131697-1-joshi.k@samsung.com> If IOCB_USE_META flag is set, iocb->private points to iov_iter corresponding to the meta-buffer. Use it to prepare the bip and attach that to the bio that we send down. Make sure that block-integrity checks are skipped for this user-owned meta buffer. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi --- block/bio-integrity.c | 13 +++++++++++++ block/fops.c | 9 +++++++++ block/t10-pi.c | 6 ++++++ include/linux/bio.h | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index e340b5a03cdf..c46b70aff840 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -308,6 +308,19 @@ static unsigned int bvec_from_pages(struct bio_vec *bvec, struct page **pages, return nr_bvecs; } +int bio_integrity_map_iter(struct bio *bio, struct iov_iter *iter) +{ + struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); + + if (!bi) + return -EINVAL; + + if (iter->count < bio_integrity_bytes(bi, bio_sectors(bio))) + return -EINVAL; + + return bio_integrity_map_user(bio, iter, 0); +} + int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, u32 seed) { diff --git a/block/fops.c b/block/fops.c index 679d9b752fe8..e488fa66dd60 100644 --- a/block/fops.c +++ b/block/fops.c @@ -353,6 +353,15 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, task_io_account_write(bio->bi_iter.bi_size); } + if (unlikely(iocb->ki_flags & IOCB_USE_META)) { + ret = bio_integrity_map_iter(bio, iocb->private); + WRITE_ONCE(iocb->private, NULL); + if (unlikely(ret)) { + bio_put(bio); + return ret; + } + } + if (iocb->ki_flags & IOCB_NOWAIT) bio->bi_opf |= REQ_NOWAIT; diff --git a/block/t10-pi.c b/block/t10-pi.c index d90892fd6f2a..72d1522417a1 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -156,6 +156,8 @@ static void t10_pi_type1_prepare(struct request *rq) /* Already remapped? */ if (bip->bip_flags & BIP_MAPPED_INTEGRITY) break; + if (bip->bip_flags & BIP_INTEGRITY_USER) + break; bip_for_each_vec(iv, bip, iter) { unsigned int j; @@ -205,6 +207,8 @@ static void t10_pi_type1_complete(struct request *rq, unsigned int nr_bytes) struct bio_vec iv; struct bvec_iter iter; + if (bip->bip_flags & BIP_INTEGRITY_USER) + break; bip_for_each_vec(iv, bip, iter) { unsigned int j; void *p; @@ -408,6 +412,8 @@ static void ext_pi_type1_prepare(struct request *rq) /* Already remapped? */ if (bip->bip_flags & BIP_MAPPED_INTEGRITY) break; + if (bip->bip_flags & BIP_INTEGRITY_USER) + break; bip_for_each_vec(iv, bip, iter) { unsigned int j; diff --git a/include/linux/bio.h b/include/linux/bio.h index 20cf47fc851f..34ea387dfc59 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -723,6 +723,7 @@ static inline bool bioset_initialized(struct bio_set *bs) for_each_bio(_bio) \ bip_for_each_vec(_bvl, _bio->bi_integrity, _iter) +int bio_integrity_map_iter(struct bio *bio, struct iov_iter *iter); int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter, u32 seed); extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); @@ -802,6 +803,11 @@ static inline 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 iov_iter *iter) +{ + return -EINVAL; +} + #endif /* CONFIG_BLK_DEV_INTEGRITY */ /*