From patchwork Tue Sep 27 17:36:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 12991055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E44C5C07E9D for ; Tue, 27 Sep 2022 17:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233341AbiI0Rt2 (ORCPT ); Tue, 27 Sep 2022 13:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233610AbiI0Rs6 (ORCPT ); Tue, 27 Sep 2022 13:48:58 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA529A6A3 for ; Tue, 27 Sep 2022 10:46:31 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220927174630epoutp031ce681fc894d455aaabd7b0dd08ca9f4~YyMA6Qw022268822688epoutp03j for ; Tue, 27 Sep 2022 17:46:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220927174630epoutp031ce681fc894d455aaabd7b0dd08ca9f4~YyMA6Qw022268822688epoutp03j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664300790; bh=6HR7pDfEWCQApaFHaY1z8P5ClzoEBjIEJhDVePj5Z8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CW5MqZOWodT97RqQnmic7jU/P7GBKmZLoD6sAGTVqnxH2txWGpGc0FUmu3ELsT2y5 QxJKSNp27669gngyvOKE7AUydG0UVTeKVs6gBqWPtc2HiA4C416zYOkQ2+XUHHJL1U brNxdJR2p833g5wrv4eEEK0WKjf5Lc5IIkwgf9vg= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220927174629epcas5p2182427ae4915d3268c0b4714d7a73934~YyMAM1E-c1324413244epcas5p20; Tue, 27 Sep 2022 17:46:29 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.183]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4McRrM0PzFz4x9Pp; Tue, 27 Sep 2022 17:46:27 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 78.08.26992.2F633336; Wed, 28 Sep 2022 02:46:26 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20220927174626epcas5p4002acda6f0578ee314ee5e611b8d6662~YyL9OEkhy2946929469epcas5p44; Tue, 27 Sep 2022 17:46:26 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220927174626epsmtrp2a19f332ab991fa507a79f5882b473637~YyL9NQyCg3251332513epsmtrp2c; Tue, 27 Sep 2022 17:46:26 +0000 (GMT) X-AuditID: b6c32a49-0c7ff70000016970-2e-633336f25396 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 72.86.18644.2F633336; Wed, 28 Sep 2022 02:46:26 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220927174624epsmtip1cd45388de89debfd4591b5c8da8f430e~YyL716u1W0699506995epsmtip1h; Tue, 27 Sep 2022 17:46:24 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, Anuj Gupta , Kanchan Joshi Subject: [PATCH for-next v10 1/7] io_uring: add io_uring_cmd_import_fixed Date: Tue, 27 Sep 2022 23:06:04 +0530 Message-Id: <20220927173610.7794-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220927173610.7794-1-joshi.k@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdlhTQ/eTmXGywee91hZNE/4yW6y+289m cfPATiaLlauPMlm8az3HYnH0/1s2i0mHrjFa7L2lbTF/2VN2B06Py2dLPTat6mTz2Lyk3mP3 zQY2j74tqxg9Pm+SC2CLyrbJSE1MSS1SSM1Lzk/JzEu3VfIOjneONzUzMNQ1tLQwV1LIS8xN tVVy8QnQdcvMATpJSaEsMacUKBSQWFyspG9nU5RfWpKqkJFfXGKrlFqQklNgUqBXnJhbXJqX rpeXWmJlaGBgZApUmJCd8X/WTKaCVUIVL19/ZWpgnMvfxcjJISFgIvHx6CrmLkYuDiGB3YwS M/a8ZgJJCAl8YpT4f14XIvGZUWLjgd2sMB3/OnczQSR2MUqsm/OBGa7q9od+9i5GDg42AU2J C5NLQRpEBIwk9n86yQpSwwyy4u2NRnaQhLCAp0TPg1lg61gEVCU2rL3OBmLzCphLzFvWxQyx TV5i5qXvYDM5BSwkDn/MhCgRlDg58wkLiM0MVNK8dTbYDRICf9kl3l28C3Wpi8T13beYIGxh iVfHt7BD2FISn9/tZYOwkyUuzTwHVVMi8XjPQSjbXqL1VD8zyF5moF/W79KH2MUn0fv7CRNI WEKAV6KjTQiiWlHi3qSnUFvFJR7OWAJle0jMuryMHRI83YwSd36fZprAKD8LyQuzkLwwC2Hb AkbmVYySqQXFuempxaYFhnmp5fB4Tc7P3cQITphanjsY7z74oHeIkYmD8RCjBAezkgjv76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PuKVe4c/IvSuOaeVrRmkvz+OYzZluFqzda8pJbkv/sqIm0P/9c6zjGlgSW1fc///dH60xUF L5RkRKyZpL/ixpe7d8NKpC5X2L86dcnETamp4rAXi68D9xwHwbDGUtHzDxv17630/lxi+vXR yX/6V7d86mqbGmhVceb92QtvCtdtfibCvuCe8sVahW9vjDS/RkTO3Zsl4cMrsjhUdJP5xHu7 tXqneUhInHi/bdc107QVk647cZrkKV/KTvqfoKDwX7p+6y293W9PHristJjV9b355Olct7S9 P7VGpdlxhKt5LG3k9upij85vOcHVdsK4VZy5YtKxzsuabf4sEWmhH78cWT5ZsM5Bw2W6Ektx RqKhFnNRcSIAHX7EsuUCAAA= X-CMS-MailID: 20220927174626epcas5p4002acda6f0578ee314ee5e611b8d6662 X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220927174626epcas5p4002acda6f0578ee314ee5e611b8d6662 References: <20220927173610.7794-1-joshi.k@samsung.com> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Anuj Gupta This is a new helper that callers can use to obtain a bvec iterator for the previously mapped buffer. This is preparatory work to enable fixed-buffer support for io_uring_cmd. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi --- include/linux/io_uring.h | 8 ++++++++ io_uring/uring_cmd.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/io_uring.h b/include/linux/io_uring.h index 58676c0a398f..1dbf51115c30 100644 --- a/include/linux/io_uring.h +++ b/include/linux/io_uring.h @@ -4,6 +4,7 @@ #include #include +#include enum io_uring_cmd_flags { IO_URING_F_COMPLETE_DEFER = 1, @@ -32,6 +33,8 @@ struct io_uring_cmd { }; #if defined(CONFIG_IO_URING) +int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, + struct iov_iter *iter, void *ioucmd); void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2); void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd, void (*task_work_cb)(struct io_uring_cmd *)); @@ -59,6 +62,11 @@ static inline void io_uring_free(struct task_struct *tsk) __io_uring_free(tsk); } #else +static int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, + struct iov_iter *iter, void *ioucmd) +{ + return -EOPNOTSUPP; +} static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t ret2) { diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index f3ed61e9bd0f..6a6d69523d75 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -8,6 +8,7 @@ #include #include "io_uring.h" +#include "rsrc.h" #include "uring_cmd.h" static void io_uring_cmd_work(struct io_kiocb *req, bool *locked) @@ -129,3 +130,12 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags) return IOU_ISSUE_SKIP_COMPLETE; } + +int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, + struct iov_iter *iter, void *ioucmd) +{ + struct io_kiocb *req = cmd_to_io_kiocb(ioucmd); + + return io_import_fixed(rw, iter, req->imu, ubuf, len); +} +EXPORT_SYMBOL_GPL(io_uring_cmd_import_fixed);