From patchwork Mon Jan 30 09:21:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120651 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 1FB3DC61DA4 for ; Mon, 30 Jan 2023 09:25:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 343F06B0073; Mon, 30 Jan 2023 04:25:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 236E36B0081; Mon, 30 Jan 2023 04:25:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08A9B6B007B; Mon, 30 Jan 2023 04:25:23 -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 DE9646B0074 for ; Mon, 30 Jan 2023 04:25:22 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BAB9CAA9CC for ; Mon, 30 Jan 2023 09:25:22 +0000 (UTC) X-FDA: 80410932084.17.FDB1626 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf24.hostedemail.com (Postfix) with ESMTP id 03836180018 for ; Mon, 30 Jan 2023 09:25:20 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=IRSYebu9; dmarc=none; spf=none (imf24.hostedemail.com: domain of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070721; 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=r7jFBCXbmxHB1tF8rt2BfZdisYi7y8611NyO0C6ZBqM=; b=SsV8sG/mPze3p0UwOiKpKDYZRNrUuFPa4tnkYeM0nvaEKQeV9CLvZiSKi+isdkHLdoDVDb lp0yE2P+O8HSTOw+NoIw55R4zflV4g6cJPb8bsRAG7ZZHv0Mfn95xQ5fnC4fRPvQnRYf7V pCsmUm6A8YMXLtDDYw7whgUNNVF9k8Q= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=IRSYebu9; dmarc=none; spf=none (imf24.hostedemail.com: domain of BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+3ca177389f0c7d0d5156+7099+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070721; a=rsa-sha256; cv=none; b=vG4OHG5pMZbQtCJdiLbzM3LAvbKNNICetgQ1oJgYZaY40BVJoXir2ms8DskzyrHx1dWL+r am1nILZLaz+0nrG2+0Vsbrf9se3g0pse109pmH3X2HxXf2JktVmf1rIMJx1bKAlUmTNa/W MwKtRRzMGM/m1EjL0VhZclERGMsj+Oc= 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=r7jFBCXbmxHB1tF8rt2BfZdisYi7y8611NyO0C6ZBqM=; b=IRSYebu92JqOTv8A5mkBlrCJoU soqPVK3Q3WkIDPk0g1kKyJ8lqXShiaM4/uHtHGG+1H107BE8gmKRpIIHCeQdhH3yGUk1mhuEMbGqS baor0Kd4SALd04/vAAxXA60oYEXu2Jz5URMvT1YHH/GGgw9NS5aIlUfmZPD3e3UYOtp8ZNZizARPL PCly0wXJiyK36Y8TqZBCQfpuFH9GgRgaKB5RmeGHQsLXp1ro2vk9RL5YGcyiYBzwL2h2TbxSKSJmK lespJWt10vPATdlaXFSrA72u2w5+VdDl7LSkRtNNhIcAgcJ1n0yVJSCb0YY+Y5AGY76RVoE4lzhaK SW038nYg==; 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 1pMQNv-002oS4-LT; Mon, 30 Jan 2023 09:23:32 +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 22/23] vring: use bvec_set_page to initialize a bvec Date: Mon, 30 Jan 2023 10:21:56 +0100 Message-Id: <20230130092157.1759539-23-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-Queue-Id: 03836180018 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: og4kcyd5ggppby7ab3t7npihrnk19nz8 X-HE-Tag: 1675070720-176803 X-HE-Meta: U2FsdGVkX19DEB5ZwgGA5pOx5/0rzRwVKif3VppR/vqPtdFjRGXP9jzg+C+YTSC6T1pnMqaD3emwE428dLUMkTsRzjQnYJHLYZHPO+FOyTEOFSVuI4BJFoxKZhwGmcCtXeu/ftLzBWUHjGQSOD+N7cEW1vLgI5vEiAal8ZU4+AQr9LgFZEb66jzy/K0Y7gR5fHAU/ICGhgJtecBPgaNDtnKdtU/gNkuDzHIWq2lixSr/Xk0HTsnf6Plw9I1c3xGgdJYSb5m9jx7myAuJhyf8dprGsr7vabL6H9gg/cJI7SpjuI6o+w7tzAyJ7IGkmVNilWvERq9JZq85+Fn7x4POumI7K6fbcQMKeD0pNIotT8WVqks6a39C9ZqVCOHzJqwGgkXs4mWfQps/lZn6xSlaY3TjKj31r2S3ecrKXcklNwR2TzeKN6Ie1f/jHVZX7YPlOPkH3XQO/LYZbw7UeCdwGfy6ZISHBkctR0qkfm8IIXB6Z5gXtsxGA5xfSawbHpt5/GgRaAIXBSx8O3RLl34hNW8yc92g4Icpf+YPdmuhoxWpC0oOER+gajRBwvvzkq4mWGP4Qw/TOvEdN+vEHdr2Re8SZM2MAfEhif+8qrpMuZTdtF9gAoijsSrEbkHAxRTkYRVbUt3bcD/GA7D+ve2uSOHAMyHgDlOi16e9uVslUvQodfgDnX8no5HTKOn8G7l0HrBVCqe2hllgs5BFq0A472E13pjD3820RnmZjeqcZIYBDWsChutAlk3is92xNZv7tmEdnFR/HTtOyiXsEWYmHN5CynxGXQcTlltw4baIDOBz2MRpl7b3iPVO4TezedHJrYLH1FUGshtPdlD2eodj8refAvnXzODU4GX0CwbfjIKnGM2NlrOnT1C1+3KcRv2k+TO1TVcVkG6uk6hTL77pghtzvmW46k90TZKn9S8vH9ZvnPWI3gSEJUpQd+cQESBVK8pT8nn5VVKwpCA9bH1 GoqgTneo JDP8emQDB3L2DaCvT2UBp2ktYcK4nMrhYjzo5QubFlZO+/1lrs4odz9+law0mOuNPgYvVlm8n0AiRm3TBCVFPDclN8x8NHuECXJ3Jt4YEoOcPr4aqC6j8KWEIu92nIhQ6ok0vn0dGyLczNOHHFQpAGMVnz5MRsHLmlyx32sFpDyrf0D1XYIHw9GM4SeGSh/EUqMqPqijWbQyMEP24XlFtfeBZHknL1XDkkUFNIMEY5Aa+xL8SH4kL+Z8Pacd+Pgjw3YGatBtCxRu40gdAKQ1g3BWqjoULBYqbxqTUAcGlrmg2q4Ch3mf1d9aLRkiIFO/H6IjAE/dlfpEdktbvzIH6iBdB91LOx03CSSwlFJV693fRPrJ7ancrUDEwFWueAVOognQWQnYfiugdwHpMJqtFFnmXzD7l+5RUOy/4kyjmN0J7y7EkLiTYgRl3T1x7rqs2uh8L353YnghNT5zlU4PfbYt49jc1FNulgfoS 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 a bvec. Signed-off-by: Christoph Hellwig Acked-by: Michael S. Tsirkin Acked-by: Jason Wang --- drivers/vhost/vringh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 33eb941fcf1546..a1e27da544814a 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -1126,9 +1126,8 @@ static int iotlb_translate(const struct vringh *vrh, size = map->size - addr + map->start; pa = map->addr + addr - map->start; pfn = pa >> PAGE_SHIFT; - iov[ret].bv_page = pfn_to_page(pfn); - iov[ret].bv_len = min(len - s, size); - iov[ret].bv_offset = pa & (PAGE_SIZE - 1); + bvec_set_page(&iov[ret], pfn_to_page(pfn), min(len - s, size), + pa & (PAGE_SIZE - 1)); s += size; addr += size; ++ret;