From patchwork Thu Apr 20 10:04:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219538 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95E7BC7618E for ; Fri, 21 Apr 2023 06:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059678; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VJszvnJ+TqM3GM26l2EpRDhvF8x0IeNjl9ED0+S0tB4=; b=OfEOfVPypJi3DRgsBzhTcZ+1RDARKHMkdGJo13h3Z9u9ZGJlBOYC88eAgSrCFPqLJgIN9F Eec+gVcDWuRZbefCKGcztr7DsDsX3ZXSeGLROer278KkANh3Q2w2x0lQ0nfeaRj9zXVRwm 9Us5juDkvJasAcFtFkTk+rZMSk+fqVI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-359-5Izw1gRyPvKJ15cupNLkYA-1; Fri, 21 Apr 2023 02:47:55 -0400 X-MC-Unique: 5Izw1gRyPvKJ15cupNLkYA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C2DED884EC1; Fri, 21 Apr 2023 06:47:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B05F520239E0; Fri, 21 Apr 2023 06:47:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CCC291946A7F; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B7AC61946A48 for ; Thu, 20 Apr 2023 10:06:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B6F5B1121318; Thu, 20 Apr 2023 10:05:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF2C51121315 for ; Thu, 20 Apr 2023 10:05:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90F833802AC0 for ; Thu, 20 Apr 2023 10:05:54 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-gsJBDDViNPGxQSV3rHfyAw-1; Thu, 20 Apr 2023 06:05:53 -0400 X-MC-Unique: gsJBDDViNPGxQSV3rHfyAw-1 Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-2f3fe12de15so281764f8f.3; Thu, 20 Apr 2023 03:05:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985151; x=1684577151; 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=gjglIoVITB5zWpLDEqa3rtV1/2OUTlj+QZRPa9LziUrRzroj6Xkb3wfMA+N0lR8Akw PRfzNZwXusxeeFrdoU0i2lq5G+MMGjX3IeYxWEW4hGS7kwIZNkIuHIrqRROiyUTptivR UMGiXO/IMDNzyR6mJhMmEbHhp2gRKc8hfWegtI/UUKlka0gTLw3FmiHuR4YN5oe9+KuZ wLag53TRDevzYhDjTxioH66EV4ZtUldthsnhiCFQf6TkR4GM+vm8nXXJw6BHz/yk7IRO xB5dyirg30p6aYJP1kYbZRh0RCT3HAUmK40tzfLF+vYqQ5HBnRZD+NY2gMUl2Vq9yKsN C+LQ== X-Gm-Message-State: AAQBX9dR1FtUClCfxgMaHMLGDatIlATqGw+c+/WBkaMWx6HA9Ycqw5wf 5JgTgOnHBzWdWE3JnOCdMIs= X-Google-Smtp-Source: AKy350ZJizpAlK8UcdkIuYKpQ5Y/PZoh+EKKcTgVEjvN6d0zqGLWnY/auHncEOXRAbbDYcB+iyhuyg== X-Received: by 2002:a5d:6149:0:b0:2fb:9dbb:3407 with SMTP id y9-20020a5d6149000000b002fb9dbb3407mr833176wrt.51.1681985151089; Thu, 20 Apr 2023 03:05:51 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-208.dynamic.mnet-online.de. [62.216.205.208]) by smtp.googlemail.com with ESMTPSA id l11-20020a5d674b000000b0030276f42f08sm201410wrw.88.2023.04.20.03.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:50 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:40 +0200 Message-Id: <20230420100501.32981-2-jth@kernel.org> In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 01/22] swap: use __bio_add_page to add page to bio X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shaggy@kernel.org, jfs-discussion@lists.sourceforge.net, linux-mm@kvack.org, dm-devel@redhat.com, hch@lst.de, agruenba@redhat.com, Damien Le Moal , willy@infradead.org, cluster-devel@redhat.com, kch@nvidia.com, snitzer@kernel.org, ming.lei@redhat.com, linux-block@vger.kernel.org, rpeterso@redhat.com, dsterba@suse.com, linux-raid@vger.kernel.org, damien.lemoal@wdc.com, song@kernel.org, johannes.thumshirn@wdc.com, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org 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); }