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);