From patchwork Fri Sep 30 06:27:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 12994986 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 1F940C433F5 for ; Fri, 30 Sep 2022 06:43:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230346AbiI3GnK (ORCPT ); Fri, 30 Sep 2022 02:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbiI3GnG (ORCPT ); Fri, 30 Sep 2022 02:43:06 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5821664B7 for ; Thu, 29 Sep 2022 23:43:03 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220930064302epoutp03280f767f25ae8ed4db14daca7f992774~ZkElfpqyU2454324543epoutp03c for ; Fri, 30 Sep 2022 06:43:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220930064302epoutp03280f767f25ae8ed4db14daca7f992774~ZkElfpqyU2454324543epoutp03c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664520182; bh=iirM43BcaFmNufDrlcC4cnJ4qMGLT6ODyYNtDEbayfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udMfmdNy3h53CYy1rL82WFdN53ocdsR3GvQ75vBpDmb2uWwvCumPCZtJXP7tzrczb AJ5Kg2mpvj3wJD81VHpVOaiz9dkWtkCXicY6B9Xe3DnumeRhY6fZVfdB0wnQO2nXak Tpyl9fZNYXR86oYT/d/Ip72Vbxmd4jIh0Wbkajrc= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20220930064301epcas5p470c8c3a98d97db4ffce9fc1b004f520a~ZkEk94old0991309913epcas5p4G; Fri, 30 Sep 2022 06:43:01 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.178]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Mf0zR5QcNz4x9Pv; Fri, 30 Sep 2022 06:42:59 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id F4.81.56352.1FF86336; Fri, 30 Sep 2022 15:42:57 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220930063805epcas5p2c8eb80f32507f011baedc6d6b4d3f38d~ZkARgs2-G0421904219epcas5p2J; Fri, 30 Sep 2022 06:38:05 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220930063805epsmtrp2029d4b9faa8809abbf41e4dfa7a134c1~ZkARf8VOj2166321663epsmtrp2N; Fri, 30 Sep 2022 06:38:05 +0000 (GMT) X-AuditID: b6c32a4b-383ff7000001dc20-8d-63368ff14d90 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AA.59.14392.DCE86336; Fri, 30 Sep 2022 15:38:05 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220930063804epsmtip2eb631af26284418926a8f1c7d83a45c3~ZkAP-bYK-1483614836epsmtip26; Fri, 30 Sep 2022 06:38:04 +0000 (GMT) From: Anuj Gupta 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, linux-scsi@vger.kernel.org, Anuj Gupta , Kanchan Joshi Subject: [PATCH for-next v12 01/12] io_uring: add io_uring_cmd_import_fixed Date: Fri, 30 Sep 2022 11:57:38 +0530 Message-Id: <20220930062749.152261-2-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220930062749.152261-1-anuj20.g@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEJsWRmVeSWpSXmKPExsWy7bCmlu7HfrNkg5MneCyaJvxltlh9t5/N 4uaBnUwWK1cfZbJ413qOxeLo/7dsFpMOXWO02HtL22L+sqfsFt3Xd7A5cHlcPlvqsWlVJ5vH 5iX1HrtvNrB59G1ZxejxeZNcAFtUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5 kkJeYm6qrZKLT4CuW2YO0F1KCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnAKTAr3i xNzi0rx0vbzUEitDAwMjU6DChOyMJ8cnsRT8F6zYPfkyYwPjT74uRk4OCQETiV+PPrJ1MXJx CAnsZpR48+oFI4TziVFi59LrUM43RomeI2dZYVo6d02FatnLKLH+yDqoqs+MEo2T2thAqtgE 1CWOPG9lBLFFBIwk9n86yQpSxCxwk1Hi0N5nzCAJYQFvibZP71lAbBYBVYmjj7rBbF4BK4mH B56xQKyTl5h56Tt7FyMHB6eAtUTzohyIEkGJkzOfgJUwA5U0b53NDDJfQuAvu8StNT+YIXpd JBqnXmeCsIUlXh3fwg5hS0l8freXDcJOl/hx+SlUTYFE87F9jBC2vUTrqX5mkL3MApoS63fp Q4RlJaaeWscEsZdPovf3E6hWXokd82BsJYn2lXOgbAmJvecaoGwPiR2TnkEDq49R4vPdvywT GBVmIflnFpJ/ZiGsXsDIvIpRMrWgODc9tdi0w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piZVVqUX58UWlOavEhRmkOFiVx3gtdJ+OFBNITS1KzU1MLUotgskwcnFINTIeO sd4r/tv9Wb/hVeLbRS8LLwpksb96r230Kv6IqX7CxKk3bqqL/D1S8niDipN70fMe6+0zVvpx ZSwRExeyTn77Z237bTMG/vcHPFdPPzjlc9eGZY7/+3p/enSp2K1T4bMx5AkWXZV045xoRLbD KwltYXVJq2PptsK/qjiWNkX9q+ZT3cFp+2K518pbm3dpaW/bcOvDIj8Tc84lMjmM5f5yKWeu 2754FPDF+tNymzWGjCJfZ4d93bLybr/qycbnFtPPZAQUHsitM+gLjyy8UahTrL3Ra7qxEd/0 4rUHb3XGdkS+Mv3CuvLFFbEUvQ2pmt5/X+28e3+y8GveQrnVis+mCkx+8/wlH1/qpW0bbJRY ijMSDbWYi4oTAYjiMrzqAgAA X-CMS-MailID: 20220930063805epcas5p2c8eb80f32507f011baedc6d6b4d3f38d X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220930063805epcas5p2c8eb80f32507f011baedc6d6b4d3f38d References: <20220930062749.152261-1-anuj20.g@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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);