From patchwork Thu Mar 30 10:43:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193860 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 00234C6FD1D for ; Thu, 30 Mar 2023 10:44:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BF706B0074; Thu, 30 Mar 2023 06:44:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96FD2900002; Thu, 30 Mar 2023 06:44:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 811326B0078; Thu, 30 Mar 2023 06:44:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 71DFC6B0074 for ; Thu, 30 Mar 2023 06:44:12 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4715D1C60F9 for ; Thu, 30 Mar 2023 10:44:12 +0000 (UTC) X-FDA: 80625229944.01.6173E33 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by imf24.hostedemail.com (Postfix) with ESMTP id 32BAE18000D for ; Thu, 30 Mar 2023 10:44:09 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=jUwhR2oN; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf24.hostedemail.com: domain of "prvs=446327cdf=johannes.thumshirn@wdc.com" designates 216.71.153.141 as permitted sender) smtp.mailfrom="prvs=446327cdf=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680173050; 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=fBgtsJyXk0EAT3J0eSAFsyV+pbYcdx/VRqTHS9gHVxo=; b=msEmroU2A8PSjkaJRQ1WBotcqW+bHqzKRZlZnFm/mItx+9ybQMapdU4vinX2nBy1YAdzC/ 96qgYN+6vBWENZ+STpqbdamZhJDufn8jHyU2gbgvmJQOoH3+7DbU1MfjMgXprPiaxOTnki UxjDqdgq/7DPazHFQqRWeecT0nw3vGQ= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=jUwhR2oN; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf24.hostedemail.com: domain of "prvs=446327cdf=johannes.thumshirn@wdc.com" designates 216.71.153.141 as permitted sender) smtp.mailfrom="prvs=446327cdf=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680173050; a=rsa-sha256; cv=none; b=8q+yWwZD160rHBT7vn60HB/lY31iaGUfPLodEZH68oM2qlhCy5ciI7GVMU8wErKN1Znu8v aY8Y4xAJmj8UqNbQGXfa0WjZJbxr1K+78sQQyiBwnMVNRCRh1CcE3tnrOw5iOEFhMlOJea SYwHbBwYrp2R+GKKWL+5M1c9zJXL3JA= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173050; x=1711709050; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MeMNKZaQHr+yr8lVVtTFZ83iufEDICJEVqW1zFBrgYk=; b=jUwhR2oNjBmyaBZoHl8QVueIkwRGpup7i16yYMPeHW+oH5a2Yj5IGGzW fcjQ5SSryDcEGyEy/woSCNf6dZXc6RjDhtTDULlx9yB5kvwal5fYpy0Rf x4WeY2TD4JXbKwPqdLigU6nnlR5sjBuN56IicAqUnUOlM67BctBX0SEBd j09GVUsN3c/hjjnY2nD/DZNEGIdkkl44oG6wl7yGOP5ubc36mqlYMw3gY AIak+zBryx+7heL23V16CVSnkDcuTFJlEtM2KPMVqYTAKSEssvqX5LQMr Zm9M4tq2BKyLVxJmvqZhl3fyYs21XZ3L/550dNnMhpwM9WjdZtOwktAGu A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="231853884" 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; 30 Mar 2023 18:44:09 +0800 IronPort-SDR: nXNWbhcjRaVLSPPddwrx61jSTqKIemPcLveEhmrJdXQUAuHAC0JD2wEHcoAYsdZjMdZSM8pgId BKAk5xaHzEET/HPaXHhVidNtgt3lT36vezMtLQFTvM9duYkE/JotOxYhm06Wrba8XD98ZabDYU PVZEfYPWm7Xx3aiJ5GWgs4ILC+FzAiT9sklaRlokKzThMhjl8A06y6EejyKSgVIVUgLvLXiqxT r/A7WC5xnUYy5IJ+/7bWMWmnU5hpk1ql9QRrHR9p7v8+g23yngeWUWcb17kOsmbUvuD53e3t03 /nI= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 02:54:36 -0700 IronPort-SDR: irX6OTnvg9dw1UMM/jf7hWOL5xe43IpHWVi+biFSVu6y2d/gmChxKlBzDVHMcPFGp/PtB7lqMk pBd6N7vcJjZegk2VaDw0/5ijey8D+sko6yUo9ep1HredzXQL3kXwoHvQPgPQwgLytjM1orqSW7 qft4pnKuKQ2O3XfxcS2iqqLj68WmBpFjU48f2PwSRkyTtwxu5wYQn3fHIka8vzMjRF5aE80zL8 5pWdl7OIVMeXoW6bPQzgsDJLAEL2hVYT6WjK3Ym27QSIeOu/Mm/2i/OBfOoisD6h4Rm1EKjgoI tzE= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:06 -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 , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 01/19] swap: use __bio_add_page to add page to bio Date: Thu, 30 Mar 2023 03:43:43 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 32BAE18000D X-Stat-Signature: tpzp68w8b4kwpuon7ap55xcdqjjdgzh5 X-HE-Tag: 1680173049-449990 X-HE-Meta: U2FsdGVkX1/lviz6A6nuwF33aJ186jMfboWZjZjHAqaFeJYbpLGsqILslcebREJuKVmRW3pmGhdxmxq+UmOsPEX30Ozv+KyWlVF7+hz7b8qpt9BL0dvDsMIXg5Ec2O/qEeHj2BhghQwHOLrxLAFKfW2eujxhQUwetQdyIHPMKlFtKTtLh2Q9/ABJU0p7kaeNYoezUciHs1nhwhi/LrHyNiTmho1zN8f7t2BwYRpICdRJFJ4ZgduzjBhnh04CTqmH3imz4eIHGw2QWn7VBe0qE1FB0w+ai5DINqYa6PuP+tJW/CqxZoHYByTcPxbdPYQHjVf3U+OEa5xqdZ4zReC4NMmkotY3Y/TmRzT/4Xr9d84tfsxjfdo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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. 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); }