From patchwork Fri Feb 3 15:06:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127843 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 755A1C64ED8 for ; Fri, 3 Feb 2023 15:07:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A0E16B0081; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7636A6B0078; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00F186B0072; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A3A9B6B0078 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 796EC1A117B for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.19.602C424 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 6BC9C160004 for ; Fri, 3 Feb 2023 15:07:46 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=aF5Qbqrg; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=neHZEfucv6V0EipL5P1bge3El4tUADkTXXxhpPC1WOodWhuF2z7VvLl9KeZz6mZqYg/PQy QECL2ma9YHts8TTUmoK5vMAuFhJ97g1NVj1xX1OtMv3CEyVneEdmngtYS6M8JuQpfBVnWY rKsgF/ucrZh4/YwOz0RffEo7tEVNf7c= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=aF5Qbqrg; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+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=1675436866; 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=qOELs8Cf+3DRHH4YZ5i8Y7BY08du3RSg74OTiYB5sHQ=; b=buuJLz29Rs3ukaqNjoiyepiu8az86W0RMHjDDrvKxXQGTdTY6b1jfCEfWK22Pa9tJjjRVU yZLwDQ7IrpbJLf/nPkQLQ/IuYZ/XggOGoXCrQBDLhaOiW4//o67YgGaLyYHgptIlmMO2vJ jbyFRFk2ziF4FkgTt4w7id5rxaR3t/4= 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=qOELs8Cf+3DRHH4YZ5i8Y7BY08du3RSg74OTiYB5sHQ=; b=aF5Qbqrg1yclOtyaI4gTKBWydF RggQAyGRBco620c8Fi869LlPO2pe8evEIqDoV1ozOXdNfytn1MRinE/6QYY5k2oPlPJhB01no6VtD eldvco5iwWgUqJuF6Ln9UEwZNa6v1GVbT/6Kwoxq6v6E47EA3+X0x/5UWmfkwWrsPlCary6PtwIur 8CI+Wl9GP1YyGgxKum6MPQS4lap8xnIx1Ov95K0LpqVrUkLoMLragJkM0cWq7Yw5U2U5JFh4+zQgw adzFS91VzTwjl1q4AJys+nyWOqDq0dqD/Ug/qOVE9Xw8ZapK+WSEj6v0Tc7w/kwwgNzmawXYW/9S4 JiaBbcyQ==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeR-002aju-IY; Fri, 03 Feb 2023 15:06:56 +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, Johannes Thumshirn Subject: [PATCH 06/23] nvmet: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:17 +0100 Message-Id: <20230203150634.3199647-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-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-Rspam-User: X-Rspamd-Queue-Id: 6BC9C160004 X-Rspamd-Server: rspam01 X-Stat-Signature: paeqp5uztmezotemkn3zzgcznydihgf4 X-HE-Tag: 1675436866-997318 X-HE-Meta: U2FsdGVkX19xMOPhvcnY1Us78CONrDLIpSfnlPYdTOQqWki6+FVvVp+NYS1ff/iYYAjRo+xs7zlQAn+MhL6alfG9nvq3th3di9jXqqXTMiLdIu16ghrT9Jg9ZGPt4VpOTrBWWs8kQgkZzmTW0otFe+O6bxmXyTW5ghsttsMTyS/PrpI03Fa5xxOVwC96mun91ffd1Lf5lMlV/g+GZ3XRLBBm1h74TjiPNfY0Y0IlVLPcejLrz7l+iP7loO9bBPzD2R4hfS3llivP5pLC1WhpcnGIVpfmNJhVdB1yzk1jmpxNONeS3yTL515W+K3hWsGaUAXc8eQevrcXBCjgWcKgjjmuY6TPRRRQTlnH4aZujNG/oZ0zpJbKcrlgjj9LT2LvM9X8J1B0GLsESHNXztPVB421LPXtvUeBztq/7Hj1AUimhXUirMOW/jpaaR7VMvn44bb/UeO9nS93gcXSP2hm7x1mdVlzxNn/bvjOrZCXF0QRKT68dchJr4S9jPXFf3v5NUo3G8yTWBnKjagx/YFtHRtsw9meDt5zZVygvEY+aYJLlthKqslqftrRyGObQOGeGX4LC5yRT/7+A4Y+ceCOc12xYw/FwPq2ZHNlfsUPQhXppdy3M/Jn6HCSD9jtu7QktaWYcOQNOqnUGiXVQR+H7D/AOWq9fFSNUoI1aYjm7CEmIfPAVYnp/7CQrYJ4yOF4poAYGVDgyefWj/CHSnJFVUPxOjEOl1ipofolzQ4VEfNuET1fgSiHSDi/neDuu57P28wFLbJzEZAP2zHjReRJvSiWJcz2z14Qebg1qfOlEpWfrHJ+NP3BGcjkGAyDYDKk8M7xmw8j/Hk7Lu+I8XzoIQR3HosnmCPhE8R6HtJYoRn9SJRXOCXjnf8skd/Gfc6/pn0Wi2FB1rejkrxeCbqZHiFOQAx1SlnHes8e5q2CFT/Z9DsCmeZII6MBF98TxPco9xk2NLpJuVWhrwgk2OF tDLNN6no M1wquF/BR4RX7fNDASBUEEr8khEMHZPO0WdUr5BPoPexjCIZrJoSG2//0cEryf70M/Fcgii0YoMYUpCfv0/OTVU3/XDolc0dD6ZZwWZrwlL3vFmcyi7KCb5UQCH30McBo4F/9xF0ETNK44sQfcNpzvxagqSqophXAU0yDDXME7gpR5ntip+BxLcUyEPjhDJxRuAYesTS9O7rbAnmar3Oc9X1Xdb4Mz9PQfzHk6QCANaWSA6m8ia0Wz8Lve9JIY2OZEa0rCYPFJoDEKVSc20ugYIvzEvuUgxVRRvwa5HR4WpRHnxH6yCvLF7fwD+pk6TzKH11IubikWWv4TGewaIkcyyqnpZ4eHT2tK5MjYrP2kIcBUGpISRAg4kBYjRNJ2NkflpmQyuIHx9qhsc//i2N+kd700Fao6szd0SdhG2Nj7KNk6kWat4iFSILs7NmT9/LTUwgGLFvxQMQgDpzMnCaLKQmUo0lNAzU+kaZ8zik2FSDx93fH52tEfDc7/vcW+airLb16hDFVBJRMyweTJY0z7bkHUPei/x1WQIqlvbXDaABzEU5pyGC9S3yo/A== 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: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- 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);