From patchwork Fri Feb 3 15:06:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127849 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 9A672C64EC3 for ; Fri, 3 Feb 2023 15:08:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E44356B0083; Fri, 3 Feb 2023 10:07:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA4136B0085; Fri, 3 Feb 2023 10:07:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF9DE6B0088; Fri, 3 Feb 2023 10:07:58 -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 9C7726B0083 for ; Fri, 3 Feb 2023 10:07:58 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 653BE1C60AD for ; Fri, 3 Feb 2023 15:07:58 +0000 (UTC) X-FDA: 80426310636.28.8E20410 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 952F2160019 for ; Fri, 3 Feb 2023 15:07:56 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QSfgGBAh; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436876; 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=2ivuZdJU66fGeGNrDCSX2XtHVJq8+h1pLMvYDbA6wQ8=; b=t8aNJbw9B87LmNkp/s7v/sSoulGg/3ESpK6zJ9nqjxxmdPn2gFjqNTlogd4bdlvNBPQw33 LQ7ArAdY1cFsOaMKnPLxWfQn4vzi6pThNvgp5unXDU8sOKsIIoXemuzfGOg4XZ+i9/mNTE pb0jyFexO8vg2jRDlSd0Pi8psX0GVQ8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QSfgGBAh; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436876; a=rsa-sha256; cv=none; b=gYQyQUV5Nqe0KkXbFVaH3Mp5jgsQxrsIfr/rP+cn9dYrzQUudoQ0/n/xQH5ybx1T5G38P7 oXNi2jEfA7TNIA49b3sGgjNe51aFqJCRcW9ufRsd5oah937SXIdnTyf5ZUf4LgZVcouYoT A2H+6CFBjsxRjt5CQsvJeGxlA3LIFos= 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=2ivuZdJU66fGeGNrDCSX2XtHVJq8+h1pLMvYDbA6wQ8=; b=QSfgGBAh+EXZxzz/Xx6bibyovx 8Nrgb07oWFXF7SI+3wqJ/enmvP8hFHc6hUi3sA6GWv5A6dP7fcYPg732hEG/Jv2/jgoMcNgX6QddE Klux6y3fIgLzUgx2tQwUDLRbjwR42AzjGvRy3d+zXy8gseAM9WJfDA8waCftfZvGrqDwKbb421JO+ A7KmM+t82WMvPJd60uQmgjS17we9cGNrkQfjYtCxBhWbUJkld5d206L4xTBajgBh6O8m/iXqiwdQ5 Cvd+cDQIEMDIlKCNI2qXlOITbs0hvvqOAEaly0PMreLcEnepGH9pQ2ba/Ud+fBJ4c0tY614+rY/Gv 8MQKv9iw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxef-002ar9-Df; Fri, 03 Feb 2023 15:07:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 10/23] zram: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:21 +0100 Message-Id: <20230203150634.3199647-11-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: bprxwbdzn4choocazq5it6jzet1fj8us X-Rspamd-Queue-Id: 952F2160019 X-HE-Tag: 1675436876-534353 X-HE-Meta: U2FsdGVkX19sRg/ipSuyt1ViwVTt3C7+jj4h8N5+WRIowP4Da9gjOjyHMdwvbyDUf4JiVUWx7wwIK+OXBh1Lm/rLlLDge1xj284w4qKBM2+cWeeuJ16utwfwImMAJ3EoKmypLdbnV5b1Mf8ZdS4jqPLHLddgX7Sb1zT8bGklrtn/UPq5qDcS77RiJAPMhzitEus5S+jcnJDAIsKs97kRQ700MN35IIt1RyrV9sH+R8emarsB+yBgsQc5GbYZTD7SrDRCioWn+2tNj1mv2/wtXkdlINi6igFktOw6gxq/sWPdW6PhbPFs9b968a+j3ZmK9RpYB1kROggM8i4n+GT2fUaXqr8Fb/QStarj5xG2Ms3vvvLSl4kPvgizk/EncGAh15QWMeJhQAsuQmyI4XiQrT/fQC+pxkGAY6GDgg51p+iwSrzXSRvSSaVtTPfkucLyk5fOdrSW00LH4GmUEMIvXZ8UGKK6KRAMC0iY7YnPDaAQqBWP/I79nHviV8RNAgpS1vmGw1Ip8u9XpZJRe7TOhzZ+/XVzLGnMwyQ6fFccxwugyajh9LrRwhT1FoAAEzfB3mK/km1tHn3po453/U9gdNllJ6gHeyXnwkgqlJh0ddgwKAnTha/s9nbcEei43B+kypPSDbT0EoAFdeq3UvztAiTJt21656j6vw9UhJct+o/kVQcvYDCNzoZVNDg6lmIyB4zXJc3nU72SW6DIYYGkpH0y2fVFet9LgL1rL+GeePk5G4qOoG5RCgKG0OJCvnewsDlp1liR2kPSHP8+tL0hAEVm9rXLPDKh11ih9/qt2UZrWzReuneVnhENYKse3W68XkhDQSJVcnRGTNsXty4dyWw4dIBGn9qJLMAKIGQF0HOKeNIe7pj1dmu7XI+SIqEZDixAkXmJTAhJtBKB1yZvsZxoD5Y8UHHmLZBdF23zm28DWo49UkE/y9CL7TQ9DPa4Rg2d/U5b9SrOfYU3wT7 KceFXnb3 k7L5vsajL5my1GGqw7VEMtnDBlHeDnpECBSILE4T9aE7RsrqbPQsvrU0HifNKi4F5Uv4guHQkdw2JJxOGH/RGuQK6bMM5U0TYRzqln4LPWPKB2qXBk8L18X1nhrIavWoCYR2yIf0+c/JSgxoPbSzaJSVmgFq34ur4lV5/n8ysaX7uios58u5owAazAFxTQnwEEikTAieMa81NBSNK2rAes3AfUiGI2VFtuuhosuTaQJUklGpBLD2gFrWX4CgzJqzCSO/SFmK6FslQHEC9jLQ5A30d+YOZBywz040gm1Xkt2NZtPpHrKKZVl4NfMhlKuCDcl3xZXDSNSZ0hxmDwv1jZCrYUUemvstqUxLHfFhdbeF1bfzwLRDnZ8i3gPItr+eT/MQyhMjqWdGpU3OiZE3tfYR5ZBtbA/lakGFX070Qu75KFGg7rhDA9YFfIUxNIyqo85vPKf5CwvOvkJgI7GHdfkU9/qJnu4VOiYHmNG4GxPHLXuGe8Fdqeejt1SCvMBFlJeEaOiJJ+4hYFBqXMUVvV/lcbLbm7tPCYvhZrqs0MHxGa8Yo6x2kHcItJCKl9I3XaUoaMX3oPsiWPVJ4lYYsLluTdxfRt0UQDpkz 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: Sergey Senozhatsky Reviewed-by: Johannes Thumshirn --- 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);