From patchwork Thu Sep 8 18:35:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 12970512 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 6E0D2C38145 for ; Thu, 8 Sep 2022 18:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232342AbiIHSpn (ORCPT ); Thu, 8 Sep 2022 14:45:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232286AbiIHSpk (ORCPT ); Thu, 8 Sep 2022 14:45:40 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2BF844F9 for ; Thu, 8 Sep 2022 11:45:37 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220908184534epoutp03e56d9086d33c0c5a9b11cd9c971a5f04~S9vKMyR9K0315103151epoutp03u for ; Thu, 8 Sep 2022 18:45:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220908184534epoutp03e56d9086d33c0c5a9b11cd9c971a5f04~S9vKMyR9K0315103151epoutp03u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1662662734; bh=2CAPPezBpRudgC2/iVSQKO5OZC1ekpekq3vqFH1gTUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eRaGXvV45FpQVrP7zNqxAJYXr3a8ChF3Jlp/tKwbQtf7QJ45u2OcGVaZKnwsgvp89 auJgXmA+NjYfmHank2sgT3xbnJspL7uCviPDZX2n81f9d52gG9mCHS2rLd3utaSiRL NLwY8IVkHh9XZiytk7DTEjFqCaiiTy3L+vspmw2w= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20220908184533epcas5p42a5b682da9ae518321d181d89bca18d4~S9vJQozPw1434814348epcas5p4z; Thu, 8 Sep 2022 18:45:33 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.179]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4MNp3G65Sqz4x9Pq; Thu, 8 Sep 2022 18:45:30 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 59.49.54060.A483A136; Fri, 9 Sep 2022 03:45:30 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20220908184530epcas5p44d67b682ee86fabbb3f3912e8fde332b~S9vGgtBJn0530505305epcas5p4l; Thu, 8 Sep 2022 18:45:30 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220908184530epsmtrp17dfdb0d12ee939ecaccfc477c79c1801~S9vGf7pel3080730807epsmtrp1b; Thu, 8 Sep 2022 18:45:30 +0000 (GMT) X-AuditID: b6c32a4b-e33fb7000000d32c-ce-631a384ac589 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 24.DD.14392.9483A136; Fri, 9 Sep 2022 03:45:29 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220908184528epsmtip25070875fc57a0e6c730b79be13990e6d~S9vFDM6w41574515745epsmtip2S; Thu, 8 Sep 2022 18:45:28 +0000 (GMT) From: Kanchan Joshi To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, asml.silence@gmail.com 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 v6 1/5] io_uring: add io_uring_cmd_import_fixed Date: Fri, 9 Sep 2022 00:05:07 +0530 Message-Id: <20220908183511.2253-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908183511.2253-1-joshi.k@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFJsWRmVeSWpSXmKPExsWy7bCmuq6XhVSywf4eA4umCX+ZLeas2sZo sfpuP5vFzQM7mSxWrj7KZPGu9RyLxdH/b9ksJh26xmix95a2xfxlT9kduDx2zrrL7nH5bKnH plWdbB6bl9R77L7ZwObRt2UVo8fnTXIB7FHZNhmpiSmpRQqpecn5KZl56bZK3sHxzvGmZgaG uoaWFuZKCnmJuam2Si4+AbpumTlAxykplCXmlAKFAhKLi5X07WyK8ktLUhUy8otLbJVSC1Jy CkwK9IoTc4tL89L18lJLrAwNDIxMgQoTsjO237zBXrBYqGLywvWsDYzT+bsYOTkkBEwk/k75 y9jFyMUhJLCbUWLh989sEM4nRomTWz4wQTjfGCVuX5jDBtPSeX0DVMteRomfR3pZIZzPjBId 07YAORwcbAKaEhcml4I0iAh4Sdy//R6shhlkx9sbjewgCWEBD4k5n06zgNgsAqoST9r3gMV5 BcwlHtzfzQ6xTV5i5qXvYDangIXExS8P2SBqBCVOznwC1ssMVNO8dTYzyAIJgVYOiS8f70M1 u0hsWfeACcIWlnh1fAtUXEriZX8blJ0scWnmOaiaEonHew5C2fYSraf6mUGeYQZ6Zv0ufYhd fBK9v58wgYQlBHglOtqEIKoVJe5NesoKYYtLPJyxBMr2kLh3fC00FLsZJRZdn8s0gVF+FpIX ZiF5YRbCtgWMzKsYJVMLinPTU4tNC4zzUsvhMZucn7uJEZxItb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LyQQHpiSWp2ampBahFMlomD U6qByTVexPeGvn2jsf1aG7FPUTb8X/I0OHUO++V9v+WjH8xaoyKTbvk8VlrgaFLD++X2E69s uWLw03tTAJfMi9+aPS8X9wr6pngcWOBRN9snpX+W8PmONW83Wp0KO/+1X37ytbmdR6w8smZ9 PbfMYcPZy6zbTR4EsxtzWYfus3oce/DG+i+9j8MqFykocBf/cU66fNY2tVWcWcn3+9JMk4th Os0f8k4l/RHZ6XXFZ+Zn311eq1snZG9KLbvff0eVY/2tk1tlN139HJT2LIhr0+Mle+N39V3Q m5km+P1BxvNtjPzOzHVR0ts0Gj1XJvXs9sl2dFU62PL1SB4DN2ulT25Jy7aZuqYOH5fPud4h 5nBbiaU4I9FQi7moOBEAWyGDxPACAAA= X-CMS-MailID: 20220908184530epcas5p44d67b682ee86fabbb3f3912e8fde332b X-Msg-Generator: CA CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220908184530epcas5p44d67b682ee86fabbb3f3912e8fde332b References: <20220908183511.2253-1-joshi.k@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@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 Reported-by: kernel test robot Reported-by: kernel test robot --- 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..202d90bc2c88 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 +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);