From patchwork Fri Feb 3 15:06:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127851 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 4C995C64EC7 for ; Fri, 3 Feb 2023 15:08:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBC296B0071; Fri, 3 Feb 2023 10:08:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C440D6B0088; Fri, 3 Feb 2023 10:08:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE4406B0089; Fri, 3 Feb 2023 10:08:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9C0066B0071 for ; Fri, 3 Feb 2023 10:08:16 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 46B24161188 for ; Fri, 3 Feb 2023 15:08:16 +0000 (UTC) X-FDA: 80426311392.02.27B48E7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id 5073820027 for ; Fri, 3 Feb 2023 15:08:14 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fnp2jdWY; spf=none (imf03.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=1675436894; 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=NE7sXkVgEfW+BeR3L//yGcuDdB7IsjAlK/DMIBSqu7s=; b=UpW0fHlGGzneq+gUPq89D9BxJBsw1aY8Somo+KbFUFVAZ4klakzmNkTarpQZkYy73rYn3E u4VCEaks0s4Dx33zMyQMEnmYMCsLyC8kanja4Ex2BXDZMzDi5juL/fdivhHTArXNjvCr0m Vpr+JWmmNtHFV7ieIC4MYsbyzXZNL2s= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fnp2jdWY; spf=none (imf03.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=1675436894; a=rsa-sha256; cv=none; b=J4j46f+oDImwd6zxNqxtLRHGAIcn6bidK4pUt5W/We9yNRcfDTXPgczEEHREHlqPqTD3Gl Jz/h4RHKXJbQBPeiSjsESHHm4CNBdk12C2zlH4jOFwpgAjKd+cQGIYhJDlqNqLxFfgSny+ oRPGm9eAaMDN9ppuOrJkN95uzlzqeeo= 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=NE7sXkVgEfW+BeR3L//yGcuDdB7IsjAlK/DMIBSqu7s=; b=Fnp2jdWYwTMeXbFAtIvQJYNyQa WjxRrbcqlA+uZSnkDXcvF3dawsJcLTYFwDLsZpSEdD3p0mAI5oPEH0MgdQwtTmcsdRUlT4/hPTTNv 5W2SQzUVH614kF+/yXtuNxk+euPwDwTlrNXF584VKES2RwzzWDRe4Wcm3IdLqhGjdBw+ZmCW2y32Y z/uflXsj/D+flVPW5oPqHSjieXrEKDnDtsbIZ3MG8mKAME+0M542GyP/3Zyi8JaWgTOwxUTTLPZxx x5BNmyk84X8G5phlnQhcTWFZU/CFzC5luKWY771AIOrD85rcQY7rqjLT8p2eCbdfUfCLs2UqdR/bv NhlHME6w==; 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 1pNxen-002awC-7J; Fri, 03 Feb 2023 15:07:17 +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 12/23] ceph: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:23 +0100 Message-Id: <20230203150634.3199647-13-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-Server: rspam04 X-Rspamd-Queue-Id: 5073820027 X-Stat-Signature: fgfsr6m7n7zhits448kmc9zpebpfdmp1 X-HE-Tag: 1675436894-174278 X-HE-Meta: U2FsdGVkX18IBN2leM+htXZyMJCk9LrEhfxZC7Pi/ObPM2xq7hjUg5kPBe7YSKzvMMLOb9JieRErvJSlb6t/kV9HpNGFslV7iOnCkoqB4X37QEXyr8oopbkO/F79h6T8tXUZZovPyoTDfrqsj/YBOkmUm1c5K8JOClSgIls2a+LQ/hCBVcJvCzVLNLvYH1uyIqL35Z2I0Wodz1EInBwWPohsXOwUivtvNV/Oh7alWWPhfRBBiJG63Y33j3nO/+bHS5T+Jawslj37IK7cWNvF4Uzv55ygThfAemx9CpWQlJOCjoOozmE6Rc5LmHup6ftsnIuXswhO/btqXhOnMbM98NJwXbORp5P6k50BADLFyHATApdqW+rEw4MlMB/O9mpj2BlNRo8llBkwR7IIoNAKjx4sPrC01AGvZ4JucWJrwJGBHlnq5mcgCsag71XNwkbDZIcziM0gOCVE9kT2unHQJBujbMgr3W5C06JVCtOASWlFR2Ug91oMiQbtC9NOQYA2apG/tA50Unuqv/FOqByiPiZ56zh2Edf7701kF8a+ruAW7sKhVHxlEGzHxGspd8Cs5S9Bt3rnhS5XzqvhhA2wE9LWcdjOusCR4FuHckueZ3Bw1xTi7twYtNcb30DukoMPR3SXueMBZfGZy8thVQ3g2d9kbL5wEX1unDTn9nMWeeqKq8BMypllp8Bql7UhwJhBfAExqgjexssWXPozvSZYgPjnTreKAYWoT92iJIR6edQvPdeJ5WInPAKD6g7nMWgitNae8hwvXQ+uMHnKCvWQi0vLcu6nWRKq8Z1R2QLz1w8mV8vRIxo1Ibxm8umXF40mANu6OB+xwbe9Vi1za1cZjjRZ5ixFiecA8xYKkymA6/Uj6W7x6SgvdGE7WoerqmFcEXKbDpQIFffUzzdNZM553kap7il8KEfEhxN+HoSEp3oB0TyvcmGSCUbKlg8zWnn8j1DDPaRhVn9TPsEZkeE ftERg985 WCEMMlJxz0B+Cm7BtRXamX1LBzu0R5FccP1GXsUv6+B7NOPYOPRrbfbozNBM2S/gLqvAr6Z14gIv+DIDXV+5iGxXGemtSzVmDnWDetZ/VXktRXzrgW/axWyjfdmOguqOPNNgh3YBmaz2RT98KX3LfwFf2UhawoNgWWSXOQs8DWAyLns9p8jabEgNGJrypwSWerbXuNz/6vltxw6eVmSQbFulCwaSBx0HxlTg9Qe1SgvO7UJsXJH+hRzVvwNvXHk62NyGjv+sl/dGdCckUY9yfmFGcNZJoov3866as1HO8BTf6XcstH/48Ek934P0Xv+vSGt/KpbQKZxQrhTC4+pmzEWGi2F7hXjv9SahZtE6qDpmG+j9ZbJ3XU+nDb928W8guZcff3dsUnNpyjeE6mB0+4UnV91dinjy7zPdC6a8VSlBaZmktQokv3t5Gpkum6Q95TLati8HL7+V5VzAIlMFm9v4NIycOozcidckn 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 Reviewed-by: Ilya Dryomov --- fs/ceph/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 764598e1efd91f..90b2aa7963bf29 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -103,14 +103,10 @@ static ssize_t __iter_get_bvecs(struct iov_iter *iter, size_t maxsize, size += bytes; for ( ; bytes; idx++, bvec_idx++) { - struct bio_vec bv = { - .bv_page = pages[idx], - .bv_len = min_t(int, bytes, PAGE_SIZE - start), - .bv_offset = start, - }; - - bvecs[bvec_idx] = bv; - bytes -= bv.bv_len; + int len = min_t(int, bytes, PAGE_SIZE - start); + + bvec_set_page(&bvecs[bvec_idx], pages[idx], len, start); + bytes -= len; start = 0; } }