From patchwork Tue May 30 15:49:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260548 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 7CCC2C7EE33 for ; Tue, 30 May 2023 15:49:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15605900004; Tue, 30 May 2023 11:49:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10656900002; Tue, 30 May 2023 11:49:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2641900004; Tue, 30 May 2023 11:49:38 -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 D600C900002 for ; Tue, 30 May 2023 11:49:38 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A823B4027E for ; Tue, 30 May 2023 15:49:38 +0000 (UTC) X-FDA: 80847356436.19.1FEEB2C Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by imf17.hostedemail.com (Postfix) with ESMTP id A1FC440016 for ; Tue, 30 May 2023 15:49:36 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=kC5Qj+vv; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf17.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685461776; 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=JFwZOevzZPaYPPGYr1w21C+cJT0TV2LMpZApShUn0g8=; b=vq79hNE1iJC4R6VB4/sgFuMCLK8Y3KpjZ1Ujh3abjQCmsAXYs1WZDc1o/cLCzsQ9bEq+K1 elqDhtbb8FVO7snFczrkArRRw1SK2NGeu3IhXQgodAPZh10lwTJGMIGcsMLYB2i0i/Z3fO RDrbmAHk+nWBrBGTMJcnYfY9t7teQ+U= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=kC5Qj+vv; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf17.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461776; a=rsa-sha256; cv=none; b=lQKasypZUTsiKZxoNmNBDz4gfiTJ2+4m1jQDELerLbE5SbuqDMnnZy3Iykf1EiJmsUWu6B YpRmX6hnhGDK/ktGzJswv0/xe+m+nsC4EyRRuofZ6BoccIFrBWMhg4+oKprQqh2ufHCtlP xsAGV4urYRkW0JYYqZhNfuTlYOJi4m4= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461776; x=1716997776; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QmZzem9nS4IdX+YpMPH6/hkU8Q8851NfFydLySYg+TQ=; b=kC5Qj+vvOOtPFnroDRvpF9pfvsRmAWdKK2g4d1m9o2DuIeJoY6cytBJL 8xbCyxYD/AGYVtMJSWR5yMuGQqduQZByqMlnlNWkhZzBVQb89dMdNnSgO lZ4Ef1gn5xKvnWXBHywxmtBghmBwQwYFJFVMWDQxvbAlZY9wiR6FnXAOn PJqgle037yfOgPq36S1x63e87dd6FcHNqreWjHQpYtgMK4C6vYVyR7U9v CqIrDu5hRCnPd9b4DRrsHg0Tti2p/EGetANoTui1qnaDaXtJIMb52xSe8 MgbUunKFYP890MF0Tzv+IbnHug8KbYhCIffcHFt63QR6V6tRx5+JpeKrP A==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="230129730" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:49:32 +0800 IronPort-SDR: x41onYIXkRbNBnXaZNvdGYvVoNji8y47r4WbgWL6UceiTO3TTyVZuPu2k43gjyjLa17uvT9XTO nMm70PzTPnFBOywCSg16QtywiH28M+naXwWyu9tYDbSarSQJDf9rSwzLTJNK0tWXBcA8Dq5KOB rJqXLS6gwYtGIgSlM18mCBv3Upg9sYYJZhRNeveuszv3uXdGMnLXBVHNbx4xYJhNpLbQ0103RU lgEBalgKXP049l7h6WbTSaIzSznfY53jnXbLnD0Yid29gUXR94lipn4N9GMJZ8TXZKR/dGkkpp b84= 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; 30 May 2023 07:58:44 -0700 IronPort-SDR: MYtng4S7szwYjmaxW/lAI1po1aVI+hTjdUIVPGMboe1qhLkMmlIPBx55GCHPb7iFjshgwqgb14 taHOFDWoBB5QsexrzNlhVmGiIcOK+oldoY3/MpOlT3CcL5onketnanRTkYr6ZmC2FvhSM442mz 17UT2jJ9dXq/oFStL90HimJSMt2PrDkDWQR2G05pjD2qMu0xYmDRYB0m13nqKi5P34VcIS4KVl n0sZXsW5hHYHRvULOtbMH2PTcIdjRzQbfuLkG8GBoOKlbeAFN0jwHUkWg8F+PstTBRqzjOtvYO Qiw= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 30 May 2023 08:49:29 -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 , gouhao@uniontech.com, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v6 01/20] swap: use __bio_add_page to add page to bio Date: Tue, 30 May 2023 08:49:04 -0700 Message-Id: <64f8ac179cc54aa316c75aaadd71e107ba12917d.1685461490.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 56m9sig7jjwtb6pnop9z8k63yrrqm9ui X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A1FC440016 X-HE-Tag: 1685461776-518465 X-HE-Meta: U2FsdGVkX18nnmo4+Kxvtd9ON3DbYlF6I7gU3Lre82PM+NJAg6cb2bAb4TgcDfWwOdq/NKeocvG7v7dLyYk2euCNt25HyZGUG1oi1vgKENHofYZf7bSyw3sXc6W3N2QB41fM8U5lOrtPFjd1C/mzpE9BJUIjSvWWjiCEv7fNre/do9urMjS/Y5uYavrcd+0M2PhBG9AEj4dYy9M+7OP6dCrDcngSlLuj8uV/WclzIf7QjnEaartRkuwBlOD5NCO3vSBGDlhTHH6U5qYFhQOW4XXEuuwHMvAZW+arnEKyhRtwX30yFHFpI5HhQ0xujnSNwuSqWvfjHR9yZb9WbVG15iEXDK8ajJNyKYeOOqt0OT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ack.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 Reviewed-by: Christoph Hellwig --- 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); }