From patchwork Tue May 2 10:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229065 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 6496EC7EE2D for ; Tue, 2 May 2023 15:38:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D4B66B00A2; Tue, 2 May 2023 11:38:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 884796B00A4; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 773566B00A3; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 488006B00A2 for ; Tue, 2 May 2023 11:38:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9iZj44wPsEck0/AFW/flWeeHkPYU6GMDPlSCG+jgWZM=; b=EGG6R8iaKndUACcD7dVueaa/c8grOURztyqdQbZ+6UzOo91MV6GSEIiA y+YrkViich10rdo4Lfz/yYiXT8LvbIPxs3sMLWmShTX4p8h0WZsU2jQGR 4OmukYoAkgqT70mY/KbME0QW9w3m3IQoc/ss+XKpUkGCg+Pw+k/OWqnNo jLxWj1aSrGWKS/94N5wPKIXgmS85/L80+EH7/KBEgrWq4kZVX5CpMbNnD TDPzKB0OHzyGzBQ16wXwTK03Z8uDkXs5anoXC9yTsGt1fnvFKYYYgCrWH BlwpnvsPlQ7k4Ie5N7NsQKjl16abHRWRT1dbcDzJvHRMu5+U+KvXKvPnc g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672818" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:20:40 +0800 IronPort-SDR: SGyz/sl+jllOj0ijlSlu1PRkWY9dqP58HzNyrDDXwB6fUazJ9roI8ONFngrIkbRAZJoBMl/uqN UiuoQruOxWBdpv9CFyZSHCfCa8a5ScRlTradPVYy4Ya5KT8JfTpLoSJcWX1QCrKEYgGHkXJPec IP2NX1okaExQ9fQV9gqsC7+b0uT/zXXdt8/nKLc0EiEU9fwIhIKqpyIW4yPEoTjNl/7KBltck3 otoQtc6UmsNFfxa6NG8dSAwiuML/ExzbYWGCw1kMInP+lqwhZDfbSVmhehk/qrlDXsJz7J+J8Z J/s= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 May 2023 02:30:27 -0700 IronPort-SDR: 02ts8M2ULEXIIQnCeKUUXKET2iYQVZOPeI1lsh12iKPVk+qnVNbuJKmlBBWt8kg6vDqANkUPjP S88ZBNuvUPdOJIVrPg/7LZtYELJoOWVn7WGdO66mTrgszCRUCBkByH5V0TlXgfYP8a477LSy47 8PsG57T0aCd8AhDDweyJ+TxqQuuSlzTrnnljw73aoxjoLO24lM+jJrGrwmoTvR0RGn4d8si2DH oPX5IDnKX5tdhmZVSe+A4YScdD2m+NHjpjZHCz65IpUJaZ8b+bdBmJW9nFreuq8/HgVWuI80RN TgM= WDCIronportException: Internal Received: from myd008205.ad.shared (HELO localhost.localdomain) ([10.225.1.100]) by uls-op-cesaip02.wdc.com with ESMTP; 02 May 2023 03:20:36 -0700 From: Johannes Thumshirn To: "axboe @ kernel . dk" Cc: agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@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, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v5 01/20] swap: use __bio_add_page to add page to bio Date: Tue, 2 May 2023 12:19:15 +0200 Message-Id: <20230502101934.24901-2-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230502101934.24901-1-johannes.thumshirn@wdc.com> References: <20230502101934.24901-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 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: 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 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); }