From patchwork Wed May 31 11:50:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13262039 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 C6F18C77B7A for ; Wed, 31 May 2023 11:50:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 537456B007E; Wed, 31 May 2023 07:50:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BF836B0089; Wed, 31 May 2023 07:50:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3394E8E0002; Wed, 31 May 2023 07:50:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 279146B007E for ; Wed, 31 May 2023 07:50:59 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id CBB8A1A0367 for ; Wed, 31 May 2023 11:50:58 +0000 (UTC) X-FDA: 80850383796.11.6317DF9 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by imf09.hostedemail.com (Postfix) with ESMTP id A63C9140012 for ; Wed, 31 May 2023 11:50:56 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=bww8YBl5; spf=pass (imf09.hostedemail.com: domain of "prvs=508ef2a02=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=508ef2a02=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685533856; 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=k3hMRAQMYQcYNWszibpiO+E9S1oS0CQ0TSI3hF6nuSc=; b=LFm6HEvr6ZGC7BPhKES5b61pNbUA1jjNF32Tdag4IeKukYJ/FFPvg22/vvVNvSSV8c2kth O+FEmFef+KKKUFa5vm3OOForHzarOkeaS1nyiJ9wsyPoNpn/aCQn4atBrPRleKpsG1d89U 47iEsfhflBwMomsmcHqaJXyScSybfyU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685533856; a=rsa-sha256; cv=none; b=fdZYC1wmJm/Fy2MPDSvKU3vTESHJPwxgeIuacMXQgI9dmhHHC2ASTzYQPAUFRWSEnIrgSZ 10FIaFzqCtXOJQtluI/h2tWgsGt97+NwmPx64hJWZjeSTOHRonKzzQ5theZEEj76e5bRPU W7QO/dwjm7/vM79087IiqS0x25AUTxw= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=bww8YBl5; spf=pass (imf09.hostedemail.com: domain of "prvs=508ef2a02=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=508ef2a02=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685533856; x=1717069856; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aVyQaNpmt9Kkl+oyJUnsIhsYw5Ss9yLQpVI9KGKLjIM=; b=bww8YBl5K6VZzwdwNIR5+YOBVhP0wV0vDIISEwbBplnpvf2Zj9kf4gge hFnCfGFnPlrD3Tnbrfz2hPBU5yNTegfQO3+CcpKBSi1oVKpOuoDzOvRKB 7xXKG3yr1Kl1HKtC591Sw9h2alHoEyx0LxFPYxQ2Bwo2U0JEf7GtzZ02E lp/znwBLR6j7gbwrltjZiqK0BLQkIwH+SIqbDUFRUHumtLDe3uG08F7Xz qOjPSgDZXLwatcOwkHy9HSzeKYwlg+bTlOn6yZBPZTBE4WIxRU730HzSS h2fW797oGD6Kt2g8jl2mGMxWx8mhRAvTOPIs1ectOQpELuNJD7kPdcZrX w==; X-IronPort-AV: E=Sophos;i="6.00,207,1681142400"; d="scan'208";a="230207387" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 May 2023 19:50:55 +0800 IronPort-SDR: 2lBaoR/eQTvVKqgIW6hSIZYRMk+Ocs55J76oS/ccCpbIp9OUxpOQ24uw6Exjah44wvfinUTmMe iNzeVt5QCL6eH1EEmwI/njMtJ/uaA6Eq4BmRD89M9q2v6qVP2Y7Vpn4pUFtidaH0hMyJH6+0v8 TD5QUYiHKnwMMAk6QNGyRQWAMZ58ag82rVmzEA7rNx5P9WwxxIkRu/nh3U3OdGLL/MNEtKnqNa AI0Cj46ksxrdCmgwyZIrzWkRU4LeQpw9W6coLWVKlbcmpgV4eb/54HVv34vflNGbq69+ZbtP9Y 3Qc= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 31 May 2023 04:05:48 -0700 IronPort-SDR: KMtKG3JscatUziqjy7U7g8MSjyjZduOIxvyAtHaf8bQdNgmZPg/ejiyqNoiFm9Z5/dVstQGVpT gUAVKI2lRv/nFQcZFAJUyKS1dF5x+TDBoaUIItPfUSTYOw4cP+Lp6QU2dYeMMHn4BfmSwznJBE LF0WLyvj8M+QVpz9qWs5bLZ0PjrwLDk7VacaXMR7BDRrt8W4RUepJm4j8fTf+uh4aQsOebPGEQ VyepEwzZ/olV1vKjxxd7loGn5w/rIFNdqqFPwuOl/iBlTWTDr5y1W7oR6Mm1kXTtRz+syTHmsM o3U= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 31 May 2023 04:50:53 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , Mikulas Patocka , gouha7@uniontech.com, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v7 01/20] swap: use __bio_add_page to add page to bio Date: Wed, 31 May 2023 04:50:24 -0700 Message-Id: <5bdafd9de806b2dab92302b30eb7a3a5f10c37d9.1685532726.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: A63C9140012 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4enjdwhjetk8qafm849h4d1e9not5x45 X-HE-Tag: 1685533856-938949 X-HE-Meta: U2FsdGVkX19sAqsnNkgOVZ7EJvJCPo4eYUCPZTIQM+WFQT21aHRU9+HirldlSGgB27hQ6YxVNCK4jcXdPJiJg3/5G9oMj41916j+auH0Xjkq6sKGVL9XeBlpKArJSStwMiu3+hnvQYaYkV22+77VRt/hjIxbIpgk6GU48QhfCEEy3E48IC5pOJX1apnMHY44pHov6P0gW/oVfHyM8Mdk/HtOtWQgEIZlFh/37DxAa1TkIdKOVlWzAS3XiUowMD3e+3XeD9zGtAUZaz+g3pvK3q1ym8hex7tx4rzAbYUMfJw49xjMSv9h8HL4IoOKnPnLz5ST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0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The swap code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Reviewed-by: Christoph Hellwig Signed-off-by: Johannes Thumshirn --- mm/page_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 87b682d18850..684cd3c7b59b 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -338,7 +338,7 @@ static void swap_writepage_bdev_sync(struct page *page, bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); bio.bi_iter.bi_sector = swap_page_sector(page); - bio_add_page(&bio, page, thp_size(page), 0); + __bio_add_page(&bio, page, thp_size(page), 0); bio_associate_blkg_from_page(&bio, page); count_swpout_vm_event(page); @@ -360,7 +360,7 @@ static void swap_writepage_bdev_async(struct page *page, GFP_NOIO); bio->bi_iter.bi_sector = swap_page_sector(page); bio->bi_end_io = end_swap_bio_write; - bio_add_page(bio, page, thp_size(page), 0); + __bio_add_page(bio, page, thp_size(page), 0); bio_associate_blkg_from_page(bio, page); count_swpout_vm_event(page); @@ -468,7 +468,7 @@ static void swap_readpage_bdev_sync(struct page *page, bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_READ); bio.bi_iter.bi_sector = swap_page_sector(page); - bio_add_page(&bio, page, thp_size(page), 0); + __bio_add_page(&bio, page, thp_size(page), 0); /* * Keep this task valid during swap readpage because the oom killer may * attempt to access it in the page fault retry time check. @@ -488,7 +488,7 @@ static void swap_readpage_bdev_async(struct page *page, bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); bio->bi_iter.bi_sector = swap_page_sector(page); bio->bi_end_io = end_swap_bio_read; - bio_add_page(bio, page, thp_size(page), 0); + __bio_add_page(bio, page, thp_size(page), 0); count_vm_event(PSWPIN); submit_bio(bio); }