From patchwork Mon Jan 30 09:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120638 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C28E7C636D0 for ; Mon, 30 Jan 2023 09:24:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E8066B0082; Mon, 30 Jan 2023 04:24:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 595CB6B0083; Mon, 30 Jan 2023 04:24:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E8B56B0085; Mon, 30 Jan 2023 04:24:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 307D16B0082 for ; Mon, 30 Jan 2023 04:24:10 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 00E47C035A for ; Mon, 30 Jan 2023 09:24:09 +0000 (UTC) X-FDA: 80410929060.12.6742460 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 45092160007 for ; Mon, 30 Jan 2023 09:24:08 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=OgkjW81T; spf=temperror (imf08.hostedemail.com: error in processing during lookup of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org: DNS error) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070648; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XDfcoA74qOtLlz6Ut59rzJtve2ldu9xHyLCMcbUY/Oo=; b=YPR3Zk175UPE6r+WWFCdE6g5HrxEoytbc1p2w/ZnezRGQCcBmpoUxdI7lbVF/Z0ItzTU+r SBbrwBmaEGQm2Fyng3cuUeBCjvIAu3YFMiAOObWOV+rWXUdkGijQky8DIhf/NayJgwcGDo qIYLB9XJlkawgtWOvq+63NAk8YDYjRM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=OgkjW81T; spf=temperror (imf08.hostedemail.com: error in processing during lookup of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org: DNS error) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070648; a=rsa-sha256; cv=none; b=ALbMMepjIFcDvqMM/KxiXcwFYEy5Jrs6r6ZcDwxoRH1JT66a6OxfOS9fSyGLHt1LPEOfY7 vv+yXktAp0tvzgh1EuSkpAGnv8osxfRS90LbBJ3Vj4iIUDwJ11FK3L+Gq2S7vkYGszA+ZD UW60Y7tgkeuU5HP8lgIRETsiaII3z9c= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=XDfcoA74qOtLlz6Ut59rzJtve2ldu9xHyLCMcbUY/Oo=; b=OgkjW81TDHvAcnBp1OyM32+W/S 3oA+IGAhTs4+vZdR/o48Ij+SB0Mx1Y/QS9FiMH5r84BRBLpL/54HGso+aZEzF/84bkUbwuofGhP7Z nvFOcSmHAH/LO0aV6yY2v7BtwuRJLG2rvOazlNbKJzjMoUmEfeQYI/KlAPPTEi4RauZOurW6Z894Z vUKafSeqW4KYNjJqh0g7kW6030Q/kKV4JDyv9GqmHEnrdZ5A9nelGsxZrulz41/x4viDOTYLmTnqb 4YEgYRA6fqcF5fWbjr/HLjzA4an+c08QAu/9E2twuy65Arpumtz7RfapltAv927tfRdBiz0p0pZCH jyUloR7g==; Received: from [2001:4bb8:19a:272a:732e:e417:47d7:2f4a] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMQMq-002o52-VT; Mon, 30 Jan 2023 09:22:25 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/23] nvmet: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:40 +0100 Message-Id: <20230130092157.1759539-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230130092157.1759539-1-hch@lst.de> References: <20230130092157.1759539-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 45092160007 X-Stat-Signature: ga9wsmnzawkq36pn9mgde1kkzt3xdogf X-Rspam-User: X-HE-Tag: 1675070648-198661 X-HE-Meta: U2FsdGVkX19hl+FQyB6UQ9BkkU/HiluzeG7ZnAj89Vy+LJqKa125HmJSnI7d6wUv4xi3DAxASZ6EE0Mso3/tCnqQKZQ5siKLyNPxiuD+0mfITb1yHv9r0gt2KC/WPa2baaoqQrb1WFkqQxyiAselh7DHdHH9k6hOLtBviDyoYY9xVlP79MvPkily+uLKzLVJA+2OVu6JLxEQJuEoGp1mXsc7rmJGZ65lgL1x6347AheD/JKCXL5hYZeWmvk0gTc5hhfSQdGa6dqqnQ1DNBNTyZIDfEr8YC7UgZ/t5rPu+XATsXAYT90UXd+CQ9p0BDL5/rPsCXseCny2bUHPjnQqB77N3FmSsV+WiHCpYj84MPm1xFc+dBEY0KyXRERmEqSf0Pdw6PIPZH1VwEOeVa0ec3O1niRHYe7nKxbh6sDojdR2D0Q0g2egpGFX0fanTR9pxx5EGLx8rcSYTobjQlxRmayJd0Nn0fPr724BmVm6oXadaiq803c6IgVKxVyXjOmz5mBeuwpubRm9u1M6J3yIPTQLCbi3+JyG51XcpEUy8Dm3QSY1lESrNSY1TtRZKYoPJE2DhSfpHgaLoN3XbmWzlvZWd6t3z4DwcLNjrNRB8h7LmS97FmkMeSgpJkhPGkIkU9v94YBxSf6NEJOQ80K82TL6DC5xHGxAa/npemIOA7kTiRQ4YVy8x8D2ZeLcny3KkjhS0dXEbgWi8WMX0t3J6eM3xR5pMDc8h5WBGB3JUESCijVjPD17s1FMRrsnkeutPQLM3WZdXxQUmWZ9aOvhsoInHZW9M81Pz8r5TfKoAq4V1LKvxzcJzzb5kquXz7acpTZr3D4A4NdcwUWE/NEO5jO/ZMjgcE5LNs2oYxCCSJtW/Deq151dXhnWEhh84fQtaNQjGsq1pbXO8k45CxEark1sPtEpaX9SZvIrlo2XdVAPhMKIyLar+nFNu/LT2iNOU3edHZwML9MiL3EleuC jak5fwK1 XVy1awuNa/4G3Nf+/d3DFCO54SvylPaT2cF+UykhZ4wa33vWjesjiYZ8AVYc1NmJGAeTWWjPzsDmO2leNWNJQh4JgotcPh/+uH9r8ImrLEBPxL7GVUvprKkD0MJXOc7fw0El1b9uO35kN2Km/r9YYysnr6CrBLw9xqNtWFMgUGXC74RbEPTT74qN0LNqnDfQ0ffylelITEx90Xr7dB28oe7doZf3aWnc1+ZEcHj2E32tRRlSD2idV+2KKcgs3TTJ0JmauKjXwq/dwJvzXVjO6tJ++aDEk9f4dAnHvdu00ipE+UGbS6QCvKnbb5xmn+yIt8CZUAcXMwEmMzimIZkywhNvh0aMXvpFopMHYYi2x4+eqfsxLjPLs1jbnbmHXBB2IK3eGC/2OMPEUQpLb0vmmAnFpVEe7YDRZVVuTELPM5WQ0nJuSkgcQDYrCjydBKKIvrEMq0bLO5EdwyF3R3SLYj0a7Q0sb9lN3bjzwhYjxVp5bS+nFdpcOKvPrMA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/target/io-cmd-file.c | 10 ++-------- drivers/nvme/target/tcp.c | 5 ++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index 871c4f32f443f5..2d068439b129c5 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -73,13 +73,6 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) return ret; } -static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg) -{ - bv->bv_page = sg_page(sg); - bv->bv_offset = sg->offset; - bv->bv_len = sg->length; -} - static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos, unsigned long nr_segs, size_t count, int ki_flags) { @@ -146,7 +139,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags) memset(&req->f.iocb, 0, sizeof(struct kiocb)); for_each_sg(req->sg, sg, req->sg_cnt, i) { - nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg); + bvec_set_page(&req->f.bvec[bv_cnt], sg_page(sg), sg->length, + sg->offset); len += req->f.bvec[bv_cnt].bv_len; total_len += req->f.bvec[bv_cnt].bv_len; bv_cnt++; diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index cc05c094de221d..c5759eb503d004 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -321,9 +321,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) while (length) { u32 iov_len = min_t(u32, length, sg->length - sg_offset); - iov->bv_page = sg_page(sg); - iov->bv_len = sg->length; - iov->bv_offset = sg->offset + sg_offset; + bvec_set_page(iov, sg_page(sg), sg->length, + sg->offset + sg_offset); length -= iov_len; sg = sg_next(sg);