From patchwork Thu Sep 29 12:06:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 612178 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 69563C433FE for ; Thu, 29 Sep 2022 12:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235541AbiI2MZH (ORCPT ); Thu, 29 Sep 2022 08:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235585AbiI2MYx (ORCPT ); Thu, 29 Sep 2022 08:24:53 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1CD126544 for ; Thu, 29 Sep 2022 05:24:48 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20220929122447epoutp045a43bd480f11e2bf2f6355e85e327ea0~ZVFsDPYuO1163411634epoutp04R for ; Thu, 29 Sep 2022 12:24:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20220929122447epoutp045a43bd480f11e2bf2f6355e85e327ea0~ZVFsDPYuO1163411634epoutp04R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664454287; bh=kslegbVgJtIIf+TJbQuizRtJPWkwJq7sepMKs3FyoAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a6k9gGdBj2immi03/ArMkQnKrm0sMHHyoTTPR/5EIBMes3qy1RHroCRgjCo0/d/MP 6a5FQ5bpDM6z27FwZzyC1DIXpBtZaeGOqH2/B0Nl4MtcWoElOU53huwCuDhh1nZmBL SddZk+2cm/Rrv3SBJe01V4XCeFvWFzXKa139SFFo= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220929122446epcas5p2353f2f2284a5c794ab883c28b63ea082~ZVFrlMHKe2510225102epcas5p23; Thu, 29 Sep 2022 12:24:46 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.176]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4MdXcD13mbz4x9Pp; Thu, 29 Sep 2022 12:24:44 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 27.43.26992.B8E85336; Thu, 29 Sep 2022 21:24:43 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20220929121715epcas5p488759f34f6e55d940c6dca523e24f464~ZU-Hb9wl03132331323epcas5p4J; Thu, 29 Sep 2022 12:17:15 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220929121715epsmtrp1cae91d15790f2c4884ffe2d3ef5f48e6~ZU-HbMwLp1820918209epsmtrp1_; Thu, 29 Sep 2022 12:17:15 +0000 (GMT) X-AuditID: b6c32a49-319fb70000016970-a4-63358e8b83e7 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B9.3C.18644.BCC85336; Thu, 29 Sep 2022 21:17:15 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220929121714epsmtip1513c033d52b1dce33f68bee347e1822d~ZU-GHrcqK3029230292epsmtip11; Thu, 29 Sep 2022 12:17:13 +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 Subject: [PATCH for-next v11 13/13] nvme: Use blk_rq_map_user_io helper Date: Thu, 29 Sep 2022 17:36:32 +0530 Message-Id: <20220929120632.64749-14-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929120632.64749-1-anuj20.g@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHJsWRmVeSWpSXmKPExsWy7bCmum53n2mywe4TWhZNE/4yW6y+289m cfPATiaLlauPMlm8az3HYjHp0DVGi723tC3mL3vKbtF9fQebA6fH5bOlHptWdbJ5bF5S77H7 ZgObR9+WVYwenzfJBbBFZdtkpCampBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam 2iq5+AToumXmAJ2kpFCWmFMKFApILC5W0rezKcovLUlVyMgvLrFVSi1IySkwKdArTswtLs1L 18tLLbEyNDAwMgUqTMjOaD0xibXgBWfF2xf7GRsYf7B3MXJySAiYSBy8vZS5i5GLQ0hgN6PE sp8NbBDOJ0aJfR1dTBDOZ0aJt6ePwbVsPfweKrGLUWL5kVcIVWdPTQWrYhNQlzjyvJURxBYR MJLY/+kkK0gRs8AmRolf148xgSSEBdwlNm+5D1bEIqAq8ejtG1YQm1fASuLFzpVMEOvkJWZe +g42lBMovvjaHKgaQYmTM5+wgNjMQDXNW2eDfSEh8JVd4tKHJhaIZheJW8+OQ90tLPHq+BYo W0riZX8blJ0u8ePyU6hlBRLNx/YxQtj2Eq2n+oGGcgAt0JRYv0sfIiwrMfXUOiaIvXwSvb+f QLXySuyYB2MrSbSvnANlS0jsPdcAZXtIHGzZDQ3gXkaJcx0PmCcwKsxC8s8sJP/MQli9gJF5 FaNkakFxbnpqsWmBYV5qOTyek/NzNzGCE6qW5w7Guw8+6B1iZOJgPMQowc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i3clRk0SYV4b kPrVI2qif/GzhKa2z/qCC+vU0/9P+X7tZfBhzz7f3fdymnR0lMT+FudO2vD0evUj10kvlstX /5Hp/emSafP2icr2ZXttjx0P19TLnCPTn/tBYuGWxI9GmtY7Z3IdWGmj5jnVb9+phf8CFWt2 xfNsU/dd8SdePqqf9XXv0gD7g/Jzbs1a1+uzW6v8xWXJxOmTt329fe36jlX9Wx/yJq3R/1h4 5Pz/VaosB0+YrNk2d8H2bdwienN7J3bvXNkrzLJQtC8gKbfP8dpPx7Kf9esveBSJX5Tlm3P4 a87j9IBnqp+bmk4HcDR/fPrw4W/TaP+tizZmZDtdyxWIFGsvn39A8k/I/AlJvkosxRmJhlrM RcWJALotnFDlAgAA X-CMS-MailID: 20220929121715epcas5p488759f34f6e55d940c6dca523e24f464 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220929121715epcas5p488759f34f6e55d940c6dca523e24f464 References: <20220929120632.64749-1-anuj20.g@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org User blk_rq_map_user_io instead of duplicating the same code at different places Signed-off-by: Anuj Gupta --- drivers/nvme/host/ioctl.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 25a68e8c60db..a3f22bbe511a 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -106,21 +106,12 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, if (ret < 0) goto out; ret = blk_rq_map_user_iov(q, req, NULL, &iter, GFP_KERNEL); - } else if (vec) { - struct iovec fast_iov[UIO_FASTIOV]; - struct iovec *iov = fast_iov; - struct iov_iter iter; - - ret = import_iovec(rq_data_dir(req), nvme_to_user_ptr(ubuffer), - bufflen, UIO_FASTIOV, &iov, &iter); - if (ret < 0) - goto out; - ret = blk_rq_map_user_iov(q, req, NULL, &iter, GFP_KERNEL); - kfree(iov); } else { - ret = blk_rq_map_user(q, req, NULL, - nvme_to_user_ptr(ubuffer), bufflen, GFP_KERNEL); + ret = blk_rq_map_user_io(req, NULL, nvme_to_user_ptr(ubuffer), + bufflen, GFP_KERNEL, vec, 0, 0, + rq_data_dir(req)); } + if (ret) goto out; bio = req->bio;