From patchwork Wed Apr 19 14:09:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13216872 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 3957DC77B75 for ; Wed, 19 Apr 2023 14:10:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89B4F6B0072; Wed, 19 Apr 2023 10:10:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FD15900003; Wed, 19 Apr 2023 10:10:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67713900002; Wed, 19 Apr 2023 10:10:33 -0400 (EDT) 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 56E9A6B0072 for ; Wed, 19 Apr 2023 10:10:33 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2C8A21402CA for ; Wed, 19 Apr 2023 14:10:33 +0000 (UTC) X-FDA: 80698325946.09.21550C0 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf04.hostedemail.com (Postfix) with ESMTP id 56A774000A for ; Wed, 19 Apr 2023 14:10:31 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681913431; a=rsa-sha256; cv=none; b=SyzDpSzbtXJLy+rchDMcEYqMBXFh3APHLZPzgZ99IqLz224g3xsZC+4YOZRKKYOolwGifi zKNHp9z7cyUXcszoes5YUbjwdCrs9/d4K4U/xDmRGgy0I5lvom/RJYVvSVKVh6Aqw6nOkB 6TU7S3EbakGBucgCV34+tbCU1CbuLw0= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.46 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681913431; 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; bh=s93ifE1gU+0FrrRIOdnaALh6w14X2Hkv+dazvnzybyI=; b=pLuSgo+jUThfPuBq5jI3PDwBno4IU0wdxe/AayYOJzHy1sgkiBk+NrURAeEQlv7fWKLh+5 fkBLTeXeaG7oPYhSZIZsNdIbfmJc+lUWe9hexPhA5bLKCaSDnBlyymSVW9Od+IQGmB3C2k DlynGIYn3uMCMdc9rv+y1srxTdfz0yA= Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-3f1728c2a57so27999435e9.0 for ; Wed, 19 Apr 2023 07:10:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681913430; x=1684505430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s93ifE1gU+0FrrRIOdnaALh6w14X2Hkv+dazvnzybyI=; b=UTlh9jCAXvlW25j8hVYoQ/kX721TWmPe2qJ6+AOWgGw/YfC4iaxUc2pgYRAB656vmX F9LlXWzKG6w70cpMQhhR1/3bMA0Ddb3ULUOo3oe3rs8PqoUlKvWAPR90eb2eUboNYMQp BokokRkZ8O7aRaFeigH6Ufsr2xOIj9xRtLu0i4aQuz0utDcJbf+IdREkeVDrvOoUX1Ck ZTWqJ3GBOAHaxVtPw6sthJGV6R4FZy6d9K6oZUpy1cxb6xqg/GH8ufNonX/n4F7a9yXO Y0CxU7aqVEslNYUkU/FjwYFEWVMwcHHi/6NRLdZKQXkTuCnBvqwVDNDDdwaY09tDQAkK DBkw== X-Gm-Message-State: AAQBX9fb+z34JNjRt1fbEzjkg02gW39WLKzIOZ1Me4nTPfjZJaZE8mol FcfUaEOIH0aowP7Fhiy3ZKE= X-Google-Smtp-Source: AKy350ZCl1EYTqU3ojhOwJGzyXG93dcv3ZTDUZMe/RLHmSNNl6qs8XKigCD/A93InHHpiT9ONj63qw== X-Received: by 2002:a5d:6609:0:b0:2f9:9f6f:e4d with SMTP id n9-20020a5d6609000000b002f99f6f0e4dmr4489637wru.39.1681913430030; Wed, 19 Apr 2023 07:10:30 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-204.dynamic.mnet-online.de. [62.216.205.204]) by smtp.googlemail.com with ESMTPSA id q17-20020a5d61d1000000b002faaa9a1721sm7612089wrv.58.2023.04.19.07.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 07:10:29 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, ming.lei@redhat.com, rpeterso@redhat.com, shaggy@kernel.org, snitzer@kernel.org, song@kernel.org, willy@infradead.org, Damien Le Moal Subject: [PATCH v3 01/19] swap: use __bio_add_page to add page to bio Date: Wed, 19 Apr 2023 16:09:11 +0200 Message-Id: <20230419140929.5924-2-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230419140929.5924-1-jth@kernel.org> References: <20230419140929.5924-1-jth@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 56A774000A X-Rspamd-Server: rspam01 X-Stat-Signature: xp6afn4m9fyqwf4o4qcng37har47npf7 X-HE-Tag: 1681913431-848424 X-HE-Meta: U2FsdGVkX1+qP2rqPYY8jzxD6VUjK279ca+M0SmWLO1AZZTz43UfB0ajOBB11kYY8XOwAzFtu5OoGpedturf3OuVDf5iiZIxN2A3WcZd/TVumpfwClqdegmGqervHcfqpBAcB/4OTXiEF2xOdmNFliksipxzRH3Bi5r3LhHPBzTeF4VsFT2PPtO4yHs3rViY1EakewwlhbK/roYytV3VwCopm3HMKW9rX5E14YQswFRyvduMM0SlTpRBKe5prYF0B3nFJ1hK0tjqRuPZxT6UgYKCzoYXscSKJGg0Dv2nKlBHmiTT0Clx8s0vAzen0X0KIny8KquKa9191SE3SK6HI0bdWydeR15sDXVbM4zET+ATyI4ONy7Zz7tKuoh3XRTMzGQofPZtcnwZsoJkeRjH9Q0+X8eUibr2GQJ1cP6ZzUIEYn2G66R14VcFXyBl1fxYIUvXwY04ANI+sXsq7GHHf3FRGJNVEoIDumwUNyekgfkYlpe9cRnqMI2p1KesT6B7okjKkF6VsFm7IULF/+ReIq/a6BYZhvyDxDILa15PcyF5tsnaSNZbphxRV9O6Dh390ONGTseseR31eMRB7LTHUKWQL3fSO52hIpgFR9djJ4XHgSvJSryI+LIM+dkuVJ5toQvTkSNvCF4krvym+e/g60VfhMYeGwZ9fRoRwhIykdkyArIeqrqUzReNyzyiO1VqrlzvRI7sj22lviJXp5UwSNYPH8Lvv4lqR51IsexmW3nYPK1p/OcnQPy3cwAGD9gJHWvvAO248zG5M8U5h9Sqco+PqJEHpUBdL8MCG1f2DAt/Li71ZhIck0SNMDB2lYytbZ/Ls+WHd2HfSepjMZUXle0tjJY+F5FNaCxXUrgumikDAKm1IYdF7OMPuot64hdGEoGu1o2LM67/Lz4oE6sSGDDnK065/c/gqid+SojGIvjFRrj9lPMbBQxuTfE2r9O0uH7Buw9S4MfwaLmBjzy C1hzBnMI RFKHAagoyExOh+TtmPcfas7FZHH5Gvd+DBOTkgh4Drs/jTJhUYsc5qFEtSz6u+wITjeEeOrckLj+fJpFNlFZqvmoB4aX6VEvl/xLUXr3IwgSN8DV9VQMIrKCnREorH/c3Ck2nko6saWAFvDS5SQEkDjAH1WmmfR/ib2neAjIJNrctrmHYwUZCHgeKWmYVl4SiMpLo731UjebqbiD9529mnsIGQu3w3VDyaRj+KUlX8quMjHl8f42OveuZmZUJn5xGaRSRQrUml1wZwOzzV3xPFa8gRi/+eEf9UKmb88daGt6gBbMJhbBoqu2mu/DAYTEuKhDIfQC8opk/nA4KPHdMKTS5ZrPTeW9x9vm8GmyFykMScCkDBnYJwLNtbnQJM0FddPcg7s+pm3L8XMlOEQG79XtVFKrEyPuEWGM3Z0Pjxy5Uy6zkg/TGPep1JuCE2sTWlZFgXaPhTC1ORm/areQJDyJCqZWGtaVItvjv9zcyEqJIHoV2kozwRJTVOWMwuOVBBc0OBZ3vdAUFsdSSrqNyofucjx/vnf14fhPmEy8Az0etUzKeQ3h/6t4rcNBkV7ICDbe/L2kH+7yDoLKWJwt0MUhQzYqODFxean7D 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: From: Johannes Thumshirn 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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); }