From patchwork Mon Jan 30 09:21:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120630 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 CA287C6379F for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA0906B0074; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A55686B0078; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87C236B0075; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 72B2D6B0074 for ; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 31905AAA0A for ; Mon, 30 Jan 2023 09:24:00 +0000 (UTC) X-FDA: 80410928640.27.ECDC658 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id 78A3480002 for ; Mon, 30 Jan 2023 09:23:52 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dhP5pRXP; spf=none (imf02.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070634; 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=w4kKntDuy29BQaIkx4v+gO5Mr7Op4d5AzstW4NmjqgQ=; b=mZevPd/lzBxUyZa6esgaY/OFh6kEjlug+7i29EkcyUF6MZnS4tgpeL3wVtQvpFoqOPiTOW Ef846YpGfJQHNZGip9TKTRjjMfzrFwbQy8RL4PmzpHHe9zqoX9YMBo9ODF1VO6k/wpQ4lw pNxcFNhX69jpMBrhlV9d2UkNfORBYzI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dhP5pRXP; spf=none (imf02.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; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070634; a=rsa-sha256; cv=none; b=kKKiRGWRf1vKs/34YKs9h1P59YQeZG7XJLFQvYmKlFfU7bm38+t6cVS6KfIc31NSGl4qH5 pJFoWx9Livjy0AKc2LD0oKJszcL7ZcXiqTQ72knjTdquH16By9P4ADEU0sVcJ0KiEXemRn hOkQIIzkpkaMJ7eIPOaEO5mNni87hco= 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=w4kKntDuy29BQaIkx4v+gO5Mr7Op4d5AzstW4NmjqgQ=; b=dhP5pRXPs7QKG7qsUwhXqREoym zFzrmsc54uPZ3WPKRuV0WfgPkfnihth42MiqynU5Q/EDc9fWWebRrTHXAwUzGN/QJoApdfPiDDX0N /HmkaUaiYxfZXLR3z9hdV2llYBIbYlCe2dMJ6F0EqHVStN3Uz7UWDdL6oJBZcAAt0p+6fB6iGbjPD Nd/Ok11pRhrv+rkkmvwJZn5tR6ROXiqwJ2nZx3e7mQ0MNb0CMx12gTe0I5RWQiaLYIPF7aZ5ee0FT Y0XEhRZP9VSnQWzR1IGwBoRJV/D+7pYsUL1N+aAD7VKEQrSA2/9TIqep6pIrHdjX4TAXBBgOIMZ0Y QNuMFv5A==; 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 1pMQMV-002nyZ-Kh; Mon, 30 Jan 2023 09:22:04 +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 01/23] block: factor out a bvec_set_page helper Date: Mon, 30 Jan 2023 10:21:35 +0100 Message-Id: <20230130092157.1759539-2-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: 78A3480002 X-Stat-Signature: u4qzwc4o1pf3cau6gigcwfx46doej3g7 X-Rspam-User: X-HE-Tag: 1675070632-392545 X-HE-Meta: U2FsdGVkX1+nLgpW+cjaefMQqhLDv/6lOkSMjpikrHccjLBjq8MKh2I3Aikl4qKL2LOGXyTzBvxZIrxELGpjMgNqNyzPG/dlKGdJlLFL0ZzJqwo1zimcZgeHTWa8+agL955aNl2h1x2ti8BJyWMPDPaempODhkjDWCP+D5m0eihIRhJHQspy0fzaZefk7pbHvbELvlFyw6LtHu4ovnNyyixQJY+irwo299SpAjQbFiKIV8uXKPzbKbYongbPi/a3m2Ze3Va4Z0funJJyKgeLeP3EeiM1MYpNTRY2Z5sP/tTspxjMmmXH+baK90sM6AazsUzCa698+42iS9swyR9tFzVrrKcd79Q5vUodWOXtKJFmVWJKI/2wGeEtZqfay4HJlvmMm4aveqtq2zoNN7mB1/Y6tXqpO/CdQ39TcgdV0Je3tZUfaxu8iv37oCUBwcNgtrDpdZJq5HlE0tGyUkPN8dBhDI0BRG8z7Lq9RmqVXYpb4kRtPVqOEAk36ZoXXP3kjKMFKglV7m2ctbTKHuTcMUjvwU07z2HCZLthuKjBSVqKu0rfqGmIAz+6vtZ7zELpEX+FasjRVqkB8+Mi+HUY0f8LJybAngrg1BH5Bsc52MhMTqkziTahwR1kjT7VdK+i2f8AgWn8+7Y+jZb71Qp7wh2kUMETq700ugHTVb9fAgUb8tl/Uvu7nM+J3h6x+wy3ustklUd/UgkMpSN7WdJs3nuGGjpsW4X4YmmC9tub6cLNwA/0qd2o96pRCmpkZygpsjZyEUdyJnh8xb3pIlVX8tb6ayoLUtap4m/ZekgnIs+YCn/JTHbqPy561oKqyEgXaf7FMi2P08UtTqIu6NrSGQQZkUd3dXY3+wvLIp2JQ3xI7xaVxWpPGjMFJsT/UizcHyvcr5697HECUatsraEC2OfnhuQHBSZWJggQgNg3ixVptMmKhaBD3v+HYXos+bG7Dmp/NU3Q2C8dupeYPwv 8Ls+VtEa /9w97YkFhvCgGbVPY0Mp6zUcRansncXPEKdtEhXAjYK6Cx59mVAmoIcHHQndvzrSMNAAiVS/zZqSzJ91IYZFsLTksUCMXigaP6asSYYEFvFNMgQiNEVuxoj1w8PpXP2tewMcnm8gtRjH20Dml5okkAZH1etZRMV/9v4abrFwjCeuB1LMwrlaHCoE5/Sex4pC30w9Ei5Vu5luRCtI7dOOOVXRjvQWuvoeQuR3dD/hEd/t2QiAfpBX0v6J9lmDrUdG1psHVBscqBh4A47Knp8pVnv62DsAQ3Q+elIsLaROsbJg7wIcZfpUtoVLIy5WU8ixhkWytqu7T/09ECgKLleRydH6ImRXxIs3YhScFzqh9FkAxyF0RiGRcFdz4Y7iMVIh6+yc7DMA3aQNrc5WTpG6QIW0/prGkds+FDsHa3BXbcffaNtLXxOjuvL57xwHlofLHT1SWZy+Mva1amMiKNUvzpSvrxkHbSq8Eo7AB 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: Add a helper to initialize a bvec based of a page pointer. This will help removing various open code bvec initializations. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- block/bio-integrity.c | 7 +------ block/bio.c | 12 ++---------- include/linux/bvec.h | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3f5685c00e360b..a3776064c52a16 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -124,23 +124,18 @@ int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { struct bio_integrity_payload *bip = bio_integrity(bio); - struct bio_vec *iv; if (bip->bip_vcnt >= bip->bip_max_vcnt) { printk(KERN_ERR "%s: bip_vec full\n", __func__); return 0; } - iv = bip->bip_vec + bip->bip_vcnt; - if (bip->bip_vcnt && bvec_gap_to_prev(&bdev_get_queue(bio->bi_bdev)->limits, &bip->bip_vec[bip->bip_vcnt - 1], offset)) return 0; - iv->bv_page = page; - iv->bv_len = len; - iv->bv_offset = offset; + bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset); bip->bip_vcnt++; return len; diff --git a/block/bio.c b/block/bio.c index d7fbc7adfc50aa..71e411a0c12950 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1029,10 +1029,7 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio, if (bio->bi_vcnt >= queue_max_segments(q)) return 0; - bvec = &bio->bi_io_vec[bio->bi_vcnt]; - bvec->bv_page = page; - bvec->bv_len = len; - bvec->bv_offset = offset; + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, offset); bio->bi_vcnt++; bio->bi_iter.bi_size += len; return len; @@ -1108,15 +1105,10 @@ EXPORT_SYMBOL_GPL(bio_add_zone_append_page); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off) { - struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt]; - WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); WARN_ON_ONCE(bio_full(bio, len)); - bv->bv_page = page; - bv->bv_offset = off; - bv->bv_len = len; - + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, off); bio->bi_iter.bi_size += len; bio->bi_vcnt++; } diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 35c25dff651a5e..9e3dac51eb26b6 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -35,6 +35,21 @@ struct bio_vec { unsigned int bv_offset; }; +/** + * bvec_set_page - initialize a bvec based off a struct page + * @bv: bvec to initialize + * @page: page the bvec should point to + * @len: length of the bvec + * @offset: offset into the page + */ +static inline void bvec_set_page(struct bio_vec *bv, struct page *page, + unsigned int len, unsigned int offset) +{ + bv->bv_page = page; + bv->bv_len = len; + bv->bv_offset = offset; +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Mon Jan 30 09:21:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120634 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 65E58C54EAA for ; Mon, 30 Jan 2023 09:24:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D95C66B007D; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C79366B0083; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65F276B007E; Mon, 30 Jan 2023 04:24:02 -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 05C536B007D for ; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D475BC096D for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.11.9EC6B83 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf09.hostedemail.com (Postfix) with ESMTP id 24644140002 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Dia0dS4D; spf=temperror (imf09.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=1675070640; 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=C+v5jKduF/6CPyL8Gd3IL/7SXabgum11sMqCASR0Rjw=; b=Elaqb8Burff11q07arLvhk7gBD+nATUtTOtnH0QJw4KbtR58K9HimL0ddfxq7Nkt3PLc+3 uiQUfPu6TWXymYfvkRcEFqf5x2nChLcEcBc/1p2AR/tFiKYAizR8BIVlZFz4eKrhDL6KS9 SHTn/UDnfgnSzbaQt1bo3PxXemZbPDY= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Dia0dS4D; spf=temperror (imf09.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=1675070640; a=rsa-sha256; cv=none; b=8QNd70UAAV/HFXasW6LpDOzeeCM76HDpJUzdChSiGdzxyNqBWJc5VZkNOo8sM0wf1YIZ7q sxarpLaugeORkZfewjy3g1Y3DHPVRbIFie4TI5A72JvOTjAwpb2840+d54X83/EAgS7prE jqXIvkH62Uk0YDBlapCCEFNNuJnUIdI= 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=C+v5jKduF/6CPyL8Gd3IL/7SXabgum11sMqCASR0Rjw=; b=Dia0dS4DHkPCJzEQ3GL2aBg3Jf 0FzC/sN3iLUP+N8J/1A/U87NBJ+uyEpKkpnh+GuSWq6sEuXcf5jfTNBBOYnUnu05pKwV+mnr+dBW+ l0jnhp5PE+zCcWsLLECOowRAOnKIGdMtYEAr62jvNYfNktvspZGptBMO1NjlmVs4DyDbGSYB+KmII HfShoMOrXlSn1TvP3kFHgvZeJnAgNWIbRUDvtlJJtj0z9JYqIs7xD4hBcx6o2hbcuHX9I8P5ctpcD xaxVcGiDk4JK0m74OCpuzA/189QfcEoJAAt91OlSeRWPyROrJOO9qX+PqmUAJXTwLAZqU7f0l1PqF PvDhAwFw==; 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 1pMQMe-002o0P-Jq; Mon, 30 Jan 2023 09:22:13 +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 02/23] block: add a bvec_set_folio helper Date: Mon, 30 Jan 2023 10:21:36 +0100 Message-Id: <20230130092157.1759539-3-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: 24644140002 X-Stat-Signature: isjf4yptwdq8i73otweyyzarw77zc9qe X-Rspam-User: X-HE-Tag: 1675070639-580083 X-HE-Meta: U2FsdGVkX1+LqJpLr/A9yK0MW2fuujF1msd5xONjJmBouy0cD3MSTwbvtJAdeqAk0fMMXnSFXSp5GBusCFk7pNbB1SLqdgqK2YQzqfcJ1lXXu3OomF6ZjY3qhaP8KEVicLEGwbSVI1iZtt2trF6zvxCdjeNXjCf3mDS0+E44iSwa+gWBnWuF360mRpHDhpfdS33l9BQsfhV1XXg4mjAqfNh7f8hwk2P8ElaC/a4k7Xat5qsW9tLH52r2PLYMyzDa3TAB0FTNyJ3eSq755El2/KLUkyd2jqH1Jbuu9ivNM98U5Zd3t4BC4CHfk8z/W4WuzKbYcopVd6oFFps2DMwcUdK8AArjOIk/OlATl8eUTz0idv063cn7q5Oq9jKGggktmd0VyQWv+qCmvuGweShtDGoH70QO6w/TazcUNE7RohToyTZuooPwOeDsJp5ckRlrpgo403SDNeMGUQFuwpxbq3skgQ0XFW5hbmP+HYHhEOozt/3tbs39SnwmnHied6vf8IW0ScFwbPiFlqfUMptk0hzwDDZW76Dlj+1HN/WVOmcoNYrQdNvLmF5vjCTBhLDAvYJwbW/hsHQ4Pi+NFofXCR+fWU2zYoDmqcqtJIyQS8Gjb1xHcXw3kW4Hxhp+D5s2KjC59DQ7HwcwJ+ypFLOZfZMTG0idolgsm9fv1Wg643UmGPYeGrzUiSPvoOCA+Gox0tQy3zUj6nN3WDV8eIrZ9xK57jdhAYFediYtyFImldB3VVfXrkL3L9/IYGJGrecEvE/95eAbW0ez9h/Hq4M4pX1sw56ISk9rDxSssDiKNNUxHfgCR9AVaSj4BOd8cTbwDx7ocgWRAvmpSmJYXuz52HTc26NTVf3agwDu7Dd0nZGctLveGN2WW003LSUc5q8ctg8U6kVSkEpIKlXXlrIOardnYr6GST57RY1L0A1QBtViXByI2iNlc0jlvRBFIlTeI6CDMMEQPyrzK8TlDyl nBGTTCWP XmZThSpDV87L9+MeIufcZOZrnOoWxDLoXPJtJO0lOMNyf2srmK7Ih7HhDVAO5RUY2mwBvtkVa7qPKcxz5Xlk8TOkqDuD61XNuTgzrdTVvTMfRtHHeA9YJ44KN1GCeRkVLxV/QOqsUOY0At9d+NtQAf4qBAlQMjjcsHXFSMC21X3YH9nFUlV3lU/SdVqNz5M+LQWrNWW5bGXbXV47d8Peq54g1Wno3QhbAidnivOZII7CSi0TzMv4v1Jhw8UNzV3G7ebFoupDBTm426qttxmrbFEblNEwWHMJAZ+QvTUAMDm/wITtruJi10KBy/PU9gSjKcoDx/swteiI2+GO05NabYr+5EIwqEAXWMwS19YF6JPh495ZyKx9AGwG1M81HhbQTgN5zbBgkwoiQ3jTdgJCMX1sU66qTdR2+yJxkLMG1bODQ/FyOEC57XxrULhPvMExZDgpr3phqnR6GDkOdBangXya8/+pAwNtk+xmYSCiDYy3wsqaFe7Uzu/re2A== 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: A smaller wrapper around bvec_set_page that takes a folio instead. There are only two potential users for this in the tree, but the number will grow in the future. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 9e3dac51eb26b6..f094512ce3bda9 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -50,6 +50,19 @@ static inline void bvec_set_page(struct bio_vec *bv, struct page *page, bv->bv_offset = offset; } +/** + * bvec_set_folio - initialize a bvec based off a struct folio + * @bv: bvec to initialize + * @page: folio the bvec should point to + * @len: length of the bvec + * @offset: offset into the folio + */ +static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio, + unsigned int len, unsigned int offset) +{ + bvec_set_page(bv, &folio->page, len, offset); +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Mon Jan 30 09:21:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120632 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 AA6E7C54EED for ; Mon, 30 Jan 2023 09:24:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 831126B0080; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B9336B0078; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AC516B007B; Mon, 30 Jan 2023 04:24:02 -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 1700D6B007E for ; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E430480698 for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.13.9A60330 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf28.hostedemail.com (Postfix) with ESMTP id 31C59C0007 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ODubD1C2; dmarc=none; spf=temperror (imf28.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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070640; 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=qHieNPI7z3sFtodokWVnoougmLvZVnqE3Y/VparMyFY=; b=1S28ADC1T/LrxMG+gJMXRVQHN5BITrcjc6PwySAPNDlo3S3fvOwJd0kZ6caEliYQGsQLsz c0IwSUjeIh4WRmIE1+bH4X8HyMlEdMbhoJ4HU9n+XqmUckjmzroAgNo5ZihFdS6FmZCSEd Dn5450Q3TYWvdHKXheKesEOZmDrR0uo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ODubD1C2; dmarc=none; spf=temperror (imf28.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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070640; a=rsa-sha256; cv=none; b=CMab89zv13N3FbI6qn2W6tdfUmniP5WJtB10Qf+7PiSS438cuz5eAE9wbQV7Itk3LWvVIV dh2WbZwdapLBCg2m6d37mXrv2t8xfDAlIaouTiJ69elYtIpVYVZdinYFU7+pZJHkMeWYgU mO0Ovd5qv5QdI//PNB4GPPEdOlfDbaw= 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=qHieNPI7z3sFtodokWVnoougmLvZVnqE3Y/VparMyFY=; b=ODubD1C2BRMqrFChW7fD2/w9bG Bek9dBQcKN5N+ru2staBvvFXiwAiWim7hYwhHUZGSLXX24jbnEbAqdmS5Ajj9+NlnFCavBXfsfhs3 XI6lzCu2GeqKtRgevITrArS3zGcwLMRZMxlr4utu1juNhvass81bDd906uTcf5xiZsb6cCOqyl8nK m98KeGJ9SE/V3c3ZRyUJeGtRoQ5nsh6i4jGrfSPRpVbUu4hyqMBJxi9JGDZJNhoGK0a94aCuKbtu8 rmmcphUXaeiu9gmh/7++19/XF9wkSuRyP7q7ZgI/exYaX7pXYil/gd10qOnCgTC3hp+S0hEq97BKO qjR+Sy/Q==; 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 1pMQMh-002o1D-D3; Mon, 30 Jan 2023 09:22:15 +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 03/23] block: add a bvec_set_virt helper Date: Mon, 30 Jan 2023 10:21:37 +0100 Message-Id: <20230130092157.1759539-4-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: 31C59C0007 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 5s7fsfczyditefstymawgz78zawghn4x X-HE-Tag: 1675070639-781262 X-HE-Meta: U2FsdGVkX19aXlWdjnm5sNEIyTsKqE/xkYfc0VDvjzTJq3FAl2MQHn5PqIEJrjl6lOBf126SUeOHpBOAj3J5OD9Tau2wj6abGlGskK6oon2NL2Ss7ZiAYSqsGQGFu0wEkfvy5VdFSyfKnzg+oTEGDy0qVHnLV+pNLYIXXQV1XkkzokD/XujV+xNnY4gR5P8wTMA9Eu9YfUgZp5dKdshYkWjpjSHvvzeEvJsqr1E0T4KvVllB0CA2nNuuCbFmiEqWQ0saPOO8VVTdqL7YsKqFGjjlMHC/Iv8ibFKSC8cIH/+o4/3kRriAPstpvaf6EnliQckkmsszFrcNUK96jslj8dBaeK0Bi/FpWbew+IJev5nKBvSWVtBfEDEEvVjWvQjKDT1fu2y3qx8osgk97dZjywAJP5MOd7oNRqvwBfA1ZhxQh/prcW5jmclygBgIoQuEBnBmFFQki+ZgK1B1w0WXUnvvRHjVCpaFYMSJqGoAbapmme189CGrLqmhcx+SAugtwjSBfngZJaCuk1pyKnRjb0kEsfDKOZNJ+Z3X+PvYaG5ceV0uXyl3DiY/mBlgEGGdiKj3G+CwlMVoafZba5Hc+t3FV41hg9WI1H7qbCYQ+i2RtbvTGqCIVq8HP8ipRyBql9etIrZ+x0U9Ppnc62sZOdfEDaHT8LBJ4PhjrabyVY4ICBjmApQMv6KojWJVCPWDwiOnRtJtuWJzZ4X3qiMUpVs/ahBNGbrikqFyXkMbZuOICi9xvYh6L/EbT4ZnnKc10cWphpd98k8Gzghj0uMWqZvVT6gYobzOFyithNhaxCy4Z5dZKSSz9U61yhiN6sNLBFqHlQuf4iUgn3+BuyCnXWY1V5wV78qWX1mGjney7vUr/j5jYAlBHaLoMVkTv7480ExDmgvnIwU6MBO4tbJp+Ox53hxz+iPkmtAy6QAsWv5srxngR1SO2Z2CmSCdr+eR53t+pEwdN2SRT2rcxVc WWqfIrkS 4skhCiWgr2cEBt1FhA8jcQw/ejaYg+UJdruYw1246uSu/T7qJAsfAP7/03DEILr11Tr5BmNGpsTUZhFAZ38uGpTKPkB1sVFO9qn/H1SE446sq7Fym8gP1YBhpHDVJ4OD/yafCXMSqlD2Wu9jZiS6DbctqbAiC7CPMcgUZStPMD0ggvwhRVZm/QF3OwBKL7YibD4IsFUlh/izryCzVMTvUIRK+Kvc/KoQIizAksOhPmPwL+vHcmUmf4cvr6KyRdjJK1qaV6+j7gkX/X5ZP6jdtBus2WeLCkXKOntTN4T7l85dB9TxKAmo+Wa+bn+zh8Q7vIbnZ69LMLdaPQ652jcECBIQL1D+3dL3swGiZOLXhYEl110Vm6Gmi8S4iNIGwywphvNahSRML1rmLoy5/XB30QrK6T3PdYImYu32AfHW7yAl2jyxTvs2qtZ6AfvGz9yDBk1j4cAaj7+zDi4ICXDIjSy6fv2Q8RcyJNn0+Tcl/9TdltU59d45tgLt1jw== 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: A small wrapper around bvec_set_page for callers that have a virtual address. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- include/linux/bvec.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index f094512ce3bda9..7031d83af02267 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -63,6 +63,18 @@ static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio, bvec_set_page(bv, &folio->page, len, offset); } +/** + * bvec_set_virt - initialize a bvec based on a virtual address + * @bv: bvec to initialize + * @vaddr: virtual address to set the bvec to + * @len: length of the bvec + */ +static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr, + unsigned int len) +{ + bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr)); +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Mon Jan 30 09:21:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120636 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 EFC53C54EED for ; Mon, 30 Jan 2023 09:24:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C6DD6B0078; Mon, 30 Jan 2023 04:24:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 373566B0082; Mon, 30 Jan 2023 04:24:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01FB46B0078; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BC5A36B0078 for ; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6DF6F1A098B for ; Mon, 30 Jan 2023 09:24:02 +0000 (UTC) X-FDA: 80410928724.08.97788F7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf30.hostedemail.com (Postfix) with ESMTP id B43B18001F for ; Mon, 30 Jan 2023 09:24:00 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=i9AYlKAO; spf=temperror (imf30.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=1675070640; 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=p+yCA75hP3xTA4z0JqY98N90poOlsvGyo37k4Ap2woM=; b=SruPbInsX06SkZMnKGtp+iQw32Q2RqfqzaeKrHkp/0ZMRl99E5AS0hVT4IkjDGB4h9ogcE fTiGhMndvr7smYT+/j6LUDOstndIGZjE1mbif/Ikw2wNyG0BoXZ5OtPCK/DLGbIW02kMiN roh5LOTDDklvZnfsaJDFYKIecZrN2lg= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=i9AYlKAO; spf=temperror (imf30.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=1675070640; a=rsa-sha256; cv=none; b=iK7HOtFqqpOVGIkMb5C4RqF1YXvdmfPZHd5e7PvWLlKU+2xJP08WwxBE7Lz7Rux2zF/S8Z POvl2TWo03sAS3J+EWsS1W37bFceaiFZ6IljWPD0sIhaBXekQhN/LO5JaYFkSWw0kES5X5 HPbjkTAkIrT+B8o9TCHPF6a7vrd5B/E= 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=p+yCA75hP3xTA4z0JqY98N90poOlsvGyo37k4Ap2woM=; b=i9AYlKAOZ43/SsWyYnAWPiWAuH wOnzstLTu84haohS93R+b3+/PFUtyvvWWjhOliCemb0tZtB/BvukLBGtdd3Qfn4AztHpMr5gPDiv9 pykYVq16zioFYfJbJUqVapz/0j7Z9lIwlzAc3goAfS8/li6bXevI3m2oMuDgPE3R0eRL87akyah+L YP8S0UqhRwqk0u2hAa7aNsgUMmQdiU8H7GdpecxVRrtK2g0PJyMvxAcj0GHEEGiFPHkZlYN3Xcgrb Zg+hSn9E/U6Bt1mWTQkkWWRFPXtWhjWXN8hIQicH7S0OvZO+ZxtpZxRzB/wDZ4j0GKY2wY9iOJUXC VOKko6ag==; 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 1pMQMj-002o2F-W8; Mon, 30 Jan 2023 09:22:18 +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 04/23] sd: factor out a sd_set_special_bvec helper Date: Mon, 30 Jan 2023 10:21:38 +0100 Message-Id: <20230130092157.1759539-5-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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ufe3wio54gm544im6oi9tk86dgb43a8k X-Rspamd-Queue-Id: B43B18001F X-HE-Tag: 1675070640-673912 X-HE-Meta: U2FsdGVkX1+6b3P7iAAsyC+eEjnzZ3ce7N9l3pcikeNAiaUxn2Qt1m9WlDLRTB3COz6/r802ONXNQsXweH6csY0xqiiuAg3h3rleXT0vf2LLQ+E4j+K3enRjUPYA4L+9Qm8x3du5eCf7DIp4t2A8dm6urORAnPtqPQ9+lR6DqEAr6N+GSdNSdVIelMZouepsFR7YmZeNKBHcyyU2oHUFkxJbU+ofabgxgVC8xxKES3QV89crWpemGOavFd3BFMlINHnQ1A+lRpbcEzkPA/Mq1TdhPmfMNlmPIrxhS5CzDvYgu+jyRQ8/Y6sa1uGIo1DNTGDTgpOyBUHbvptV0wust4h6oYnj1+ZANIng4FY2Niv7WrXuiZPC1WTaayH39HnBclVGYY0+whWVZBaff/7FtnHhzi2mOVHPwM8YUPCcREVJME2yFYezwVQKhQePN03PH03zfN/u5QkZbDUi5lMbgp/tobk/h40YtOGw3DR0WcsxWZudV0i25pLyOXv61E9tkqfvhw/r7gPMEwib8Ssc2P8NEL9Y6/91vgBZCjKwLfhOIPtNy6lEB7zmxL2rw3orj4PzBzNcHNkY5g+U+pmjliGuMT+XjtyJeh6T1RexP5Vk+VZ0BLAndjfpvVvJDUFt2C/KcG6Gbqh/PxCQiG8KWbP5uytnCadf6IZcUslUrym2M0ZeRynkXyYUOS7NPr8Hdm9zsrdyINy1T5P4i71E+7gMvzONqM29p9LP37n9ViHqXroGwG4eCUo1KOXrzaddlfyqIVrhvYsvAyZcO03WxwAHZvVqZEP6MBxho2oHxaHkEyH+OjW71k55kkrMkhpFZC+QvmedJtZNA7FcJsJJ9fVRwjBsEtojvCcsfh4F+nVC2I5U5LcfVZFU8449ejCnNzTcEsXksOpR57sC1L9LJaTOSGRAr7rdSO+v8yYK9fJ7woh0fL4yNz+ignLHLnOu5Hrg42i1KZk7Llic6A4 kyj2A1lk bu+1w7GqHQiYg4ZvQHoLQV7h0cQzRHJ+b2/l3XpNPs2ZyYpj7fQ6XFqmkrg2bzuIht6sJA/oaAmXvpADW6OPkJeN5gOazdnE2xmijW0QYDlDr1CHR23MNy0GgFmtQBnA36AUequUH8wuMO066LYZAVdfnLsIX6HBBsclu2YRoe8XlgUbzHcRwSpskKb7KGHRq76tPMi9IZItkG+2/idjgJOTlyk6TrDq8iHG9ZIDTQWwMVMYSY5NNzvwHNrUunpZlJZNw7A9eP7k469W/R/dE/xubghY8lBCNzkznj3HnKC0uhlNi104gouIGOSYMHCGi6yC4LFmU0WpVuObiVsORZp7s1yGcr0AY6hqyXREbnp2wlsk/staV0MK7+xXdR/eGY2iH1dtnJvT5dlinIaiTn4Feoq0sZuvgMHhW00j9krHfx3g9/0wtVahpZZXap60I5bliQHgytJxNJTR6vMZb07xgQ3FExQ12zKH80vl9oWESD7U= 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: Add a helper for setting up the special_bvec instead of open coding it in three place, and use the new bvec_set_page helper to initialize special_vec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/scsi/sd.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 47dafe6b8a66d1..277960decc104b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -831,6 +831,19 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) blk_queue_max_discard_sectors(q, max_blocks * (logical_block_size >> 9)); } +static void *sd_set_special_bvec(struct request *rq, unsigned int data_len) +{ + struct page *page; + + page = mempool_alloc(sd_page_pool, GFP_ATOMIC); + if (!page) + return NULL; + clear_highpage(page); + bvec_set_page(&rq->special_vec, page, data_len, 0); + rq->rq_flags |= RQF_SPECIAL_PAYLOAD; + return bvec_virt(&rq->special_vec); +} + static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd) { struct scsi_device *sdp = cmd->device; @@ -841,19 +854,14 @@ static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd) unsigned int data_len = 24; char *buf; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + buf = sd_set_special_bvec(rq, data_len); + if (!buf) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 10; cmd->cmnd[0] = UNMAP; cmd->cmnd[8] = 24; - buf = bvec_virt(&rq->special_vec); put_unaligned_be16(6 + 16, &buf[0]); put_unaligned_be16(16, &buf[2]); put_unaligned_be64(lba, &buf[8]); @@ -876,13 +884,8 @@ static blk_status_t sd_setup_write_same16_cmnd(struct scsi_cmnd *cmd, u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); u32 data_len = sdp->sector_size; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + if (!sd_set_special_bvec(rq, data_len)) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 16; cmd->cmnd[0] = WRITE_SAME_16; @@ -908,13 +911,8 @@ static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd, u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); u32 data_len = sdp->sector_size; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + if (!sd_set_special_bvec(rq, data_len)) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 10; cmd->cmnd[0] = WRITE_SAME; From patchwork Mon Jan 30 09:21:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120629 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 1A23DC54EAA for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BD7A6B0072; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 56E346B0073; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40E906B0074; Mon, 30 Jan 2023 04:24:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 319016B0072 for ; Mon, 30 Jan 2023 04:24:00 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 046411A0311 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) X-FDA: 80410928640.26.8C2F3F6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id D024FA000F for ; Mon, 30 Jan 2023 09:23:53 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xOHsjob9; spf=none (imf25.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070634; 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=mraJ0dlvK0XwWYXGT0DcPLxhMI+ORe9CMkm05FoHT2s=; b=pgixGvzZT10KNhp3Rj6rUmTUXsfH5G0TAwRpSKhf4kx+Gg679nlxYwjmTrj7VPAW5UOn3T SwPMjQP7lkLfRzdPngRib7CoiC6Im6mut1Yeff/G+q4iUiQhck8wT+KMUrhnDx/zG9Y6Fl GwNK29uXKyEJRn7ZGdpN0Vwi60zBlTU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xOHsjob9; spf=none (imf25.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; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070634; a=rsa-sha256; cv=none; b=WRk9LeJC0X/QPQqGSPErZsgsMXRJNPNTZBB5NEtG9QKZ4PekUIYT6jeaoWwVcohrAIUP+t WqvSFNA647MUuY1dvhJa3To6tCFTUK9wycCtFrDaA+bFqhLCq76DlCkBS7OZs0VncXS8YV pM/UG20TZsIybH4du84FZ/00LZyCULc= 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=mraJ0dlvK0XwWYXGT0DcPLxhMI+ORe9CMkm05FoHT2s=; b=xOHsjob9PMRyKJ4ILlqtTtT2a1 BSDOhN5jc440njcpUba2nJJn4oWzHKlh5DYh9s2DBTQtSytoXVfg4egryfmJiUwA01qRqHZMyDpJp k41/6F52tAyqKs8+FJOHLgI6idVUYxVWw63f6ikxbMTvsonHwp2rvU8xER17XbkQQKwuPuEorYONu lBoFR+e+It6xCOx7b04q0jrJemUo+IGk3r0FJ+y3wfCceEClP5rP1JfvxWkw6DvlJRuxLS8JZSWNH vd36DpSVg9AJW+qEayHR4sasRkMheP1AdnGvgFgKp2vugbGtPTxQCn4k0/VQoq9AZDuR9Q9Nfmonk fGtYvRqg==; 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 1pMQMo-002o3h-6D; Mon, 30 Jan 2023 09:22:22 +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 05/23] target: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:39 +0100 Message-Id: <20230130092157.1759539-6-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-Stat-Signature: jr3em9ngt8k6uni5txrtri6zkwpp5t53 X-Rspam-User: X-Rspamd-Queue-Id: D024FA000F X-Rspamd-Server: rspam06 X-HE-Tag: 1675070633-285642 X-HE-Meta: U2FsdGVkX1+yGGM9QaxmIL2doCTeaAufWG7ON57+Gj7OEDs3aSnJMDNXyaPLtRP/r8/m6ToJj+HKec9LCo088hPp31ezPuFrUQQfOTdHtlHHH5i5MY83y55HZIuSw8+d2EJe/FEe3DbK/WfgWAnsjzYMhr/uUj5X8EC1A05vMebjCQx/JTOP872RONBOX4T0bFC01w6JIAny12x8rg6FT1rahq9hoWLq+TJYEhg6sOzdgjh/qR6TUs44UXQARR/oyf587sE9H4B04WQNgSvBl/pLICvxu2LhzgRzWd2pG6MMu6fSTl4kkOcBcjzosvt4W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ZfeKXwygmeYkQDZ92FoQV3clXyvdhkXBQXekpDTxgc7fxdyA/2935RWHHgPHapppglFQ 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 --- drivers/target/target_core_file.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index fd584111da45c0..ce0e000b74fc39 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -281,10 +281,8 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for_each_sg(sgl, sg, sgl_nents, i) { - aio_cmd->bvecs[i].bv_page = sg_page(sg); - aio_cmd->bvecs[i].bv_len = sg->length; - aio_cmd->bvecs[i].bv_offset = sg->offset; - + bvec_set_page(&aio_cmd->bvecs[i], sg_page(sg), sg->length, + sg->offset); len += sg->length; } @@ -329,10 +327,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd, } for_each_sg(sgl, sg, sgl_nents, i) { - bvec[i].bv_page = sg_page(sg); - bvec[i].bv_len = sg->length; - bvec[i].bv_offset = sg->offset; - + bvec_set_page(&bvec[i], sg_page(sg), sg->length, sg->offset); len += sg->length; } @@ -465,10 +460,9 @@ fd_execute_write_same(struct se_cmd *cmd) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for (i = 0; i < nolb; i++) { - bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); - bvec[i].bv_len = cmd->t_data_sg[0].length; - bvec[i].bv_offset = cmd->t_data_sg[0].offset; - + bvec_set_page(&bvec[i], sg_page(&cmd->t_data_sg[0]), + cmd->t_data_sg[0].length, + cmd->t_data_sg[0].offset); len += se_dev->dev_attrib.block_size; } 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); From patchwork Mon Jan 30 09:21:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120635 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 DA04BC636CC for ; Mon, 30 Jan 2023 09:24:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A5D86B007B; Mon, 30 Jan 2023 04:24:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE6AC6B0085; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82D986B007B; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 17ED56B0080 for ; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EC788120946 for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.11.B02F84A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id 3A7C514001D for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yeg4s7gq; spf=temperror (imf23.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=1675070640; 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=gx0nLEas5vXY4XJdO/lbtlr7xJlWecx82+q2uHX+Lho=; b=UWezFe2khf54kVha3sCbKVDZgs97MHxPCr7cpFbnXpGafQBgSFEqzwGzkeVIYOhbDjGnPh Mrw4nVSADUKlE5nkjwXUIiqhATUCgFZ8xp+W3j5Zg4964Ehf5HUn8BLayxtyjdKUPaHNaH 69BnULras4ynkE8Ilpr+3AWBlg+pPc0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yeg4s7gq; spf=temperror (imf23.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=1675070640; a=rsa-sha256; cv=none; b=DL3S7g7vGEdscRZbcYtLztfEPuizK9FaBls/gfPuHhPyZwCnWwjeBYvsB8LKRG1xYoEY+n rAKfhzpSsGaffpbP75ffRuZxe+JIl4uEs0S9VxcJHofXWwT1yEzCk5iM2kYZRgA6YhYaEx 2j8iDKh1E5EjJfmc5y1AdeTTCcwyE+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=gx0nLEas5vXY4XJdO/lbtlr7xJlWecx82+q2uHX+Lho=; b=yeg4s7gq9DJKu/VauV7HjrbNXk WA82K3EG4T53jYpZBmBSIvVN1NWiwq36BmDTj9L8CxgtME+sTBIYOYxJ2rq7AWgsMfdFNfzp4fJdu uqAV4alMEhfFh4rrKBrBO7ECezdW/TjRPcQwW7m2GLvWOZNtFkyeG3jxOFK7MavPPVz4Nc0ByMC6O vBe6jOuX9q4TSyAOSFjiUCm7zuCZaS3K7DuZGoqA4GoPhRYKN1BKSZoT829lmBVHeRbZDtCV8N97p xCZ6HjiZmg9/nRwihqTRuuBqCtDwAr6o8caAQgpRuFyjHz2TTPhcynkZCDuzAMlYs395GEfvQZmgt UbDtcSsA==; 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 1pMQMt-002o6C-IU; Mon, 30 Jan 2023 09:22:28 +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 07/23] nvme: use bvec_set_virt to initialize special_vec Date: Mon, 30 Jan 2023 10:21:41 +0100 Message-Id: <20230130092157.1759539-8-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: 3A7C514001D X-Stat-Signature: qrmw5iotsej3u3fpuar158jpid4du4z4 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1675070639-555998 X-HE-Meta: U2FsdGVkX1+e3bhWdRbNn/YTa9S+mS1ESq/g/EZYsv2Q/7gk9JyTv/ZczvLOfCeO89aYsSk63N7a19MjCobsGHTRyj/ZCV98AjgAyKqi/LcGu3pF5jhaFUdGKIvAXTo5k66Vhi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ZECRgy2koH913b/Z16m2UY6gNMQFeRMgI7Gh6zjucnF2uZFfGKBE7mp9wLaKzPHVwDfhbbWbLcl+bcsQ0jBZOOaeJYT7SNCTJCEuzqPK0m/0GSqYmNGz61oXunDnMbC7XsIDd2qzD00CK6ND6z2OOK8RYBC0OJtUGTPD8uErZilPkip6l4Q9B0fRs/0XKBh1Yn3cVLEdDyeAi+KXJUyb4+nMShiMRYCTgTymKHZCvb2z9kFFrWHA+lr4Ldq8= 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_virt helper to initialize the special_vec. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/host/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 505e16f20e57fa..7ba1accc3c22a4 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -806,9 +806,7 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, cmnd->dsm.nr = cpu_to_le32(segments - 1); cmnd->dsm.attributes = cpu_to_le32(NVME_DSMGMT_AD); - req->special_vec.bv_page = virt_to_page(range); - req->special_vec.bv_offset = offset_in_page(range); - req->special_vec.bv_len = alloc_size; + bvec_set_virt(&req->special_vec, range, alloc_size); req->rq_flags |= RQF_SPECIAL_PAYLOAD; return BLK_STS_OK; From patchwork Mon Jan 30 09:21:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120639 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 1FF6BC54EAA for ; Mon, 30 Jan 2023 09:24:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91D766B0083; Mon, 30 Jan 2023 04:24:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 856916B0085; Mon, 30 Jan 2023 04:24:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F5636B0087; Mon, 30 Jan 2023 04:24:11 -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 61BA56B0083 for ; Mon, 30 Jan 2023 04:24:11 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 324F240341 for ; Mon, 30 Jan 2023 09:24:11 +0000 (UTC) X-FDA: 80410929102.04.1B7CB2C Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf19.hostedemail.com (Postfix) with ESMTP id 8377A1A0003 for ; Mon, 30 Jan 2023 09:24:09 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=SyOpTX9C; spf=temperror (imf19.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=1675070649; 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=PasJ3iDfX2TllVLQ6e7N8/T+ZQHWRBi9Mi0fIgNsQxA=; b=v4NpfJxf8dq/rNo/MBJfDy2W+XTz8Agu8g3BaEqbCKpGkEILmEQFGCUb0Zpb4VNFTrLa/5 Qtf3Yu7HrrZxnosOpoS/W6oAukPNtKTdJQoSxBvr8WkZ1DaL8rHx5zTGmFyVvZbPOpCPQ0 88sZpS4wl4kjO/MQx1fM5sztsnRHN5c= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=SyOpTX9C; spf=temperror (imf19.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=1675070649; a=rsa-sha256; cv=none; b=an+uY9OQ7kwCbvjjyQz1bbnpmvmktHOrPZyznZFiweIMxJCSPWTyNfCX5A+IPPIviah5hk lkOPxaEwrB2kyV4phSkZlG5rCKMk6nufKrvrJ8QQlHqS6qS1oV6RSIcvJwARoFX16UCvJW x7XHBxIDAiOq3L2gMaIeU6aVXnhCO08= 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=PasJ3iDfX2TllVLQ6e7N8/T+ZQHWRBi9Mi0fIgNsQxA=; b=SyOpTX9CZKgu/mdg93Px99ohqU lpY5+Plpyd7Zy3mO80AFoiDBWvs4Fx74nS7dp1CeTeZRYGYVgZlN3xShKOlsqOHMR8YDIfD97TAOl i6DuUXOwtd+Qsu7XWKS9q2lROG9nFii2MJjf2cIawTQo8pmmmRvWWh3yI3j64SspCOd4hOaDYQT59 IxVhU3Tj/X05Ke06JXfdsywRjVOFjJJT2OqUrGdoAw1YlbWzSVrtgtw54YyS4zmtMPEU8NVcbK/29 hwDgey6wC2KTsvdLDoGO0KUy407IzJh0Nss1p0gnq5DmSbrdtNR41EirSVoNLrufaOEJ9Q1DMff9S /WQX3d/Q==; 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 1pMQMw-002o87-6w; Mon, 30 Jan 2023 09:22:30 +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 08/23] rbd: use bvec_set_page to initialize the copy up bvec Date: Mon, 30 Jan 2023 10:21:42 +0100 Message-Id: <20230130092157.1759539-9-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-Stat-Signature: fzamde9hzg6ghyuxp9e1psbntxpgdx5d X-Rspam-User: X-Rspamd-Queue-Id: 8377A1A0003 X-Rspamd-Server: rspam06 X-HE-Tag: 1675070649-155217 X-HE-Meta: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lY6cmcEXroTeyy9ADQmmSQoIXCXmHV6E24HyJ/A8zApNuoy8ko3pnuHLWioVcAB5poX5MJm2vYX3uvKKIi/Rr/FsMDjjJt6JD5e5f3KlHETTTXXl681tJ/Owx67RQjatZFxNtVc6KEPpzuSodESbrc88lAoLHuc/uexnZu2B49i/5VA/5D2vAbJZuBdKM87DMDFxnokwQpAFmU8PuT4H6I8daPg2bRrfGiZm9+dB36NwYNDb0jy4lEQ00qIC4QlhzLTgFJj8jkCVIgW8XuwHjyDNGrgw3itOp3wVvplJAi9b4i37ycxNCopTdi4a2yr6n9SUbJAkKxPEIln4juc82Z3qxlR1MO7NHwW/gFNLmLvlFh/WFoJa616Eby0PdGuoLmhzWqlwChIjD9BcRlUeGQlykrn4= 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 the copy up bvec. Signed-off-by: Christoph Hellwig Reviewed-by: Ilya Dryomov --- drivers/block/rbd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 04453f4a319cb4..1faca7e07a4d52 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3068,13 +3068,12 @@ static int setup_copyup_bvecs(struct rbd_obj_request *obj_req, u64 obj_overlap) for (i = 0; i < obj_req->copyup_bvec_count; i++) { unsigned int len = min(obj_overlap, (u64)PAGE_SIZE); + struct page *page = alloc_page(GFP_NOIO); - obj_req->copyup_bvecs[i].bv_page = alloc_page(GFP_NOIO); - if (!obj_req->copyup_bvecs[i].bv_page) + if (!page) return -ENOMEM; - obj_req->copyup_bvecs[i].bv_offset = 0; - obj_req->copyup_bvecs[i].bv_len = len; + bvec_set_page(&obj_req->copyup_bvecs[i], page, len, 0); obj_overlap -= len; } From patchwork Mon Jan 30 09:21:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120631 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 C7AD1C64ED9 for ; Mon, 30 Jan 2023 09:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B8476B0081; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EBC86B0082; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26B7A6B0081; Mon, 30 Jan 2023 04:24:02 -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 E54236B0075 for ; Mon, 30 Jan 2023 04:24:01 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C849B120941 for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.12.42AE35B Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf06.hostedemail.com (Postfix) with ESMTP id 20F9A18001D for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=4BcbynZE; spf=temperror (imf06.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=1675070640; 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=YZUJ7HQihAVM9SQ7v6O493rk0LMuO0CwXzf/a69CjIo=; b=0idTlYjRYsZQ2VaYZnOtPZwwl0iZNgebjk1e9UddnDs7HUupjfytS7+MViNKiwJ5yGFb3j DaodCJCm4G8E0JaoMTnDJ8vhb2fXkS6B2XF4+bFQIcTfsJibx5rKaBJBsBxCOVHDthIAPT vbHdMGMJuep2XxA4pq1gdxFCnvVvaKw= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=4BcbynZE; spf=temperror (imf06.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=1675070640; a=rsa-sha256; cv=none; b=a9+K4uuYTWRrLOkGXpJh9Xc6pX8yBYTX1NsRA5PtjI/1WPmfRsdKW3HRJSZ8s97o17cmEs wI+51fE7ibORIOfvwEVv3V2OvO8gGkqKEIDx8p77nN/FHCByfXSKoLpr1IiB0XKNx2nN5t fDv90xAqtIUI36HG/nN70I5Sri8ibhA= 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=YZUJ7HQihAVM9SQ7v6O493rk0LMuO0CwXzf/a69CjIo=; b=4BcbynZET2dk93MnTnfUkrL330 nYKMZsmSMCXKbmb2MM3OP2QpdJU8eNF917CXS5pxtBLjTZMwQrKTtMnws2ohBA7RRWHec4I36770B Ox5+nkrXX9wj79Humb1i22F3sOfhx5Q0INe9jxIOGlDAhH7tSTgYpYPAdribUQEd61yXcFAkUZg7Y usvpEhVaXaFP0bU5cEO5OugHl76HEBC2sYb6BKn5vE9PSlk+fsVSQPb+uYmueklT/b2nfc8UWSSxN kiM0alrKzbROr8GBwV+vS9MFZZ4Cquq6oxKUN9fAM9wRzcs79/fw/ikKNhmMiAHMU8UjJ0DbCv4es UohtdqJA==; 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 1pMQMy-002o9A-P0; Mon, 30 Jan 2023 09:22:33 +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 09/23] virtio_blk: use bvec_set_virt to initialize special_vec Date: Mon, 30 Jan 2023 10:21:43 +0100 Message-Id: <20230130092157.1759539-10-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-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 20F9A18001D X-Stat-Signature: bi8zn1t986nuh3a693rjnincjsgfg9zk X-HE-Tag: 1675070639-712079 X-HE-Meta: U2FsdGVkX1/gI4pWHjghMZ4XjWET394P0tw1II7eVZqeh1v33JzfVND7eXs41LE78gepKxWFySqoZNzss3ksKNioB+dNi4Vhhm01HFzu+riG5fU2tAN2y3Aezt4rr9iAD9lufCeUKyppAr48ATHm15sZdY1kr9dyGkyEEPqBSK+BrKkQUy9gq8UU2ZuzKHAjsOTU1uW8GV7KnkSs2w3rynnNBG4n7b6V3jVjodVkDu9bWkluPuUtas6e7aDa+vLmYVe8Pcmamie8MDV1v/21Q3JWPeP/9mdlmnRRttsYfoCkF4Nu82G+0Dt6e1toT8yaZUjwFpYZjUm+6JoTF7wbaPkccJHuHSmr7t1zmZC/zOC8zS2yD9iNoOOS1cjDPagesQZjuGF3UtaGBQfET0i2iv4h/eyA68/dIEi4T13zsBwufzqGhb/geefLlT2PdQg3Ll2Ma+XHI5F0Co/3eLDrLtB27zhGb8D8LvwX+Q++BnwnukGLBhpwH2Z82A36yJp4JGWRXOwkypSxCTDVCRlrHJ5ZJJEdbR593UQ14svMnh2wtrraQunCbFqwIPiQf/ekEbiItgRw6TLlj5ymLq7zn9n36+m5yyzCf4K9oSHqV00sfNmTCg6xMLcJYRXrwAgBCq6aFFOmusIfYBp0QHVXt/dcEoguK3KugQwOcK4cMr/oEolkGSRsc7J3HayYANyX3b3l6jjQI8ivO5SgU8wCNH7nbab2VDu19AO46BqVTxuvDs7NrUhFygVRcQwQxee3Xu24Hf5WfsuhnFTBQ6FwwH0LVgLsXarhJ0SGfCWdW+Df/PKofGo5yrtQd2gu5+0GdAcFtMtKWHuvkTnfdZtOAJ5vHn/DAO3m6xAJSyOvxWoMoNoHIk0u35RTURT6gKUeBp6Z4/tcm/vMbk4rEXbTy/BXqnkEmifkvSGG5tDUpr6LaqdFJEhQZdi4ShBsqcsfvjXm/1TkJtzbOX4Jejz 4DTEf0HS AiRlV6KTgGZbNHQ8/jzxgNqztOhPo/QBnEXV3q/UNGhRsDQK4vTuS2LeeNPYX3f1b16Y4ufpcVGYfzHz6NhBtA6BcleCR910eMz75+vPdJyjNEMUVeDni7Bgle027vsKe7RjDkKRn9bbGo+H5XkQvZJyrnL0XlCbGHRywSiiueknHaFrk9c0Q3rLfyyM1//o1VUtJUFt5jxfb/U2kwhNVgJtZc7CUYeCKy5WSCng2rpexdJFZnlJg8TPtupsCYf3asUlqsOC9qaDbZwOaOF9XHXNAF7KvXJ+Q5zo/biB2Xq1bgqtVnTovO7FOWFaeOG0VMvw7a5mtlJgvyQShpfFYbB5iBzz7C87/DH6WvMZBR9xW6XLx2gGMhS0DpbBWhFomzrP7dzmwqKEFta7cTWw54vqe77k0Hpg2cQ2KbvFTxEVbQEejeDDfqZ27+5A/x2ozKQcSP2SPHcKEJjiwmAjcR8iRnhAWVEavRevxX9ikvUKiHiY= 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_virt helper to initialize the special_vec. Signed-off-by: Christoph Hellwig Acked-by: Michael S. Tsirkin Acked-by: Jason Wang Reviewed-by: Chaitanya Kulkarni --- drivers/block/virtio_blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6a77fa91742880..dc6e9b989910b0 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -170,9 +170,7 @@ static int virtblk_setup_discard_write_zeroes_erase(struct request *req, bool un WARN_ON_ONCE(n != segments); - req->special_vec.bv_page = virt_to_page(range); - req->special_vec.bv_offset = offset_in_page(range); - req->special_vec.bv_len = sizeof(*range) * segments; + bvec_set_virt(&req->special_vec, range, sizeof(*range) * segments); req->rq_flags |= RQF_SPECIAL_PAYLOAD; return 0; From patchwork Mon Jan 30 09:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120633 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 BEDA7C63797 for ; Mon, 30 Jan 2023 09:24:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B11D06B0075; Mon, 30 Jan 2023 04:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A03B56B007D; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CB776B0075; Mon, 30 Jan 2023 04:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EF38E6B0078 for ; Mon, 30 Jan 2023 04:24:01 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C44B5C0969 for ; Mon, 30 Jan 2023 09:24:01 +0000 (UTC) X-FDA: 80410928682.10.F4B23ED Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 1FFE940005 for ; Mon, 30 Jan 2023 09:23:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=UO1e7nwC; spf=temperror (imf11.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=1675070640; a=rsa-sha256; cv=none; b=lce2N23sjW2WRhBZbi+6/oYpgkiuhbQhSTsqsLCZ2Ap5C8PEclOTOghdQtccQ34N4kv9t6 yL65kidkk4NK+HErw1CeC+GcrMHwvvWsVIseyAFo7RjB/eMEGXL8fQu2ct9jeUBH/d5C7/ tutlAnqnbHncvcfjEry/k4UaC2OHmhE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=UO1e7nwC; spf=temperror (imf11.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=1675070640; 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=3qeMDW+n608lQ7XRYvaqAkQtBBNz7xL+OjR215zkIbk=; b=Lm/lNfrx8+tcc/osblnupSyAJ15bToHh52tPFxgAXUmT9RUu8BzzP2W+Nata9a51R0wQWV TVkDbfg6qsZyJ+f8CSmN0FuebaN5Q+hGM8ohuZdAmgDLnagzK32PhJbeknydWpXV1KQ6lD D8Iw1pzgxvro+mtOp374dwlyPi/s1IU= 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=3qeMDW+n608lQ7XRYvaqAkQtBBNz7xL+OjR215zkIbk=; b=UO1e7nwChScdGRWnt+ckYdCTpz cffGVwmOAr9WIi1CMtOSiggD0UKfJpw5o3aJR+6RY6f+COa5q8cd3szdKLRSmmBk/8o983U1Lg0wc ItPZU29NZPb3hGmbv+C9saZ2NV8isV+EyAxFRsl5oXGS+ls/Ho2UjhKpsysa46PfwsMOU8Gj7CgYM g6aoeD80FmRnqZoMeGySNr8FML9baX8bb5LYGaXTnEgnd2jL+LSJi2XTvT5eG07ufkWNH7IgdO+Im JptBCekoIOossTAp+JWcidjNg977cn+klaWqiqh63OAS82nhx4jRhacaWv23EStcOVhccFrZOwyrk MX6JjZ0A==; 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 1pMQN1-002oA8-Cv; Mon, 30 Jan 2023 09:22:35 +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 10/23] zram: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:44 +0100 Message-Id: <20230130092157.1759539-11-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-Rspam-User: X-Rspamd-Queue-Id: 1FFE940005 X-Rspamd-Server: rspam01 X-Stat-Signature: yrpnsspkd5i9aktqp7rihaesw5bg6nhs X-HE-Tag: 1675070639-297119 X-HE-Meta: U2FsdGVkX19JNTGRvdaJauIugY5Ja6hd9OP+sHelXcVQbJ7S1lqer6KFF965KnQFfrvLC0T7GcdeV76qlcyp47n8Fac+ZSiDI14EWDlkiFmvMB7qhnahrtoTM3LQPZklh3ITr/xAXoU8DQwtJOp4X9S/fVIMcLjL03wjsYtP/HQIjZAmJOkz0PmbSOG+8LVkEx/3Z18Y8gDiBZIGJLuU3HRHYcd5FBpx6EtnVSa573kqy07RVfny7a3iQvcCeuujicZPL1fRhaqoL1nTBU6A1OYuLP4zzubnaN4XpN9ITOeljZ+s4EcKHk205VF29r3E/uz2IgqBSkPeJut7fEYHo2I5i3uGoGL9lLGxQEHQ8BXVBr6/TSHF3vVMA8zectFEQO1rkqzDTZvSYfnKfAcnYV6qlDRxs4kDdBXp1wTxQzzOPgsjOPyEVVfKa4i9OSv4sjh00XmTG3dytf75Xbao24hV5zVI7rLg6JWCuFWnZTTyqeT/GL9nEyHvO6igBVvm9h5pNdGEJTGEP69n9QUHVnwP7BKBGS3YavOQoh+kuHkmSu+kyiBDixGy6sm38C52MyX91cEhiAUkQLXl/O5ruRF3Hg5RtGf26cJ12ZOdnx9T65LEXfZPHb8dmS1tm0u27fvtn7d4SdJTCbHNQru1HQFfD1F1sl5OL//hUmJCj63h+cLkNHBO9oU1EVvnTv0cpUQs1rPFPMU4cTuFctANxLX16kDUBP7t6niJ4BDVIX76dJvA2wrBTZRZnsUqbmzWeVyVmJZKXP/eiPGPLeK3fVAcmFe80ZNgYXKuLg09dEThj/4MTo8SdYyR38Uoqa4mEdAcTe8iuM+6NtDtFyp0O1xi5FoHrKieIwmQISeoTpRtn9trDIeYMUeLElSyPKQT7CIgeAKNM2T7amVPHsO2IBnAuV9NIHSYL/ompkT6/HCSzfgGOgIoFJ/ThsdJf/yRAvGJ7ahjeUiGz0rsMOR LY/B/FaV k+P04x9T7QC8geTay37GxgLLXh3lTGJumYpJ+lZSMmY7DpqvdlgOSoy1Sb04SJvBR4Mj6sMmw8ptdpNaBkjdcZzRvjeBLVAxzIzOt7gZx4KEtIDvp9opSGzHDZJ8w/eWRa2NsxqWjyr/pvNKbKXs1UzHr4Hs0sQz958cCXO5fWMl77ixO5J/X+PDMky5j6B8A5X0hD0DcPo7etQ2zeEbjzVdqHiYWotJlydEyntt/jjCUmitDRtHHe0CCdAXWVrfeex6K+Danz4S+L5WuQuMQgJ50qs5miTZ/Tvv31Hi+E1DaGsgmU0dCz515cqMYyo/mLxV2+te+u3/Hz46CRthX36QSIeDdzC2bJsDXNmqoSo9QAxWg07I4imz7X06IvJATWZzlsHagmtSEz44v7dMBlA1COrHIp+tExoAgsH1m/olaxE77yhcR/6/AsScF9eVtw+CdEd0kRW6FTEhuTz0r48oHUjZEu3qtaUBXfriZ1Y8xcN3kEgdyLyBcCw== 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: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index e290d6d970474e..bd8ae4822dc3ef 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -703,9 +703,7 @@ static ssize_t writeback_store(struct device *dev, for (; nr_pages != 0; index++, nr_pages--) { struct bio_vec bvec; - bvec.bv_page = page; - bvec.bv_len = PAGE_SIZE; - bvec.bv_offset = 0; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); spin_lock(&zram->wb_limit_lock); if (zram->wb_limit_enable && !zram->bd_wb_limit) { @@ -1380,12 +1378,9 @@ static void zram_free_page(struct zram *zram, size_t index) static int zram_bvec_read_from_bdev(struct zram *zram, struct page *page, u32 index, struct bio *bio, bool partial_io) { - struct bio_vec bvec = { - .bv_page = page, - .bv_len = PAGE_SIZE, - .bv_offset = 0, - }; + struct bio_vec bvec; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); return read_from_bdev(zram, &bvec, zram_get_element(zram, index), bio, partial_io); } @@ -1652,9 +1647,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, memcpy_from_bvec(dst + offset, bvec); kunmap_atomic(dst); - vec.bv_page = page; - vec.bv_len = PAGE_SIZE; - vec.bv_offset = 0; + bvec_set_page(&vec, page, PAGE_SIZE, 0); } ret = __zram_bvec_write(zram, &vec, index, bio); From patchwork Mon Jan 30 09:21:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120637 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 5C02BC54EAA for ; Mon, 30 Jan 2023 09:24:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 60E146B007E; Mon, 30 Jan 2023 04:24:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E48C6B0082; Mon, 30 Jan 2023 04:24:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 484906B0083; Mon, 30 Jan 2023 04:24:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3022A6B007E for ; Mon, 30 Jan 2023 04:24:04 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EC9C280425 for ; Mon, 30 Jan 2023 09:24:03 +0000 (UTC) X-FDA: 80410928766.29.15F4832 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf10.hostedemail.com (Postfix) with ESMTP id 53181C0010 for ; Mon, 30 Jan 2023 09:24:02 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QTYv8MI6; spf=temperror (imf10.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=1675070642; 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=waVJAjm2FM0jvuh0ozqoP97gMNRNVBgPKhaSSg5Yxhg=; b=xKoraSpUxkuOf+GKg3iQ6k82JxkDOB/kMNToCnA/rwxTw9nenHo4vbOzQqTyzc6COHZmfi +X6ArJ1FvHrmjz1MTvu706mKg6rL5kgJba8OuciqVlH/9cvGlxIA6UK3LgX2cW53+3ZUWf 4SRh9RQ5Es/4EE2S4XJE2HU2AjSMy2I= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QTYv8MI6; spf=temperror (imf10.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=1675070642; a=rsa-sha256; cv=none; b=r6P3dt0Dm71hyFS3K4S2agtPOWxLWil8zYwAaKB7xDJvWXi98CQEbJk0auewL6++4YZDHy yD0UUtK74J7CRcBLbdFBNfPirJIlVg10TrbsMHR9dmW99YAScvdVnz85n6qE4VVDE6KYc2 UVMOcJz+6QHVL+TBWngoiDwOm1ZoHFI= 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=waVJAjm2FM0jvuh0ozqoP97gMNRNVBgPKhaSSg5Yxhg=; b=QTYv8MI6OQAM8sT2MzrC8lgZb2 L7Ft8VBeI/rYi4wvdhNRIkk+89gbjy9aIv1X4usSq3UcRbM2VqLo2MpOUC+5qfxyguvoWKr5GHx64 tYSYgh1k523R3StIKwtgPkxLbHoU0OskEf2l+H4ySafLO43GnmfafqNMYzVkxE+/8/4poWzaTQ/lp lqbYjeu9vuT/c1tSwraqQ+I68EOddD4ZaKS3cKZcGo/Z7QETCvghPhHpksAPizeLr7o5lXtEdKHIo O5+0BsnFwGf+zWUiSaEhgD41XRRwmBfnaknYFcKCzkYl5E0zbVQ6v339RIqSGz2riXL0D2RB56RfS qRVU0BNA==; 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 1pMQN4-002oBB-0G; Mon, 30 Jan 2023 09:22:38 +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 11/23] afs: use bvec_set_folio to initialize a bvec Date: Mon, 30 Jan 2023 10:21:45 +0100 Message-Id: <20230130092157.1759539-12-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: 53181C0010 X-Stat-Signature: tooqywba8y3firpw3o35ets9ew7jsbzr X-Rspam-User: X-HE-Tag: 1675070642-238447 X-HE-Meta: U2FsdGVkX1/tUQvq3iOJitaIBj1whdpuBaMG4r2uMt0JBG3JzbbF67MrYuBPxUAzhXjdPD6XTQwACZr1gFlVvg3OU4fJC1DoHh6GNlFu0TlN5Q6QSVjQPcNGndBH1exlb324y83ONKNmOfwXCKue5bgdgqhllQ9mDX/7EjTOIDL8dzCc0Qj+NAfx7l017wMoYEJ6L9UlmfrxtyLK1rf7YO5s9SHkukJmSCcTv6jWTiGxsvBNzylgjZIVRSnNKOiFGo8UWwtBAmqwTKIPA3yB/9Ij5IhmO3+Ul814EJSpWdaeb4ayQCDGQssd2b8Zk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uOmYyEe+KV/20ikcfIa80G+zRH5WCf0VDgmqm6f49SSvvlfzJfqD3uOStonY71xTfyiEx/mFt2TDWWIyAdfSqffdGzW4= 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_folio helper to initialize a bvec. Signed-off-by: Christoph Hellwig Acked-by: David Howells --- fs/afs/write.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 19df10d63323d8..2d17891b618e6e 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -992,7 +992,7 @@ int afs_launder_folio(struct folio *folio) { struct afs_vnode *vnode = AFS_FS_I(folio_inode(folio)); struct iov_iter iter; - struct bio_vec bv[1]; + struct bio_vec bv; unsigned long priv; unsigned int f, t; int ret = 0; @@ -1008,10 +1008,8 @@ int afs_launder_folio(struct folio *folio) t = afs_folio_dirty_to(folio, priv); } - bv[0].bv_page = &folio->page; - bv[0].bv_offset = f; - bv[0].bv_len = t - f; - iov_iter_bvec(&iter, ITER_SOURCE, bv, 1, bv[0].bv_len); + bvec_set_folio(&bv, folio, t - f, f); + iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, bv.bv_len); trace_afs_folio_dirty(vnode, tracepoint_string("launder"), folio); ret = afs_store_data(vnode, &iter, folio_pos(folio) + f, true); From patchwork Mon Jan 30 09:21:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120648 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 458C4C54EAA for ; Mon, 30 Jan 2023 09:25:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5ED96B0080; Mon, 30 Jan 2023 04:25:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D0E286B0082; Mon, 30 Jan 2023 04:25:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAF676B0085; Mon, 30 Jan 2023 04:25:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A8B5C6B0080 for ; Mon, 30 Jan 2023 04:25:04 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 804811406B6 for ; Mon, 30 Jan 2023 09:25:04 +0000 (UTC) X-FDA: 80410931328.05.6117F35 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf13.hostedemail.com (Postfix) with ESMTP id D35F62000A for ; Mon, 30 Jan 2023 09:25:02 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xV25GZjM; spf=none (imf13.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070702; 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=/tbj/Tg5whekQ1nWXF3p7MKn9zbAs7XJmrxsAI8qP60=; b=c0lSSa6hSPI5Db9qUOuNO1tBGxZ8Aut0gLVOi/WNaJ7V9wnWwN9ZQsvndNfqfGCCjLljGh 1d3VCzKi3GnP2PGCeioTiS2x70mNfPRqxM6EmxWpgTvLJcfVblJD0gW0yGA9BIfWanDP1t Fs/AeDPd4rFjKvGLBzhPuB5Sef1IjQM= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=xV25GZjM; spf=none (imf13.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; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070702; a=rsa-sha256; cv=none; b=jIA1b9bgn96kZoX5Q62v+reIpdLgmleO1xJCrXl9D4Gz8npiJsQs5pJiZWkuKQ2hv7WifQ gOw7Y9O6wgKgJ8rD7271yT0V1OBsgmCmQuciIa/SvELhQAe/J318dKqXjbkrxCwzqqq7G2 jnDaHCgY/kfhWkh4OQ4wpIcrXFAYfR4= 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=/tbj/Tg5whekQ1nWXF3p7MKn9zbAs7XJmrxsAI8qP60=; b=xV25GZjMyWU+4JGmYdpveIpUhP MvUBg+0AGQ4cUbqnzgS5sBDTXnqtwa7wVQL/txup6BH72LNq11j+ASL+GP6Ibue6t7wZREu3rUD1l AbM+a9D4pvYCaOdcGlHWcEAPnUjRJfD7qL+Ec4haykBrsXqebtLBTfOzYEnuNsXcjCaaIrOmD+ztq 2JXHp7gUfawgcgXQeeYMy7wfb7NKSz3L9UdWz8jhsCHlQU1PdTMj+77eXPkBEtZwJbklE0+6NhWXJ sYARddyVpzWrCXb6bGEWE7jP7S97NALXNFekXFrTAc58YTwg3nKtsaWoeAg5DvHQiBSK7BtPBNU5S UhaRvYWw==; 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 1pMQN9-002oCh-OO; Mon, 30 Jan 2023 09:22:44 +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: Mon, 30 Jan 2023 10:21:46 +0100 Message-Id: <20230130092157.1759539-13-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: rspam07 X-Rspamd-Queue-Id: D35F62000A X-Rspam-User: X-Stat-Signature: k7715qgpisdkhgm36pgbmfdxz68wyrub X-HE-Tag: 1675070702-105717 X-HE-Meta: U2FsdGVkX1+FxWrII5eAtTqRvpMdVx4wcMDgcotrNH5f91ZkVJ4dODRc7MvZ5rmjf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pl+eAQBiK3eHydKatgvOpVtldPYrWapBavfLoCHZ9aX3Ja6mP4jEoq/dZ8tBEgMPqm3pT9GkjJmBUdWq46Zn5W0T/0FTWRKMP7n5SVokfIdQlCMdMkFmKj+/5iiuL/qCHRT8q4PhvEe1YSFu7EmGcXkyJpF1mOFb5abQm+stPALsAo/eGVY9Tpyuz+/5sdYzu8A6j5TjlRTaCpPzcz0l2K0bM1Nk/sofLh03IdRtH9AhADAISnT5WvG7C+2JCOlObDwQFtbxcPyxcm9/323U4L7lihnmCxDsTNEHcBJY2GO0WHrNPas+sCKs6CY5q0AvERfcr 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 --- fs/ceph/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 764598e1efd91f..6419dce7c57987 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -103,11 +103,11 @@ 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, - }; + struct bio_vec bv; + + bvec_set_page(&bv, pages[idx], + min_t(int, bytes, PAGE_SIZE - start), + start); bvecs[bvec_idx] = bv; bytes -= bv.bv_len; From patchwork Mon Jan 30 09:21:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120640 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 76B6AC61DA4 for ; Mon, 30 Jan 2023 09:24:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F8456B0085; Mon, 30 Jan 2023 04:24:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A8156B0087; Mon, 30 Jan 2023 04:24:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AB5D6B0088; Mon, 30 Jan 2023 04:24:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 36F3F6B0085 for ; Mon, 30 Jan 2023 04:24:15 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F20E91A0444 for ; Mon, 30 Jan 2023 09:24:14 +0000 (UTC) X-FDA: 80410929228.12.2218043 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id 5791514000F for ; Mon, 30 Jan 2023 09:24:13 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=AeyW2dv3; spf=temperror (imf26.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=1675070653; 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=mjnWElruolPujfuaQzrOj/G3l/fBXPdeJ5vitS9FjeU=; b=vmqBIADaDSVoJHrZ1Koa1kk9lbja89giz2pHcOElhtvjJ3ZSvmaI+o9lco/S/nGslgXdT1 PzalOuTzX+7sfys4zXb+VuJYlFIoblngKIH6dq0Ag4xjnCGTcuFioIqISL+7wfeyEzCLto mt2+gNHBoZddtz2LLGk8aJwtMYV03Jo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=AeyW2dv3; spf=temperror (imf26.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=1675070653; a=rsa-sha256; cv=none; b=0nK8OQpqDgJdxRJv9WP53du4KcJtAWCnyzm2sgMYNY+S8PLaIYx7YYYKDh8XXb9y+024aE wjxV9lRzGghZUtQh7ZS00gxSG0AG8Vyw9iHBGFigr/haNNUFwuUMEE3OvJiIYBaqnTC9HB HXpM3WoieIvJ49rEfROByb7w9jKO6Kw= 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=mjnWElruolPujfuaQzrOj/G3l/fBXPdeJ5vitS9FjeU=; b=AeyW2dv3VrGmqK7xN2Y68HgAm3 hh9AIAEzh5xupy5qbYXDao4MBJwRufhB0+Rklw61vqXEW59/3AXrMstXD9HpUj8whRVjKMJMKksw1 F+HACTpk2HZv02EVd+1E0anoDOOXkPMYnyhx3OQfOs0Zs7+JgAAEM+EH4MnpToE5nbZD+gcW+Kxv5 RRxGRvZ2U9vPF0VLvrfw4LaDLWjqfEbUdZown/DhIpBYN4rw26Fc1VzlYANaDoyFe1h++X6lxoqnh grGLHQ4m5s5Wx2rR8JgELRiQ++/ofjeYfF3YV1iR1Fe4G73jICcylJu1POXGqzsk8qRrUHOsuhAnx Kya4Yu+g==; 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 1pMQNC-002oES-K9; Mon, 30 Jan 2023 09:22:47 +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 13/23] cifs: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:47 +0100 Message-Id: <20230130092157.1759539-14-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: 5791514000F X-Stat-Signature: yck9uffxqbtzojgpk93hscagagfkbcfc X-Rspam-User: X-HE-Tag: 1675070653-610958 X-HE-Meta: U2FsdGVkX1/u61mAdKqdjrRTJ+D+/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GLrGQY+QupGKqDcL95lRl3YSxTtSIeUKGNm4RtdtqARCljBpno6nQyFvRhNN1WBj5szGw7F22H2qkYStnFpiqvh4bCgqnHiYUvnqgR0nKQDGdanXAo81Y0AETlxL2G00T2eq4/YZKE2a7d9G7eQur/QWrUX2h0o7mk9MYRa09hqqeORal4gSgWRGiXNRsQX5jAh+F+siWNSa1+vwSwAMBuXvmyG9aHRAGE85jzyyZQzmaew+aKgpGknn/eXvGlMurIsmsEyV6+MnK1X+HXLYAHwGW0g6HnUR/qBQ18DM2qvvcKOcT8rvS/CoW4kipW1wa+HOXppxQxdllfpvX7RW4b3GUqOOs7rSGSfUQxC4uJHeZWvMqNyjMrukKEig+2EYBz0Bg== 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 Acked-by: Paulo Alcantara (SUSE) --- fs/cifs/connect.c | 5 +++-- fs/cifs/fscache.c | 16 ++++++---------- fs/cifs/misc.c | 5 ++--- fs/cifs/smb2ops.c | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b2a04b4e89a5e7..e6088d96eb04d2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -759,8 +759,9 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read) { struct msghdr smb_msg = {}; - struct bio_vec bv = { - .bv_page = page, .bv_len = to_read, .bv_offset = page_offset}; + struct bio_vec bv; + + bvec_set_page(&bv, page, to_read, page_offset); iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read); return cifs_readv_from_socket(server, &smb_msg); } diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index f6f3a6b75601be..0911327ebfdeb4 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c @@ -143,14 +143,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page) struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE); ret = fscache_begin_read_operation(&cres, cookie); if (ret < 0) @@ -171,16 +169,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page, struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; loff_t start = page_offset(page); size_t len = PAGE_SIZE; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); ret = fscache_begin_write_operation(&cres, cookie); if (ret < 0) diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a19c7987c5bd8..95cc4d7dd806d7 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -1054,9 +1054,8 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) for (i = 0; i < cur_npages; i++) { len = rc > PAGE_SIZE ? PAGE_SIZE : rc; - bv[npages + i].bv_page = pages[i]; - bv[npages + i].bv_offset = start; - bv[npages + i].bv_len = len - start; + bvec_set_page(&bv[npages + i], pages[i], len - start, + start); rc -= len; start = 0; } diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index e6bcd2baf446a9..cb2deac6b2d70e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -4598,9 +4598,9 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size, return -ENOMEM; for (i = 0; i < npages; i++) { - bvec[i].bv_page = pages[i]; - bvec[i].bv_offset = (i == 0) ? cur_off : 0; - bvec[i].bv_len = min_t(unsigned int, PAGE_SIZE, data_size); + bvec_set_page(&bvec[i], pages[i], + min_t(unsigned int, PAGE_SIZE, data_size), + i == 0 ? cur_off : 0); data_size -= bvec[i].bv_len; } From patchwork Mon Jan 30 09:21:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120644 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 4107AC54EED for ; Mon, 30 Jan 2023 09:24:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 723316B0093; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D1DE6B008A; Mon, 30 Jan 2023 04:24:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45EC36B0095; Mon, 30 Jan 2023 04:24:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2A3C76B0081 for ; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0C427A09EB for ; Mon, 30 Jan 2023 09:24:47 +0000 (UTC) X-FDA: 80410930614.04.22FCA52 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 6A8BA160004 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="Qx6f/vAl"; 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=1675070685; 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=iTork4lgSqwAnNzEK3lzK1UwHk37chVOVoUGPRhe1ko=; b=zHk/MfYh/T8VPD/MDfzyqFeVf/Ex6Mj4omdnaDPa+2mOQx/XXvDA7oiOo/GM7OuTRGM8we 3RBtIiSj19qCuthMOEoJcV/APt8vEsIyCiEzLVVPZjTGoZ1mTd4TxxyRyCPbBJN6RtVkvq 0ta/uj1xO8/LB3OzNOck7fhS+6D1W6Y= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="Qx6f/vAl"; 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=1675070685; a=rsa-sha256; cv=none; b=NL98wYUD2OCQXTkfUOI90ywIMd+ETzxFGSeI4TpgzQO5f6IzIL9A4+v8F41Z3hspJbCopM jg/qVz3QLaPu0AH7UYmZ+cq7RwV1WVKN2Ai5IL2BLjXgBKY1vIlcvGL8/szZ42ZDxX0vAG /bOvfMuuDpWD0fbn5/mC6t9doMtYq7k= 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=iTork4lgSqwAnNzEK3lzK1UwHk37chVOVoUGPRhe1ko=; b=Qx6f/vAlt0702Bw2gaA0yw3fMn DSbWXckp85GKL6x2K0wVZWlmBP/HHAMGhBrYB08/Vlm/YRJQCq3kI3xMG/WASmjfzQ5X57qRgvH1M aDf2q/VfFfkAfOqqUqPetL8Nnll6XIjG7NgvoDUHbD0cnB+MO8UuF7ljYLg4f4YTGaLPU4yXfmMbt xSZ2xC24sTznBHqPUwQ2KOdIbwsTxD5YqcKUievCZTrFdiYRp348Iffsdx6IiKzBdbwdD1fWYnp87 CKqOs2Hi1NMEf6sOsnEZOuE8nGXc6MpsuZ0+93w6fPSfAyQf9ElR2gHbrsn8rljB8JPoxhMSuKyqW Ecg9ip0g==; 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 1pMQNF-002oFW-6t; Mon, 30 Jan 2023 09:22:49 +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 14/23] coredump: use bvec_set_page to initialize a bvec Date: Mon, 30 Jan 2023 10:21:48 +0100 Message-Id: <20230130092157.1759539-15-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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: ep37x5sz735tfh7xfj814h7m8a35xmq4 X-Rspamd-Queue-Id: 6A8BA160004 X-HE-Tag: 1675070685-924247 X-HE-Meta: U2FsdGVkX18v8Y3WOMWuDrK5cE8FDjWaPjaaRKMUAIBUcgXRWZHqfwSz42wGeDbEdEOPzqOdpzc+w51rOQEw2/AeVQstbSL25QrnkI0YBdzUXjqSes33SgD1W/1X2YUHpmCRfdQY8JvqLoGCyUmNLEBjbT+3SqRPP+Vmiku2tAOBjKR34jE1J4hKu6ufH9pkj9t92bINznWl5J+VDcxnZAPVVYSEQQgdivk1oH7ZPK18rhqLar5n3sWhG0YK7EZfpq32D0lq2ZiQX9f/rHB2GiO1argmKn6MmmQczqrLl45CkZeFkOeiMhHphdT1/0pxlgQxvaDSPHWcHYsh4rDJV65D8pM2ayYhlqaKAkTmOMz5qGiJhduS9vLx0tO/spY3ANpfaOUW+Km8TIUvBRXNPM7sqzEo8KVf5Xh0X0PPg3M32O6K/fAuylDp67gK8KhQ2HaXM+kO5F2Roaz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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 --- fs/coredump.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index de78bde2991beb..0a6873a9c4d0cd 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -840,11 +840,7 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr) static int dump_emit_page(struct coredump_params *cprm, struct page *page) { - struct bio_vec bvec = { - .bv_page = page, - .bv_offset = 0, - .bv_len = PAGE_SIZE, - }; + struct bio_vec bvec; struct iov_iter iter; struct file *file = cprm->file; loff_t pos; @@ -860,6 +856,7 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page) if (dump_interrupted()) return 0; pos = file->f_pos; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); n = __kernel_write_iter(cprm->file, &iter, &pos); if (n != PAGE_SIZE) From patchwork Mon Jan 30 09:21:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120642 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 C7C5EC636CC for ; Mon, 30 Jan 2023 09:24:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C38A46B008C; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B89226B0093; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91AD26B0089; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7D48D6B0088 for ; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 58BD6801DD for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) X-FDA: 80410930530.18.1A16B37 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id 9D70580003 for ; Mon, 30 Jan 2023 09:24:43 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="0U7C/4XV"; spf=temperror (imf02.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=1675070683; 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=qP38AeUO0Rmk+VJkMh1f6goA+lT+IUSKmsc4pvMdtPc=; b=gFjZB38YTTGOemM6uWtZgRG84bWp+wVLM+EXBpBE/GpDeq+q4auiGtoRpYZ53KV+kFsiHs X0vOgpLCpNaMF3d2XrPXN//UOGDrfcZSDW30nQmHOpusaZQByrBUaoyXz4frUGgMS5EW7o y2dFXp/nSd814NCa9mNnoCyxghNjPQQ= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="0U7C/4XV"; spf=temperror (imf02.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=1675070683; a=rsa-sha256; cv=none; b=75nEOjRTwqnIspzQcBUBISJ6qhXOGRJCvBTuVskV4Ws9eTkib64QKlBD/1K5Z+piap7N+l S5coE1JUNoj8uGqU6OmtHwtSqOn8dH+CijYDcDL9EqCbW5o2hcpCbxGnE0yN1xAbbJcX9r Q3o6qMCss8ItXHDbf4CPwDbB39BUmEI= 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=qP38AeUO0Rmk+VJkMh1f6goA+lT+IUSKmsc4pvMdtPc=; b=0U7C/4XVekTjj+yEkY+iPbVHS9 SCowiG4W/On0oC0DNts1jXCq9PANMU5TUjGyEzvCijD/oLG1m+VrJYiNlUNGYBjErEfnFoIaWXips Gq6HKuysFUNiA+dHDOA8lPW1NJrEyhAS3EvRq0MYqc1fbaCN4zTed7e8bCwvFLNiLRhH89ZXkRYWZ FwX12RJjOzkFSnF6rDP7RrVrDM1m8vuCfiYubETB3lLkrwswOgdkZmV8ceIYxk1be2k15UTBH1+s7 TP/jadRuAY8HqN/XCCqPHefZ1IPYFmZgmKkFBJP1ZRIdSdEy6x6V7+/hRtYyooMunB7/mc5ClXWZB UVK1amGg==; 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 1pMQNH-002oGb-QE; Mon, 30 Jan 2023 09:22:52 +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 15/23] nfs: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:49 +0100 Message-Id: <20230130092157.1759539-16-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: 9D70580003 X-Stat-Signature: 9dw8u9za8ayy7fsnsmkerohjrywy4ezg X-Rspam-User: X-HE-Tag: 1675070683-953129 X-HE-Meta: U2FsdGVkX1+kbtw00HAHLLy15xPVIt6YXnFTzBrmhRt5yN6+52ENYc63IQfZY1KsKMgp1HlvtQbKEQzokBu5VXBxnsOrTgjlCDx3zIm/cqjtn2hoRatFQhqmI8QS1h+UIlRIKF35fuEaeS8on9wr9BLPjbJBlUCK9q/VINDnBaL8iv8Lwu897s5035QtBA89iqaXEaecwk3J+XgnyQLPL479+Ga4eVRfiE8cnNqv7/ao9QlHJO0vXAEI6frcq6aQ9rABLujT/9O+SVddKmpr2hfjX6GKbEEkVP8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Mr5wjxWw9zOgy6K8RIT1DP9r6R3vM+uMihJban8oklX9mrVCN8+ZEGHLGj6TTQGf8jDSgUhHbkk1wmXhXMLIBNFkeaKZ4cEhi0E57Vf4PNSTFV6IythGXJGCQf6ekg== 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 --- fs/nfs/fscache.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index e731c00a9fcbc3..ea5f2976dfaba4 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -245,14 +245,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page) struct netfs_cache_resources cres; struct fscache_cookie *cookie = nfs_i_fscache(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE); ret = fscache_begin_read_operation(&cres, cookie); if (ret < 0) @@ -273,16 +271,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page, struct netfs_cache_resources cres; struct fscache_cookie *cookie = nfs_i_fscache(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; loff_t start = page_offset(page); size_t len = PAGE_SIZE; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); ret = fscache_begin_write_operation(&cres, cookie); if (ret < 0) From patchwork Mon Jan 30 09:21:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120643 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 06E48C61DA4 for ; Mon, 30 Jan 2023 09:24:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF5576B0088; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E7BC66B0089; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C01946B008A; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9FF556B0088 for ; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 78EFCC0703 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) X-FDA: 80410930530.17.BA59C2E Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 9F553100004 for ; Mon, 30 Jan 2023 09:24:43 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=0HizygZk; spf=temperror (imf05.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=1675070683; 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=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=ZX5vPLww1ieVBFlojDg1pRNZdS2tPELLb4SglpcQIZZDUSrkf5kwUrnFEI3NzUgXuL2YOy XWU4ccLoIs6xw/GmocrW8Zj80jhnCllmI59xgr1azewU1ZFhbzfm5du6CRtKzOeqen7fiC aqFSpCc/sFYsxAntvaARzLShNlyZM0c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=0HizygZk; spf=temperror (imf05.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=1675070683; a=rsa-sha256; cv=none; b=C+Gz++8ztIt/oUkx7DDK8CFPcuEfeAqCC1rZ623ae+TdAZjihdi8/ukB8WhSDTHQBBfbjY hjQLcBevXZWKNowjb4OxdQQIk1nHC8PXgznHQrq1K0XFRLlzS45+d+LvTLdbX4rdSkVUZ8 SSc6b+u9tLBmgE/TMGkXB/QyAGT1Vsk= 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=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=0HizygZk2nZjv0o2ajWsgJ6NxN HeRnnJ1D22tpfXLoTyq1RPwvhbr9Hiij2NkO9yjBgJPw0OncbMANB9niSSOrRVZ2N46LpusCcE0BB jppqbA+4ogA5vchuAFpwIfPib1H34fAqGiBc55ohmeWXo4V1xtSPW8b8UVdQPWfxnr0ojaeVAE8mW 5BG1gAx9dS/IpjC8HJj51SPaIhLswJAaTrcmg8S5HJj0ItA/7z4nEzsHIlF7fTEotoyWvhZ3wIenz pNMuCzbIVd5wch1ImTQQLdqp02J0HQI3Zz62oRWCvcMwzv7D5j4NXjlbmjtwNIkk6uFSzNM7w+c0R 43WrGivg==; 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 1pMQNQ-002oHi-98; Mon, 30 Jan 2023 09:23:00 +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 16/23] orangefs: use bvec_set_{page,folio} to initialize bvecs Date: Mon, 30 Jan 2023 10:21:50 +0100 Message-Id: <20230130092157.1759539-17-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-Stat-Signature: qy3z75ak7dr7esa8tffxcu44p54h85n1 X-Rspam-User: X-Rspamd-Queue-Id: 9F553100004 X-Rspamd-Server: rspam06 X-HE-Tag: 1675070683-757226 X-HE-Meta: U2FsdGVkX1+izHtlXkuEFkalDuXxCTtPPupjG94F4PecnB+v+d5CdT3DD48hGbmguYPsHs36twwqAFuWiF6RpG1klwfFH9HegSmSWH4xWB++E2Gj3E2bpBuUk1NP4xEEkAilQ5NUw67xwg/20Xy60XCH0KrsENxfNuTxhAFEu7AOZ48Hy0KUNZ0A8STwjtpfFyNAwJKd2td4iv8YfEnzW2lNDW5OCk/2cLyoZbC4SEdENBqXLhhCSuJtFZVbcmoOZUxuNibtPNcm3faYUIj9o/Wuq3S6abJaF/08FA9waCvFiX8ntTZp0YRgRynknc2ehTc+iim3gB7ag36UXgGKqTuEsV6ZQgOtO4ESQoLmXP/D91MjT8RzqBfeJoFNe3qqMVl+5ta9kZlpxyYMdJENFgh6n+JwNV+0+QEQWjKjYIw79Mja8STnMREbNaSr36iGIei3FHoEdrepHCH/BhS4PcoyghQJs95tbdHVlw5f7e/q4myTNfJ+DKbuwNgpONVx0dIEyMRElS0+PstvBKgFsdmHDtpmNnbavAA9I7aZ47T4asr8K3oG3okNxkSL5NIx4cIJ+qYVzmcih2c5xJAmgJKj4BARBooaPON//y3YU6XE6SB5P8/UrU3141ZF3zEnpaLpKJqnE/ved+TIQn4LPMhOEkpPCXBrjaiiXtlOWCLSgtTbTo0CTJmSumaCfa/HtjcxIUYfA+9Umj6ZDBmqJcd0rrGAj/vEkY4qJ9CKBDWhSbYA59z3jJBY6S2jyUOL8MjcaELLqCfvemM5NXeYd2+S8ePqdBu8dnEXVL5pQ/AGeSa+sHF8x8dNkqNaXSUA2jzK/M3/vEebkcr6LFE1M6z20JjqerInho6Yp/HxjAAUxxGktmHlohRgUeRebmlUCkIz1JeIUSupUxJISbPMSEbpO4x9NfLudMRHIWMhKWbpzX7EeJneKerrxFN9BYrg+rmLMVpiS8Cwjg0OmRU 3lVa//3w 7O7DO4MviFF85BGN/AYnXAGRXu+lL6IcnRbwsSuW+T0ZgsSH6dDt81JE4P+vFnQonH9pIEJdyCTf7SHisiUsSsC57OXcSNMp4gXydn1sfWwyFiTWWnDLS2fME/QPm29FzFloBWXq6AKN+YG57uwwKO0Xi/hDrf/5G7HOtzopOC6D0SSFj7RfiuJiTTulMHEEiSUoYUrxomJ/Y0kCu2zfXGwPIWl4CL7/ZS91VUHb0S2actuTFLJFPvizogORNz7D3RivP9UkmhxN5nTNnPrjyX5gknnhkWX/rSZX2oLWQDdUyaLa1LhYwvNE8kEmhgtY8llnLc7hqZdYxR4kKHuDd+wI40873lznB+zu+bZNeI7D56Vz7p5Jg0PEVaGLJtnjxVoUIXUTATLEuKkyjbn1VcOILoSGVuqUIjOhhTHyPoZtK1MbdQT3kmT4/4TYDz8kWfPqzHLKLFj0KbFrJsGIhBL76Qn/6jmRN7HmKWz6FChfNaso= 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 and bvec_set_folio helpers to initialize bvecs. Signed-off-by: Christoph Hellwig --- fs/orangefs/inode.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 4df56089438664..215f6cb3dc4129 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page, /* Should've been handled in orangefs_invalidate_folio. */ WARN_ON(off == len || off + wlen > len); - bv.bv_page = page; - bv.bv_len = wlen; - bv.bv_offset = off % PAGE_SIZE; WARN_ON(wlen == 0); + bvec_set_page(&bv, page, wlen, off % PAGE_SIZE); iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen); ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, @@ -102,15 +100,11 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow, for (i = 0; i < ow->npages; i++) { set_page_writeback(ow->pages[i]); - ow->bv[i].bv_page = ow->pages[i]; - ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE, - ow->off + ow->len) - - max(ow->off, page_offset(ow->pages[i])); - if (i == 0) - ow->bv[i].bv_offset = ow->off - - page_offset(ow->pages[i]); - else - ow->bv[i].bv_offset = 0; + bvec_set_page(&ow->bv[i], ow->pages[i], + min(page_offset(ow->pages[i]) + PAGE_SIZE, + ow->off + ow->len) - + max(ow->off, page_offset(ow->pages[i])), + i == 0 ? ow->off - page_offset(ow->pages[i]) : 0); } iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->npages, ow->len); @@ -300,9 +294,7 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) orangefs_launder_folio(folio); off = folio_pos(folio); - bv.bv_page = &folio->page; - bv.bv_len = folio_size(folio); - bv.bv_offset = 0; + bvec_set_folio(&bv, folio, folio_size(folio), 0); iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio)); ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter, From patchwork Mon Jan 30 09:21:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120646 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 D85D8C54EED for ; Mon, 30 Jan 2023 09:24:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0E0B6B0081; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B43186B0095; Mon, 30 Jan 2023 04:24:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 598AF6B0081; Mon, 30 Jan 2023 04:24:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 421396B0093 for ; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1AFCD1A099A for ; Mon, 30 Jan 2023 09:24:47 +0000 (UTC) X-FDA: 80410930614.05.C33AD97 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id 6D6D040005 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=wzIp3onD; spf=temperror (imf11.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=1675070685; 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=dTKHKRVOiZxguFuEK9aGNi2iPJtbueeyhuxlyEfvmCc=; b=nKYe4/Vu5W4JZrLp03FDHOj2KEFkK4uiXFALMAgOhvuNsqH37viv3onmQE6axDmK0UkOLw ulqoxL2lDZCind+NfXckAO3KYppgDPJiHm3j0RC/JU68uaXv+HK7bbd2tnuKTE4E6shcHz rGefBp1bvOgIwqFQx5EaLzIFvIr9olE= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=wzIp3onD; spf=temperror (imf11.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=1675070685; a=rsa-sha256; cv=none; b=f1/VJ8GWY8HoU4WN4ZnG5qYn5EpYQ+jGiMlDlQmnrpOXpya7E0qWMkWQsOfwM42XCo1yMB 0MTQG1rN3ZYWudEl1OLh+RSr6TaNKDPzteiIZ2m+gqWnRbTQOUMEl8gVlo7/WpJKa1h/JR kfAb06+JmwNHnLZU8YH9MvS8duLtj6c= 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=dTKHKRVOiZxguFuEK9aGNi2iPJtbueeyhuxlyEfvmCc=; b=wzIp3onDl/KPC46x1A0YIq1Xgv pLhGrvY44JnhOswmbbuq0C74GTtpD3NrGPGojelKqVhVrEtEHiT0r+0GqLI674H8NYmqrsjLFirf7 hxfIK2wy6mGDx+vW+7kxehEbXYx61tyh5ddfQ2sDWTZ8P+aqq3sAxKLx5dO+abQ5AgZ3wH3ypXvXn W4rogyKTenvu0Hx+os5CHbAny1dwMRc5siT1LGqrIQjUGlLIS2K4Qdrxxms4i7Hay4qAxuoHIcFaQ cV5dj8wvsDa40CtrThXkbt/1gf+lggW0MJrJVur/nmMxpKsYC04bclV31iCc4pQafNHFKt3te144P gGQ8S6RA==; 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 1pMQNT-002oJi-4d; Mon, 30 Jan 2023 09:23:03 +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 17/23] splice: use bvec_set_page to initialize a bvec Date: Mon, 30 Jan 2023 10:21:51 +0100 Message-Id: <20230130092157.1759539-18-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-Stat-Signature: 3npo93ghanu4sjmhgtdazna3b5q5dupo X-Rspam-User: X-Rspamd-Queue-Id: 6D6D040005 X-Rspamd-Server: rspam06 X-HE-Tag: 1675070685-164558 X-HE-Meta: U2FsdGVkX18N+Q9dVZxiFq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Q21IZhnbAi0+H39iZVGzR0G1hFP0gpAhRcqob633TGnv334VqrMZ6BeW5S9DcoAHQzHcDbhx3fw+QQ0I7zpeAp8vL9ydypiR/jfc0G2l6yaMNkRq531FG0qWEHY5xeKw3JCTgF1Zh9O8lz88mQ86GIKWoYTHbgaC+mQR+7DL18lTJiWjJPSHkkbMSl0n2f7E863d+Qwf4lVxTeXoSDRZFyIoLrnVyEart5QRPWWrvcnl9ldJVWQ14PvVdOaRKwxY7n4JK/s1cvXO+XWW4Qg9YAh5HKjWNaRD3DhFP4Bg7d2Pfzx1Lg3pwhg2Z+u/RqSzmKZlnZMIpjqeykmTpf0pF2JACESxIx7FRSs2mOxw6BGng0glD9Lh6Tgpl3Hazzlm8qrU= 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 --- fs/splice.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 5969b7a1d353a8..87d9b19349de63 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -675,9 +675,8 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out, goto done; } - array[n].bv_page = buf->page; - array[n].bv_len = this_len; - array[n].bv_offset = buf->offset; + bvec_set_page(&array[n], buf->page, this_len, + buf->offset); left -= this_len; n++; } From patchwork Mon Jan 30 09:21:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120641 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 0F9B7C54EAA for ; Mon, 30 Jan 2023 09:24:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91C556B0092; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A3206B008C; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 742A06B008A; Mon, 30 Jan 2023 04:24:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 65E476B0088 for ; Mon, 30 Jan 2023 04:24:45 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 404B51C5097 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) X-FDA: 80410930530.19.DC121CD Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 90A304001B for ; Mon, 30 Jan 2023 09:24:43 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=vkfX3Qmx; spf=temperror (imf04.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=1675070683; 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=H8iGXniDuXNIMcEmftwucE48paWcF0Q5NpfWk1xxHIY=; b=7conUaMDe4uFGDB783c7J+SKUdlTogghzKH//3iyiplvlJ3tA8JUbQPANAV8nq26ADKJuL BcAqgF4MYwfeWg46t8u7u5eWWFJcw8xeFC0WE+nUtwi7j3VLA6a4hME8LxiTDa5nS8VimF 8CHkHC24vcydch9rejw/Yne0n14FOcw= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=vkfX3Qmx; spf=temperror (imf04.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=1675070683; a=rsa-sha256; cv=none; b=gfg35gH1hhHmOmS1JsLBWL4dp0RE5UD22wVViI+wgNCi9KbNBz96Yf/K9joN9MmuQBrdgs mpsz5FmVWVAMHSwcAAlU2n2XJ7OPcXNLwQvpRLEtBrZksoXLhkity29oJ8tJ8dbZjO6p4k BL1DhPFKdnBXPnr3pjfxa8V++TvXt9Q= 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=H8iGXniDuXNIMcEmftwucE48paWcF0Q5NpfWk1xxHIY=; b=vkfX3QmxaSI2iuDWWBVAgfs1Zx WJgWRBZS7ip4JAwCZLPFbMDGoA3ScG/xVr/qTFJBprf38vBJubWVSkw8js6gVYVnfwnFL+8PuIkb/ 3yIl/CnpBrFD4S/rUHc+8WzsJa3K7jDwAxYnX4tDOoXxTKGOmk355NCt78K71n7tEwRPNCtLZAVlN H0LUQyAGSYaSYwAAVj2vSxCeHizSWaCYlNT46D2TwkYR/HUhHibiarLafpbjqha+BpY01EKupxqcY kdkPUzsSd0uCI3yzdLhyQyxBNhLUCkR2LeXlbT+l1gjTCxSMzBomsRY67f1NNwpM3QsXMl7elLsVM i0BMP0YA==; 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 1pMQNW-002oKh-HS; Mon, 30 Jan 2023 09:23:07 +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 18/23] io_uring: use bvec_set_page to initialize a bvec Date: Mon, 30 Jan 2023 10:21:52 +0100 Message-Id: <20230130092157.1759539-19-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: 90A304001B X-Stat-Signature: rm473dyqf6q77q38jkzg8rue7uwdh5xf X-Rspam-User: X-HE-Tag: 1675070683-116409 X-HE-Meta: U2FsdGVkX19KTEkE+WJpZnkFKbx7bT6H9su0NHCpJFClA77pGcqm/xwsI9mysZnMk0aWJLn+9UhVEp0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0pSAse1dT+tLPFbTHFZG3wTHccc9Y1SZIrgDaPYim4N8tGGk5qOfn4SDxwdRK1E7ZOsFYRdFq2+s/13S13J8r1vLnfX4FfeW7K76La1kAii2HOCyeI9Y2JA99hrgnu0VR32pvAubgLmUu3QXxtu5Zatuyhp2158dXa561yhcLQKYbBjfC6PMs/ikFbtV7uCjU1a7p3fkyNRGwAgFdeNgC7FcnmZiTIZpSUw0rL6mMhCMiyD610ufOp+WHQZ4Z1ca9QBWzgzaEWwqOkEGLffa2+V9kA4pLDFrLMx9vteMlrcM676bwQ3L9nOFk5Da6wAzH1i5RLPcs= 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: Chaitanya Kulkarni --- io_uring/rsrc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 18de10c68a151b..a59fc02de5983c 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1237,9 +1237,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, size_t vec_len; vec_len = min_t(size_t, size, PAGE_SIZE - off); - imu->bvec[i].bv_page = pages[i]; - imu->bvec[i].bv_len = vec_len; - imu->bvec[i].bv_offset = off; + bvec_set_page(&imu->bvec[i], pages[i], vec_len, off); off = 0; size -= vec_len; } From patchwork Mon Jan 30 09:21:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120645 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 9A3D4C636CC for ; Mon, 30 Jan 2023 09:24:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1D236B0089; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96B286B0096; Mon, 30 Jan 2023 04:24:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F8AC6B0089; Mon, 30 Jan 2023 04:24:47 -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 3B2656B008A for ; Mon, 30 Jan 2023 04:24:47 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1E633A0A1F for ; Mon, 30 Jan 2023 09:24:47 +0000 (UTC) X-FDA: 80410930614.02.EC30C14 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id 75C6F40006 for ; Mon, 30 Jan 2023 09:24:45 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=iooTsOLV; spf=temperror (imf07.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=1675070685; 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=h+lHe/qj9+NLcJnalyqirfAInpcSjbUKRj83r5gu0OY=; b=y9ebo651owl/GUUBjpUTGeOZQmeCgwd+Pbrg86Bg878tK1UCK2KLuEXbXzk2c6GbH8ST0d vZeFe0dcijkh24HeDAi3klv18/2RTHSJGzeVMrqDG6TMVzS6oMPcxXYQJo+0B1/qjUVhzJ 11CQfqp130D1IN5tyM0eXsF/1IdIMfo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=iooTsOLV; spf=temperror (imf07.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=1675070685; a=rsa-sha256; cv=none; b=7ndVPRvKGKOyoYOIw5FyIfqZfH6ya3/q0n4SQjYa8FtFmUSSxU7jse+x29J6iBpdkwLPk9 iTQfrQoHJ52aI1k39r4d02/tYA4sIWDYrSU4vu1zX7OmMhzXrKvV+mM9c4gYc0Kh748rkt RTPnJjIIsco7Jx+0PL/Wl4Kix0+1/gI= 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=h+lHe/qj9+NLcJnalyqirfAInpcSjbUKRj83r5gu0OY=; b=iooTsOLVmKIL/ixriJ6M6N2zLV p0LtPYaHnApKmXktbqYtS1iBIChQE//OrkhC9BejFL6iJyQ/YmCmQDM8IAHebGZsoPcKwlLZFMT6R rmqaY+v+wb+eMH9qR7ttcCPmX0HX3khYu/Xo5mViFs4Pott9I6Qn4V7/eQhFdGYEfQf3kZxzqLfY/ ev81DRGCJKNL78EcC5Kfpr1hFkfI1lCJxwKAWUZqu6xN1RHdEsT32y8265Um+OWOJ7Io++V+ve2Ny seVOYj7SyoEnFycVFd1I/7fULPH30U/wlBRK5hBih4Dqubnzz1z+BiP1/3J2Sqawgs4/K9IzZt99x qcn9+TEQ==; 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 1pMQNa-002oMU-Kp; Mon, 30 Jan 2023 09:23:11 +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 19/23] swap: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:53 +0100 Message-Id: <20230130092157.1759539-20-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-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 4745pd3851y8fecu5xm8tgmg7a4g46di X-Rspamd-Queue-Id: 75C6F40006 X-HE-Tag: 1675070685-901750 X-HE-Meta: U2FsdGVkX18drYfLSL3Z7q6ULBfR5v+qfh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TuWxrycrNHQDKdclxq8jfWJRnRCdbvIFoJXHYrKIovBEo7lk1Z6VNLhneXi5glY55zh9hnxB2Mw6/pmBhKOLsPeD5uTiCWc34NH6ZBOKdKh+pjv4wXAgtRX2pobrZlWkOTiGvVh962bCF2NgpkArGZdzpRDFfTdQPz0N2ajHb1uNKZYyscBOwL/NT3jJmEZKB5fQ1+gCWcxrSOSPSTKs1rCp+FIZnDh/CaR1snSQJpkaXYf5oYx+fuCi8QapNi10+KZSy0M0ea1YBVQlvk1AXszk/0LDiFM6xlxfmywYzydvdYdXVwnsm0K2TuKVqEVM3TeXO3awUarpUalG7AAYC9mtDaNiRFKuD4gw0YzcfRL5Lq354gQXHJVLHiYQQ== 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 --- mm/page_io.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 3a5f921b932e82..233f6e6eb1c508 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -318,9 +318,7 @@ static int swap_writepage_fs(struct page *page, struct writeback_control *wbc) sio->pages = 0; sio->len = 0; } - sio->bvec[sio->pages].bv_page = page; - sio->bvec[sio->pages].bv_len = thp_size(page); - sio->bvec[sio->pages].bv_offset = 0; + bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); sio->len += thp_size(page); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !wbc->swap_plug) { @@ -432,9 +430,7 @@ static void swap_readpage_fs(struct page *page, sio->pages = 0; sio->len = 0; } - sio->bvec[sio->pages].bv_page = page; - sio->bvec[sio->pages].bv_len = thp_size(page); - sio->bvec[sio->pages].bv_offset = 0; + bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); sio->len += thp_size(page); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !plug) { From patchwork Mon Jan 30 09:21:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120649 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 12F52C636CC for ; Mon, 30 Jan 2023 09:25:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CFDB6B0075; Mon, 30 Jan 2023 04:25:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 609B56B007D; Mon, 30 Jan 2023 04:25:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D1B26B0082; Mon, 30 Jan 2023 04:25:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3CDCD6B0075 for ; Mon, 30 Jan 2023 04:25:05 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 265061A047B for ; Mon, 30 Jan 2023 09:25:05 +0000 (UTC) X-FDA: 80410931370.30.4B210A1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id 8506E40016 for ; Mon, 30 Jan 2023 09:25:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=TGW1NtTw; spf=none (imf07.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; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675070703; 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=0OKWMBRutlSAGY543ff9AUr9eECMFxK84Mqoa+H011w=; b=CjCuzEoIBOoP7rUTxHWw3CFU+eVxR3cgggGbweeKYoHdg3BboXQgt5WqdEBwP1awAfmjEE hoqjhP11QNW2uig7XVtCUZh/kcOVlt3cq6vx/u8VKwK0mFy1p+va/w653lToboHP39DeCK hQ7JBftZ72RDezwIcsERCt1wgZiurGk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=TGW1NtTw; spf=none (imf07.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; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675070703; a=rsa-sha256; cv=none; b=RiKHFIpfiLY3f5CJb7kFek+WkOa2Zqm3SetNmz/vbMS4cRSJgKLHllejPEHi9JIkkY60gb H/bMF25zBZqjRN3TNzEPupl+HE07XhKhQ+U7eAwmhhYJIVpHOi7gxjgSIyO3Or/NWMiFsB hgpDW7i512K4cGaHimGmRun4BTiD09s= 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=0OKWMBRutlSAGY543ff9AUr9eECMFxK84Mqoa+H011w=; b=TGW1NtTwMqIanaIKWqoOD1aWmB n/scJWrL64fK9k4OmvwoP0vaCMaQaJe9Y+VWY3W+oBkV4Zz5KRTgvvNzhTLAybTpNMypmc86NpWuW A6DJic9z1tz1F4S9KHSq9PGe7EQLxke9ZXXIQgiJFf/NHyDM8LsAsGYTs8K1VSljQIgpxA6Q8vcN+ gkxoIqC9mz7btGrNG99XQEzTqkFz5So1CSl68dtRz5SSJVkhT79kCZOQhxXhh4kdvmuik+6cQ/s3J VzbxJG4gwIVB1atsV9i4jRnuqB9m3/Merfm1mu0MlDBtg87/cIKBrDvFskOHTF/k9hYJjdm93ZoXU OJuPg8Fw==; 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 1pMQNd-002oNl-Oa; Mon, 30 Jan 2023 09:23:15 +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 20/23] rxrpc: use bvec_set_page to initialize a bvec Date: Mon, 30 Jan 2023 10:21:54 +0100 Message-Id: <20230130092157.1759539-21-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: rspam07 X-Rspamd-Queue-Id: 8506E40016 X-Rspam-User: X-Stat-Signature: w4pniaoy5mq1qtinquhs3tq1zcy7crif X-HE-Tag: 1675070703-532231 X-HE-Meta: U2FsdGVkX1+vuRzQx7/d5Om8zWTdTNWbJ6KsN93ZRHWeKzW5/sY5Szk3Ttr0qKjIdehOUpWD6bYDnZr13UqP+kxPT4HjMHCoVFld0dp7BVgXD6Tx7VA6iZbvCyCmejjQRCeL1ySoP+L1GTGrShFHNzCPAywsf3ujiQch7NuyCSYK1NvdESsXvFxys8VCjkqdsFNIDAU4duXGz4LYOCeSjnyRbKTIyv9D0hAR1etShbuzovUgqi4pW9FbtjN9HS0l46PA0FoWumeeeH+pbYBCTpNE4xXqdnaqItTNAKXbhFi+GYEQIw4bwhqZh7h+xofHSoYkumzIKNpweO9AUcKvlDA2au8DCzh+BVYm3klsFABhUEZruTl/ZToxgEefzQrWSfztU/I0cNkh+UU40CYIV67JIqlmbZjfm64wSzHAElZSwfAWNWuN/sCSx1C2+/LleaOLdwqCmrMQggUcz61o3sM0HT47R3QsYr9AfpyAtSVIJ7Uh/3p/174L5AcHMcJCBDIJ7TEaoIxC+SBzh+Hj2bm5FREPilgkfFs3+OUfZ7BPyWbkgmzdisyNPbKs1VdWRvdY4cW7CQX8PsE+cJSJwwT3ZF6liCuI7Ngz9uj/FrRAbGrEVhOtszZ7ttNcoTcxSijmnETZB7kH7ZN0B4sjNww7WpiPqXosseNVyq/MnlWvUVtaBav6YM8fGkD1Rh9VmXFiRxcui7PujYmlC7t72wi9/cFItF3XWwxN6saUyqdkhBqMdTihol7n0RrOsbxBi8ICMsurY6GAopeWB+9xOfNy3JDR7jffr9qvD2/vBITcFWxR2F6atNYTzwldSsjs40fRsqJ2a2lh2x/8CBnPXKcCN6D8ub8Kk5+BpEeGhdyOb0C78RkJIt3Zp1Zubo2NCV/xIr9zbya/bUAOX9eDOCxGcg3938aRpAqkSGAbC0JrCZphYviAE8BBxhaeMorI1W7UdfbjHfUupaXa6j0 jj217m+w 60vz7TZCY1PklyNo0xhLKCsE9xiqPRvpa+NVMZdgD9hFhLGfVDWm3RpwLlMPTTTMy/Hv56ceuLkeHsVOqHznKMMXuA5sBTlzJy/YbhMRmi69nH6zbj4xQzghAnBtZXhsM9ypb/Jt0h63bHtFsL3t1AcBHg7quM6T7wGp8okvWl9fBwJJUEAkJLa5o/gFS22xIHHp8SiDdSn1i/yQZ4AI/Xxd4lx3vga/sCnr25v0yETei9vV9s5UKnK8BPLWy6WcJGXJxGXJzctWIDNCwJ60Dmzgt47QaGEb4hsgODQHMuRDKQMGqjB3WDOOl5fmcezCqUaQSDHzQfhhW6p65d5Wf/2APGh3WzVumOPRCeVWaoNkVtJCXOO78PEUUo3AgsIzK96ub62efCS+nqOoWlJT7t8U8S8IpVC4bU4ktxIuC1ZsoCR6FWhDo399DIX8UCT9X99bIO9NKLWuoShKHPJTaWCbR7SeNNJ6fmeg/ 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: David Howells --- net/rxrpc/rxperf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/rxrpc/rxperf.c b/net/rxrpc/rxperf.c index 16dcabb71ebe16..4a2e90015ca72c 100644 --- a/net/rxrpc/rxperf.c +++ b/net/rxrpc/rxperf.c @@ -493,7 +493,7 @@ static int rxperf_deliver_request(struct rxperf_call *call) static int rxperf_process_call(struct rxperf_call *call) { struct msghdr msg = {}; - struct bio_vec bv[1]; + struct bio_vec bv; struct kvec iov[1]; ssize_t n; size_t reply_len = call->reply_len, len; @@ -503,10 +503,8 @@ static int rxperf_process_call(struct rxperf_call *call) while (reply_len > 0) { len = min_t(size_t, reply_len, PAGE_SIZE); - bv[0].bv_page = ZERO_PAGE(0); - bv[0].bv_offset = 0; - bv[0].bv_len = len; - iov_iter_bvec(&msg.msg_iter, WRITE, bv, 1, len); + bvec_set_page(&bv, ZERO_PAGE(0), len, 0); + iov_iter_bvec(&msg.msg_iter, WRITE, &bv, 1, len); msg.msg_flags = MSG_MORE; n = rxrpc_kernel_send_data(rxperf_socket, call->rxcall, &msg, len, rxperf_notify_end_reply_tx); From patchwork Mon Jan 30 09:21:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120647 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 6E0ABC54EAA for ; Mon, 30 Jan 2023 09:24:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B8936B0072; Mon, 30 Jan 2023 04:24:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F0D626B008A; Mon, 30 Jan 2023 04:24:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE8286B0095; Mon, 30 Jan 2023 04:24:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BFD926B0072 for ; Mon, 30 Jan 2023 04:24:52 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A39E6A058A for ; Mon, 30 Jan 2023 09:24:52 +0000 (UTC) X-FDA: 80410930824.22.B61A3C6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf01.hostedemail.com (Postfix) with ESMTP id 023834000B for ; Mon, 30 Jan 2023 09:24:50 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yIyzvzQM; spf=temperror (imf01.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=1675070691; 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=JggVdFejlVrHezfZyUPZIF+fbKFzTvLqyM6x/B/bNX0=; b=AM7GKGoK4Thu2fbJzX61F4FfUcgjrl5pYWnhqsxTtgQadqM6bNuciEFFLNBRUkyAenqCSd QSWRz8Z89K9+DSFSyleearPMHE6QqQlhiINUhuoe25eZU4qGGFZ/dtoZjOEbpPBywXvxcQ f6YfZitXE4NY6DUeaFSTRN+DQjfWw8M= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=yIyzvzQM; spf=temperror (imf01.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=1675070691; a=rsa-sha256; cv=none; b=549NWOBmRnfgibV3XCRknZevDhZgDWvcmFWwP0ZK390mELIumtkxZyjXg2wT5Sdd94eHYm tfYLBmU69B+8a4s7+Uc8iEqjWoBD2zPIWTI3Ps57QaBWuaSHrUBiTD2QB2lrWgHGbtEKc2 Y5f7HMTuPuL1HLLjgohLpfnTVW8PcTk= 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=JggVdFejlVrHezfZyUPZIF+fbKFzTvLqyM6x/B/bNX0=; b=yIyzvzQMfPVH5Gb1fGbCTBoUMm xloJv91yDUd5JQdWLlRBk+1sLVwSJJvK1sQPKmxCs/LNN1eQPMeGgwtVAmuRonsvhzwxw0ztVLd5H uqTuZOrnXue/mLxyXQ899NpF62ExiwbTi/woLW4nvWS9CICI4bQ1XP2mMwUqoe+ELqlA9Ltt45QBS A1RN48wY4MO2whvwBYTYJeo6A20nM7cF0dsRRmfS8Ta41XMgoSLMfClVVyS2ZQY3DqywQTajuIYZ9 P1s4vwRo6Pu1l3nmpmKYQrYw0pvU+oaOEhwJk+puAKc1PPGVc3KCMZJMyOB5E9Yi2nzwi5ZdtIclp AQmElk3A==; 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 1pMQNs-002oRV-Sa; Mon, 30 Jan 2023 09:23:29 +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 21/23] sunrpc: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:55 +0100 Message-Id: <20230130092157.1759539-22-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: rspam07 X-Rspamd-Queue-Id: 023834000B X-Rspam-User: X-Stat-Signature: iemgezn83oi4hrqfgyau1apcxhpjb7cp X-HE-Tag: 1675070690-974763 X-HE-Meta: U2FsdGVkX18RlcvqAC3Zuz762HZ7ELKN5l4zU8WV7Qw4owrLb3QS9YeB5eeM4GZ6Pb9cDvDeg2cGSMgbDvIrRSkO1IqiJ/9SfklbDxbOApDVKWK9FhV+2E32kwd12G/G+m0j80GRiNUBVglZdRkk9OJERoy6zMJKG6sAGStTzzxA4dWnCp3Ckxv0IkNMqd8bOdyQTBe73kr57Us+mHdEK3INnVHHZEq3SAUYnN3EEyk8PbdeDmrdxO+SnvhLspOW58McHPhDtsLNitRUuq3Uuvfrdv5InDtypHejFuCUPsr0a+Rsx10M0H6j1K+pMVzqUHYwF2xPOT+fxT648NFrcQJq4i6YVXKYQElBFj1JkBvgV5AtW8SIoak+dCiqETVuWdwcqXZMncvx8DDFkqUk6PMSWWtJZrh4C0866RFppL0sE19pI2Ujj4JUWZVZQ1rGQvoRpgY+d0ibWEYtv/lPpdoY4RxDf/cXmk0N6CLWyuDyymYLvksRUgAk9Rr4QH5rLGA8IYojYAT6mpQJkQUZ9L3x53WhHjaz9Zv7qy7PBbsUpHLsJDCQUPixYSaEi4xBKS84cC9DYNjPO3aSdOx+IAYDovigWmGkqaWKMXQ/sf5ib1YGVS+QY4L+BoCG6udbqgeXyWYzZ86W5VzZfbLnRFp6iViIpNKFhnhG4t9Qmbe4e6djGS1AlQwkPneRB2DjZ4G0kJU5zulYghMQwWEoFAZRyGArFKW8+jSSPbPFksiOyi0XFiXcEYAjo/W195mRW94mWBrH+8NoXGMfFkGrQP/ZtzCEFr3qCuhPDNfyC82QZTUvt/FPW4+6HTYmrZ4GV5cg5K2RzKwZI4X9XmeaUNV4mlzNJYRrjKDUQAc9+SanGEvssNrQbhjHJvW/p6SdSDm6RudRph6TaXnUsZZPwZW+z5+WrBDp92Osv1iUZ0TWCu0R6utscmdTpOXLGPmVvDPLWU9YEiZmg2XVBHk yC34V0AQ C5Ac3p9WdxMPNOW1JQy7t6SMVqs0VTDZg+e4SMhesv/QVrbuefjEAs3VviSfyKzQzKnqW57nMvSOjIfFK48hRt80Ga1KWW/zx/K44kU76W3TindhB6gwP7Ejhaq77xfaakJol9a99ptfwZRQTHU1KK8JrmVBwXUlkf0m4zfgXiCH7NRBci2Hw55pl328w8tYglKtsMG3aPtP7xLEYyTN1iuAlNQdm/G1PQKgHioETjTFCdjCyYNtZImJQDRyauw+5AzNy+HW5nxtHC+3oQmBNQKsknUPw4Jn9Mo2Hv2tt90s3nMPRngeleqmgBCN9tgtuJ8m+fwjLU02Kw5Xr9cYmVRt1IO5rXr0YrNxcuirz40y/kA8s56nAVzjUcGfa+T0N5C02nc/HKZMjyZ/LMmZbgp9DakVsgW+QaobhXrfaP1GuRfrqIV1xBIL6lTa+t9AgW0WMhWuyADS64THSHkrecLn1XXbvKwmHn1c8/eIgGiBb60w= 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 Acked-by: Chuck Lever --- net/sunrpc/svcsock.c | 7 ++----- net/sunrpc/xdr.c | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 815baf308236a9..91252adcae4696 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -252,11 +252,8 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen, clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); - for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) { - bvec[i].bv_page = rqstp->rq_pages[i]; - bvec[i].bv_len = PAGE_SIZE; - bvec[i].bv_offset = 0; - } + for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) + bvec_set_page(&bvec[i], rqstp->rq_pages[i], PAGE_SIZE, 0); rqstp->rq_respages = &rqstp->rq_pages[i]; rqstp->rq_next_page = rqstp->rq_respages + 1; diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index f7767bf224069f..afe7ec02d23229 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -150,9 +150,8 @@ xdr_alloc_bvec(struct xdr_buf *buf, gfp_t gfp) if (!buf->bvec) return -ENOMEM; for (i = 0; i < n; i++) { - buf->bvec[i].bv_page = buf->pages[i]; - buf->bvec[i].bv_len = PAGE_SIZE; - buf->bvec[i].bv_offset = 0; + bvec_set_page(&buf->bvec[i], buf->pages[i], PAGE_SIZE, + 0); } } return 0; 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/0rzRwVK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hQ6ok0vn0dGyLczNOHHFQpAGMVnz5MRsHLmlyx32sFpDyrf0D1XYIHw9GM4SeGSh/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; From patchwork Mon Jan 30 09:21:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13120650 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 8462FC64EC3 for ; Mon, 30 Jan 2023 09:25:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19F106B007D; Mon, 30 Jan 2023 04:25:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 128296B0073; 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 F0A796B007D; Mon, 30 Jan 2023 04:25:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DB83D6B0073 for ; Mon, 30 Jan 2023 04:25:22 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AFA3D1C3B90 for ; Mon, 30 Jan 2023 09:25:22 +0000 (UTC) X-FDA: 80410932084.19.EE182E2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id 018FC140015 for ; Mon, 30 Jan 2023 09:25:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ykPzBC64; dmarc=none; spf=none (imf23.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=H1w/sob2deIb9pxt4pAEZWp01So4kETnigr7yzrrzGg=; b=EvVqG1iA5mBJSkVAS/RvHvnaDgQwqOZWFcU4acSlMeTAUElwdS3I/Xk6Cwg2HO5Lghadv6 2b6qgav/Nsj2HuxkYD3U4Wk2WtMJSlpPZd1T7yJNXoegTH4vqD9s2A8YPr11E1ae8l0gCV 8ErCvjyM+ZOsqGTZOqT/B+1dMuE06Hk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ykPzBC64; dmarc=none; spf=none (imf23.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=XuK74+wE96BTRH9x1+wJgMEBy62Rw/+0g/9tOx74yXl1FXRrCS/tkb1KiU6qAVXIheI1LI DSApZdfiyVDifgbPozeP/ocIAfPoxgbEKUDW1JubURJOWLfDxkCkFzd8kNJZMoPMRD/tAg wDj9iED6AtkdZcuku1cb7f5RlYWEh3g= 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=H1w/sob2deIb9pxt4pAEZWp01So4kETnigr7yzrrzGg=; b=ykPzBC64zt0+24f/idcoY5rPHl IsFgekhQQBB15Wh2AupkIyS/+sF/MEgiCkwkAzgtsu3rOUsznVfVUdBr0/uyOlhk5rx+h6DR0d9Oq gLrt+9Bh4LcQxj8juVhz0PYX3bpL3oDqD7A7afZtVPoATxq+y4I8dtDm7Fx4FySiMWhyJMVEXE5S5 IeDwhKFrXApv9OFQJhn1/to8z+gpYIhjxn4yvN9X71cbtbfi5fbILaUAJrrmpPdUhZHmWkHIRSHQb LJjeyTDO81kNei1tQOu95oSLdNf1G2DlmwqbKXJcHxLcuUQRAtvvSjB9dI7ZC0svAqSMARkOGYONl UAzlVl5Q==; 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 1pMQNy-002oTE-C6; Mon, 30 Jan 2023 09:23:34 +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 23/23] net-ceph: use bvec_set_page to initialize bvecs Date: Mon, 30 Jan 2023 10:21:57 +0100 Message-Id: <20230130092157.1759539-24-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-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 018FC140015 X-Stat-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3I9NyEBHa/3v2buYnIUTT2ZTMwB/arRlS887Zhv4H8L5beq2g4tJPZnX9OngbHFft3i8C3YQ/NgbxFdEEi2wif+3dKHbrGZtt4UXzzfC61bHJ5Wz+mRnK7KRMez5pc01z3dUaN8elTgxVuHzD/htSPZmN6paENHFhUCVbHg6MzS3LAa1abIvfdkiaWHJfZ8/ZbBCx+lgzaX67vUeTwncrt7At7Od0Dn+LgYjID1xSwPh7R7mY+bpcdRproOLuzXQlC/8g+dU3EqvHFcEI5VMivXsnCEyhuYLELw92ou4WIEPo4pfPY92+BcHK4IjWLH/me+ULJUdplaGXgX7MUVudPOtrhzvpdx2KWuAwASYJYnyn1eEl7XTe/1Gg4GUdHyWw9HCc1znB8tJX6+ptLLkmJ5mKk2U6Zzd1epWQG2RKlMipPcqHSzWP3axpae2Dn7Rxi1a8 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: Ilya Dryomov --- net/ceph/messenger_v1.c | 7 ++----- net/ceph/messenger_v2.c | 28 +++++++++++----------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/net/ceph/messenger_v1.c b/net/ceph/messenger_v1.c index d1787d7d33ef9a..d664cb1593a777 100644 --- a/net/ceph/messenger_v1.c +++ b/net/ceph/messenger_v1.c @@ -40,15 +40,12 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) static int ceph_tcp_recvpage(struct socket *sock, struct page *page, int page_offset, size_t length) { - struct bio_vec bvec = { - .bv_page = page, - .bv_offset = page_offset, - .bv_len = length - }; + struct bio_vec bvec; struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; int r; BUG_ON(page_offset + length > PAGE_SIZE); + bvec_set_page(&bvec, page, length, page_offset); iov_iter_bvec(&msg.msg_iter, ITER_DEST, &bvec, 1, length); r = sock_recvmsg(sock, &msg, msg.msg_flags); if (r == -EAGAIN) diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c index 3009028c4fa28f..301a991dc6a68e 100644 --- a/net/ceph/messenger_v2.c +++ b/net/ceph/messenger_v2.c @@ -149,10 +149,10 @@ static int do_try_sendpage(struct socket *sock, struct iov_iter *it) while (iov_iter_count(it)) { /* iov_iter_iovec() for ITER_BVEC */ - bv.bv_page = it->bvec->bv_page; - bv.bv_offset = it->bvec->bv_offset + it->iov_offset; - bv.bv_len = min(iov_iter_count(it), - it->bvec->bv_len - it->iov_offset); + bvec_set_page(&bv, it->bvec->bv_page, + min(iov_iter_count(it), + it->bvec->bv_len - it->iov_offset), + it->bvec->bv_offset + it->iov_offset); /* * sendpage cannot properly handle pages with @@ -286,9 +286,8 @@ static void set_out_bvec_zero(struct ceph_connection *con) WARN_ON(iov_iter_count(&con->v2.out_iter)); WARN_ON(!con->v2.out_zero); - con->v2.out_bvec.bv_page = ceph_zero_page; - con->v2.out_bvec.bv_offset = 0; - con->v2.out_bvec.bv_len = min(con->v2.out_zero, (int)PAGE_SIZE); + bvec_set_page(&con->v2.out_bvec, ceph_zero_page, + min(con->v2.out_zero, (int)PAGE_SIZE), 0); con->v2.out_iter_sendpage = true; iov_iter_bvec(&con->v2.out_iter, ITER_SOURCE, &con->v2.out_bvec, 1, con->v2.out_bvec.bv_len); @@ -863,10 +862,7 @@ static void get_bvec_at(struct ceph_msg_data_cursor *cursor, /* get a piece of data, cursor isn't advanced */ page = ceph_msg_data_next(cursor, &off, &len); - - bv->bv_page = page; - bv->bv_offset = off; - bv->bv_len = len; + bvec_set_page(bv, page, len, off); } static int calc_sg_cnt(void *buf, int buf_len) @@ -1855,9 +1851,8 @@ static void prepare_read_enc_page(struct ceph_connection *con) con->v2.in_enc_resid); WARN_ON(!con->v2.in_enc_resid); - bv.bv_page = con->v2.in_enc_pages[con->v2.in_enc_i]; - bv.bv_offset = 0; - bv.bv_len = min(con->v2.in_enc_resid, (int)PAGE_SIZE); + bvec_set_page(&bv, con->v2.in_enc_pages[con->v2.in_enc_i], + min(con->v2.in_enc_resid, (int)PAGE_SIZE), 0); set_in_bvec(con, &bv); con->v2.in_enc_i++; @@ -2998,9 +2993,8 @@ static void queue_enc_page(struct ceph_connection *con) con->v2.out_enc_resid); WARN_ON(!con->v2.out_enc_resid); - bv.bv_page = con->v2.out_enc_pages[con->v2.out_enc_i]; - bv.bv_offset = 0; - bv.bv_len = min(con->v2.out_enc_resid, (int)PAGE_SIZE); + bvec_set_page(&bv, con->v2.out_enc_pages[con->v2.out_enc_i], + min(con->v2.out_enc_resid, (int)PAGE_SIZE), 0); set_out_bvec(con, &bv, false); con->v2.out_enc_i++;