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); } From patchwork Thu Apr 20 10:04:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219533 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 CA51AC7618E for ; Fri, 21 Apr 2023 06:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059675; 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=/ZMHqUnG6za721S/lLCbTYgKdw0QrrsP6YJ5SxT2Auk=; b=d+vUm3pxNcJ3phKN+bVJE4m3hU2uC18FWLSRPTKOT81m1hbfsLt5Fa8E/LryiqPfKAcUp2 m819uIAvbddONnYyPYqSmhCOu+USitdoVVv54NmfI1NIAH+em6Pth7p+0EsV6X05M6ixkv POXchQ7CRQ2vn8geZ2JuDL0gi9VIg8U= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-w0INrETWON-3sFCCognRwg-1; Fri, 21 Apr 2023 02:47:54 -0400 X-MC-Unique: w0INrETWON-3sFCCognRwg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11A371C0A5B1; 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 4BBDD40C6EC4; Fri, 21 Apr 2023 06:47:50 +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 1EEA81946A40; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E88671946A50 for ; Thu, 20 Apr 2023 10:05:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 39799492B07; Thu, 20 Apr 2023 10:05:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30503492B05 for ; Thu, 20 Apr 2023 10:05:56 +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 11D30884EC4 for ; Thu, 20 Apr 2023 10:05:56 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-BcAt6Ni0PeW3pEsMfF6nSQ-1; Thu, 20 Apr 2023 06:05:54 -0400 X-MC-Unique: BcAt6Ni0PeW3pEsMfF6nSQ-1 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-3f17fdb5062so5425715e9.3; Thu, 20 Apr 2023 03:05:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985152; x=1684577152; 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=orhZa1fQDVNg13Xf2hv14fXxJ7CL2ohR8GPEx9ozulE=; b=N1o12UGEZdKHM90xOsU5QbFPml0B1eggb6ZO2TDKQdbXQjh9ewn653wg5EQXc4Lxed AtEOjYIUJs80+Q+MdB2HyS2wJkjUiOFUTcn+MCCdcOoosI37YA1i9Vtq/SxpbJmn87kb jnecQp2VhQzL2qd79I0Nb89jkmD/+yWdTRGmfCFb9qqJPgaemCYsTTzBTXMwxxiG9sI9 k69zuK5P86PkK1ZjjMrvDOPUHbUcvR7g/Zf9iRtTILkvkyRYMrxO1/4zg9F8p1z7CiHw 8xfE77WeszCfTWSA3ytcy0gj+2SnWZpUH5R5fF1FX1bCKSWmcbvHjbVtvr88orrUDuxc ZZ2Q== X-Gm-Message-State: AAQBX9dh7hNYdghEtmYy3vr7KZi7wdtgCSsiD3uzboY6aZqrTld/QwQW 4GKkGh7j9XfzK84wzNUWGag= X-Google-Smtp-Source: AKy350YNyeG2cTb3eTw6bH6AN4pc80O2KEoYo8kkUjtKZC1m+QcG1wLOsIVfaGc2U7URhzf/vvK0pQ== X-Received: by 2002:a5d:52d2:0:b0:2ef:a96:293c with SMTP id r18-20020a5d52d2000000b002ef0a96293cmr741768wrv.13.1681985152448; Thu, 20 Apr 2023 03:05:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:52 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:41 +0200 Message-Id: <20230420100501.32981-3-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.9 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 02/22] drbd: 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.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The drbd 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 --- drivers/block/drbd/drbd_bitmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 289876ffbc31..050154eb963d 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -1043,9 +1043,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho bio = bio_alloc_bioset(device->ldev->md_bdev, 1, op, GFP_NOIO, &drbd_md_io_bio_set); bio->bi_iter.bi_sector = on_disk_sector; - /* bio_add_page of a single page to an empty bio will always succeed, - * according to api. Do we want to assert that? */ - bio_add_page(bio, page, len, 0); + __bio_add_page(bio, page, len, 0); bio->bi_private = ctx; bio->bi_end_io = drbd_bm_endio; From patchwork Thu Apr 20 10:04:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219550 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 639B0C77B7E for ; Fri, 21 Apr 2023 06:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059686; 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=6ZYAULUuXKhDV45BBK1WBFUkYr9gn4PqQ0XsojMCE1M=; b=ExcwQoAlzSIZDWTbGVOduLnLjjCOnbwaLrPs2R5/uOQwj6Ni8i1U4hsbqIkmNDVbalCuX7 FjfnvV96aQR+rR77Nzi8KMupRnN0L28kIXbtJBDhRwg25WFHuuE94A9Pc/YBub0+OFh55f RXjNuWGnvuGh+pzw/MLXd9NkTpGhmMQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-n9RDcfQTONuyo24pshifOg-1; Fri, 21 Apr 2023 02:48:04 -0400 X-MC-Unique: n9RDcfQTONuyo24pshifOg-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 387F738221DE; Fri, 21 Apr 2023 06:47:57 +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 20DEE2029F9C; Fri, 21 Apr 2023 06:47:57 +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 16BC91946A4D; Fri, 21 Apr 2023 06:47:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0CE871946A6E for ; Thu, 20 Apr 2023 10:06:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4600B40C2020; Thu, 20 Apr 2023 10:05:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DD7340C2064 for ; Thu, 20 Apr 2023 10:05:59 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 218CD185A78B for ; Thu, 20 Apr 2023 10:05:59 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-Db0YBNczMkaA7HTo9AhAgg-1; Thu, 20 Apr 2023 06:05:55 -0400 X-MC-Unique: Db0YBNczMkaA7HTo9AhAgg-1 Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-2f625d52275so443789f8f.3; Thu, 20 Apr 2023 03:05:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985154; x=1684577154; 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=asKpmswp0ZeanhVo76Eo+6VNkXdxI3jhQK0PDuQZThY=; b=SoGNF+1gRd5j4S7lSEEoROMnyybta0GSSP08O+cllQ8xkTjoJadnkyV8D1kpMutjUk tzQeJT4yov9A2aoPOleSHHa5X55J06fIqlNCzZyBXBaQ3Gmmeamw/AotSWnssLsm1P2y BTL9JUUidjjVKDa+2C7JTYwzl3IBTkq3AGpm+mmaBY9CO+K21eaSn1vfQFcQ3DVbkCw9 cAqL3ovMKcFa/PKERnva7JD7YeajCPmqWlgXo12A5EHuR+oVY7MSbEGuddIpgp7xV5vs 6/G1jIiV6t8dQqi3wiSyzUpyXZNQUmrzW5OIc5aWDa936DPkaz5M/Upv5eG0KziNQAcs RYqw== X-Gm-Message-State: AAQBX9es3Tj50XP/A67LC8IkyOnbJiaNPFHEHqyiVW4zjOzjTPuRTyIq 4Lvpas1gPlLpXhHaRhI5ZxA= X-Google-Smtp-Source: AKy350aEPjl5npFp/5W8Iqf2usu87C/1xVbllQj+JBJFP+rdftTKzTknJoS6cfDyj7W7tb2o1uXlCw== X-Received: by 2002:a5d:4ecd:0:b0:2fb:4121:285a with SMTP id s13-20020a5d4ecd000000b002fb4121285amr782830wrv.57.1681985153608; Thu, 20 Apr 2023 03:05:53 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:53 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:42 +0200 Message-Id: <20230420100501.32981-4-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.1 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 03/22] dm: dm-zoned: use __bio_add_page for adding single metadata page 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 dm-zoned uses bio_add_page() for adding a single page to a freshly created metadata bio. Use __bio_add_page() instead as adding a single page to a new bio is always guaranteed to succeed. This brings us a step closer to marking bio_add_page() __must_check Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/md/dm-zoned-metadata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index cf9402064aba..8dbe102ab271 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -577,7 +577,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd, bio->bi_iter.bi_sector = dmz_blk2sect(block); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io; - bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); submit_bio(bio); return mblk; @@ -728,7 +728,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk, bio->bi_iter.bi_sector = dmz_blk2sect(block); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io; - bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); submit_bio(bio); return 0; @@ -752,7 +752,7 @@ static int dmz_rdwr_block(struct dmz_dev *dev, enum req_op op, bio = bio_alloc(dev->bdev, 1, op | REQ_SYNC | REQ_META | REQ_PRIO, GFP_NOIO); bio->bi_iter.bi_sector = dmz_blk2sect(block); - bio_add_page(bio, page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, page, DMZ_BLOCK_SIZE, 0); ret = submit_bio_wait(bio); bio_put(bio); From patchwork Thu Apr 20 10:04: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: 13219546 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.133.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 EDB1BC7EE20 for ; Fri, 21 Apr 2023 06:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059684; 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=d98p63t64Ia38/GNQF2P7F7qg83zhj4PqLNuxiNKNrI=; b=OOVA8FwarJEYh9ZNYR4kF9u+eboCPFDApkiGifbGjnJ0YgPsrAVjU0emWglJTYGf2Sx0Yw bsLoB3PLaQOFvBMuRIfMjm7/JDpRYjb18Bh+r9Zp+yrwL7tWeMPG2mAEqQHJ7u9hHT5oaK J3n0Em4fwew7UR6sLRRFs4DGrYbnSlo= 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-262-Wk7IkzwsOFqOxkiExi1izg-1; Fri, 21 Apr 2023 02:47:59 -0400 X-MC-Unique: Wk7IkzwsOFqOxkiExi1izg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 12673857FB8; Fri, 21 Apr 2023 06:47:54 +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 F3488477F7E; Fri, 21 Apr 2023 06:47:53 +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 524A31946A4B; Fri, 21 Apr 2023 06:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F40FA1946A67 for ; Thu, 20 Apr 2023 10:05:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9A39FC1603B; Thu, 20 Apr 2023 10:05:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 927EBC16024 for ; Thu, 20 Apr 2023 10:05:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 762393C0E476 for ; Thu, 20 Apr 2023 10:05:58 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-133-bMGvrHZzOcalGZoPANyDCw-1; Thu, 20 Apr 2023 06:05:56 -0400 X-MC-Unique: bMGvrHZzOcalGZoPANyDCw-1 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-2efbaad9d76so446426f8f.0; Thu, 20 Apr 2023 03:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985155; x=1684577155; 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=THHWtCWhqF512rUBihGspkzbDFWU17ewgGDnTehbMVM=; b=QXdtXfMkXSYiiVesFhMzOQMQ+fpip0enrKstT2ut2AZvz6kUT2XUOtIq3OdRhHj0Rx pXT0kyalXk+lybqK7mh3KVq1mCbUw0WWmEwLihkUV675fSdrVw5jfCGdHeIncxPiwTb9 ayImhIlwyptdyapGkFNubaIHVr82eifmDHvZZ//gTbvmhVTAU5WqPKuoOV2GYJKffQ76 4Ndw5+1rdWbbn3Llic6klPFndbHEETAEcXzH9no+2qaM8Sb8sV2Ai4ZBqikcQEfV+3CJ rZsjukC4KGJtq5JbtsUAtuvUshPmsGE3Zi/a8WHtQiY88NlPD7ZV5v46HBADcbQBPV41 /07Q== X-Gm-Message-State: AAQBX9cvbigcioDRvzRx1sqE2l8Xj8sUa6HQmn7L3Dzpx4HHVnBh7FKa eUngUtAD6GpR0Sfdd/ollD8= X-Google-Smtp-Source: AKy350ZbsU031TtJxFavPxkTZE6B7tUnHyO6WeJiIUhkKTmUeZa+r+aiK8RXIaDWo688qiAVYVDPhA== X-Received: by 2002:adf:e745:0:b0:2ef:8c85:771b with SMTP id c5-20020adfe745000000b002ef8c85771bmr926966wrn.51.1681985154753; Thu, 20 Apr 2023 03:05:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:54 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:43 +0200 Message-Id: <20230420100501.32981-5-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.8 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 04/22] fs: buffer: use __bio_add_page to add single 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.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The buffer_head submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 9e1e2add541e..855dc41fe162 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2733,7 +2733,7 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh, bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); - bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); + __bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); BUG_ON(bio->bi_iter.bi_size != bh->b_size); bio->bi_end_io = end_bio_bh_io_sync; From patchwork Thu Apr 20 10:04:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219555 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.133.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 34C40C77B78 for ; Fri, 21 Apr 2023 06:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059692; 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=rTyu4DXtLHCHJmdzK7gsyEdwSpOGvKIs2jR9bwe6XYk=; b=WwAuSzH28Ddr/2GWYQOgv3lxQp3AmGDMia6w66WxqfbHnfREVCz2o//jfp1uWOvkUgz8bp udTUNXagZ5qLgPteF+GZCcSYy7FHxEGcppdEpPmi/gnCKrXXVqWAHIOjVudRCVyT6iJx2G DEgDFJOLdTJV/3zMvxn0X+mLcA5YntU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-ng7G3ljZOyCysdDGzeqoXw-1; Fri, 21 Apr 2023 02:48:07 -0400 X-MC-Unique: ng7G3ljZOyCysdDGzeqoXw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2CBC1C129AF; Fri, 21 Apr 2023 06:47:57 +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 8F1E11410F1E; Fri, 21 Apr 2023 06:47:57 +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 64FE11946A5E; Fri, 21 Apr 2023 06:47:57 +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 B5C921946A47 for ; Thu, 20 Apr 2023 10:06:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6A5391121315; Thu, 20 Apr 2023 10:06:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 631A0112131B for ; Thu, 20 Apr 2023 10:06:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 3DFD8101A54F for ; Thu, 20 Apr 2023 10:06:01 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-Lizv_sxHObCol-PXk6bxXQ-1; Thu, 20 Apr 2023 06:05:57 -0400 X-MC-Unique: Lizv_sxHObCol-PXk6bxXQ-1 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f09b9ac51dso15220145e9.0; Thu, 20 Apr 2023 03:05:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985156; x=1684577156; 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=EWddmUi1sUqAJfDu3vTNgbuTywHhrfsi4XwupHN4WwQ=; b=l6v6jWBljceB1+HzUYxQOUFZOoH3Dlq1I9awA3QkuSH/DuyKSmq9zSv0duP7Dqja2p LcMiuIB3/K/H+Dm7SiwWsC5chr7cdPDNPT/n9uSjcnpM4TBELUI/d2oFdeLBZefQ1Hyb RBkOlq4L1ERaeieRIxucIaz503LwiGhmd6B/Dj9+n2qccx9C85rhxZRiK2+dncwUFOIl F24Q5GBroxRkhUUY3FLuIa6m+ErPXFbZ64qMp/rckHuks6ppbzkJUZN9SNqc3WmqA2iF Yc+EXNZuARk+tbs1EVo2Y7sP6Ilnb9ipiQl6I+vI6HvEjaIOWtUJKW24vUowK6wWhSJq llOw== X-Gm-Message-State: AAQBX9dmiKzUGVPh9XseyNbV9JKc/S4upHwvNkZKljP1gSbJ/R37mSEe S5VR1H9KBWeOqocaQ5u6CeA= X-Google-Smtp-Source: AKy350ZauLkuXWs6kSjBHCPBBCSAVBhubP5jzpCR4qZ4hYu8gg1Jhd0aZ4abYsMUbuSqsM3DfmG2NQ== X-Received: by 2002:adf:f2c8:0:b0:2fc:114c:76e with SMTP id d8-20020adff2c8000000b002fc114c076emr899567wrp.27.1681985155941; Thu, 20 Apr 2023 03:05:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:55 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:44 +0200 Message-Id: <20230420100501.32981-6-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 05/22] md: use __bio_add_page to add single page 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The md-raid superblock writing code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-of_-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 13321dbb5fbc..20b9cd7c2f39 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -958,7 +958,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev, atomic_inc(&rdev->nr_pending); bio->bi_iter.bi_sector = sector; - bio_add_page(bio, page, size, 0); + __bio_add_page(bio, page, size, 0); bio->bi_private = rdev; bio->bi_end_io = super_written; @@ -999,7 +999,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, bio.bi_iter.bi_sector = sector + rdev->new_data_offset; else bio.bi_iter.bi_sector = sector + rdev->data_offset; - bio_add_page(&bio, page, size, 0); + __bio_add_page(&bio, page, size, 0); submit_bio_wait(&bio); From patchwork Thu Apr 20 10:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219541 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 E9406C77B78 for ; Fri, 21 Apr 2023 06:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059682; 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=Vcm9CCDgX1pl9gXL6dMaayXbTml+Wkj4QtJ+UjAnQTc=; b=ZO+eQ2NyGaBQlu6abWdSNpDEA2PxDKilvZoZUPIrsP30KZqFwqbTYy78yjMBFvmg/nXAjw 5hEq9OO88sdLZ4JL5ILmxy4vyVkZkwSCdQKkDmnXUsqXw5Cvrgi4NfhDur/EqP5z9fZrTp CdyjXV7AItTtjLqurBZd7LyXmPo33u4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-RB6ZhcMlP8Wo4tkMLkNbgg-1; Fri, 21 Apr 2023 02:48:00 -0400 X-MC-Unique: RB6ZhcMlP8Wo4tkMLkNbgg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1483838173F4; Fri, 21 Apr 2023 06:47:54 +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 F398640C845F; Fri, 21 Apr 2023 06:47:53 +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 524061946A47; Fri, 21 Apr 2023 06:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E204A1946A4D for ; Thu, 20 Apr 2023 10:06:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 305432026DFD; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2762D2024CDE for ; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 0B82F1C01B55 for ; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-pe4kaHWmM2SijZvG6JDxKQ-1; Thu, 20 Apr 2023 06:05:59 -0400 X-MC-Unique: pe4kaHWmM2SijZvG6JDxKQ-1 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f177cb2c6cso3447255e9.2; Thu, 20 Apr 2023 03:05:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985157; x=1684577157; 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=2Fzr57yVT4AGfP8f/rHc++3o/RNaaVBknK7ki+b7wqg=; b=BZYP+SnaYDrziSBoXwqWBtUjJPvq1i7Q2A79X9BCckoe8P3zpGn6JPbwvv+sfeWCgc BI/eZ1NCAuHNrhUFPgO2t8UWfPXH7J09nYKvLR5SL0JgpLC1nutmpZmcP5nG35Iq00Pt Jvq9IuSTylCPAD7j4a46pke7PHDKK/DkAUV3urQILSkZUhHoc51DjLwvbD3JkAv6fa7A /H0031RkCyV0BKSK3yHOvsleLNW3mlMN1TC9t9qs+3zqQCsfz4wu7sq/X30eaeHvokVY 5V8Pkqby2rQCqNOKpDi6KK+ASP4IWRqkjeM15RYkKofrjazf8lW3KUMEf1BS239P8YWA Q4Lg== X-Gm-Message-State: AAQBX9ewDsV58de4waZOk6yae6VINL3v74fUrAdtRV+XGVmwD7UTLIbY r42E/uMFG710V6LqQJcgtr8= X-Google-Smtp-Source: AKy350bLyO4KQbV/PoPdUqDGkkMZX7ZfuVuX5huOYxZIzQyFuycseqFdIVwkpU3U96njdfQtavhtJw== X-Received: by 2002:a05:6000:1201:b0:2f2:c46b:1eb5 with SMTP id e1-20020a056000120100b002f2c46b1eb5mr939686wrx.59.1681985157174; Thu, 20 Apr 2023 03:05:57 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:56 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:45 +0200 Message-Id: <20230420100501.32981-7-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.4 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 06/22] md: raid5-log: use __bio_add_page to add single page 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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The raid5 log metadata submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/raid5-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 46182b955aef..852b265c5db4 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -792,7 +792,7 @@ static struct r5l_io_unit *r5l_new_meta(struct r5l_log *log) io->current_bio = r5l_bio_alloc(log); io->current_bio->bi_end_io = r5l_log_endio; io->current_bio->bi_private = io; - bio_add_page(io->current_bio, io->meta_page, PAGE_SIZE, 0); + __bio_add_page(io->current_bio, io->meta_page, PAGE_SIZE, 0); r5_reserve_log_entry(log, io); From patchwork Thu Apr 20 10:04:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219542 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.133.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 CA9A9C77B7E for ; Fri, 21 Apr 2023 06:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059682; 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=8DdHPwUVzcX4/LkM6e5iHIJJPSDsBAjLP7w61Ib5S9Q=; b=ZwoFzmoKumK7vTRiQBVrkYpfU2RlntLh6sDSX4Phr2UpaemIKazmxXC1x5KNe2irJVZSkr KZ/woO8n/JPwKlaZ5v7n/BFi8+/t78gL/r11xFfcuTmo7MaAJmzlRKB2/WyZr6swcqvusi LddQ2gNftcAgxilUzlizki/E1cDer0g= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-300-qTNPlyj9PHGazsaspvJhJw-1; Fri, 21 Apr 2023 02:48:01 -0400 X-MC-Unique: qTNPlyj9PHGazsaspvJhJw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7381038173EB; Fri, 21 Apr 2023 06:47:55 +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 5DE0840C2020; Fri, 21 Apr 2023 06:47:55 +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 B6F3F19452CB; Fri, 21 Apr 2023 06:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2759919465B5 for ; Thu, 20 Apr 2023 10:06:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 67A6CC16046; Thu, 20 Apr 2023 10:06:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FE15C16045 for ; Thu, 20 Apr 2023 10:06:04 +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 3F5AF3C0E476 for ; Thu, 20 Apr 2023 10:06:04 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-fdSueKTrNMqswGXZ6oao8Q-1; Thu, 20 Apr 2023 06:06:00 -0400 X-MC-Unique: fdSueKTrNMqswGXZ6oao8Q-1 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-2f939bea9ebso423715f8f.0; Thu, 20 Apr 2023 03:05:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985159; x=1684577159; 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=F5xZASE6AX0FDAF9QaXMQYNUIt4BDoCJAIYtVfQg3gg=; b=RPYf5qP3TFfJ0sOGKFAYCauffP9nhwuLwNRhKzLBl7J3BvELN5pjTNwfQ5AWOMDPN7 lBOjqm+xObMAVcYAvHFyYTxvv7l0VjCneQpHt2fVnou/ly8ECkWxmwCSfuaAKmqa7Rd+ 8iZIL4Ohrl821t5Bf78pXQbWloy7OVJvJFHg+94PIuHwxRI59Z1RE6ye4sVeeinro9+T TXDmYY3r6Yz0VseEGQKKpMsoJFDwQxagasG90Nsmq3M7BqVlchfjx9n6Dwp3vVnQT9vC cxLQJZ2aIxpviAl/4ysgE4A5ZZ+WKNpxLEEXQ+T/VuGJEDLRDU/L8klCB031Il1MbSSR 4weQ== X-Gm-Message-State: AAQBX9d60NPH/YRdawTU4DdrE97WSugcQSTXRMDAkX+CG0vWpW08fJTA 0v5X8/HlMCQ8fOvHat12Px0= X-Google-Smtp-Source: AKy350ZtHgDeegvxG35rcf9J1FTRXDJsZRNH6d7HbvfRC6w+FAYR7ZZW0+ZSIUUQqHYhj0zTMP2AFw== X-Received: by 2002:adf:ebc4:0:b0:2fe:c0ea:18ad with SMTP id v4-20020adfebc4000000b002fec0ea18admr814816wrn.47.1681985158713; Thu, 20 Apr 2023 03:05:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:58 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:46 +0200 Message-Id: <20230420100501.32981-8-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.8 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 07/22] md: raid5: use __bio_add_page to add single page to new 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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The raid5-ppl submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. For adding consecutive pages, the return is actually checked and a new bio is allocated if adding the page fails. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/raid5-ppl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c index e495939bb3e0..eaea57aee602 100644 --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c @@ -465,7 +465,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) bio->bi_end_io = ppl_log_endio; bio->bi_iter.bi_sector = log->next_io_sector; - bio_add_page(bio, io->header_page, PAGE_SIZE, 0); + __bio_add_page(bio, io->header_page, PAGE_SIZE, 0); pr_debug("%s: log->current_io_sector: %llu\n", __func__, (unsigned long long)log->next_io_sector); @@ -496,7 +496,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) prev->bi_opf, GFP_NOIO, &ppl_conf->bs); bio->bi_iter.bi_sector = bio_end_sector(prev); - bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0); + __bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0); bio_chain(bio, prev); ppl_submit_iounit_bio(io, prev); From patchwork Thu Apr 20 10:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219551 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 E471EC77B75 for ; Fri, 21 Apr 2023 06:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059688; 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=0U7KJf+WUG1RLFKG7Mf0Tyar8hIL8pYxZCxpd+Bt+ds=; b=TID7wQ5poBYLY1qvyuLC5P69qYTDxQLQ+peWZD1yR6/qCQRo1b7AdWyViZJ93HWYlLE0Ls GdTBQZp5PdI13DHSFZFZY5RDh2vxZfHmsVPZ9DI709rreiDxb7zyqrxkUGMVLSPwgS9JY0 GYIWK9oN7S0Al1FfHtE2ocGwC4iTQVU= 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-641-v_nP4VLhOs6pdItlg1MGZg-1; Fri, 21 Apr 2023 02:48:03 -0400 X-MC-Unique: v_nP4VLhOs6pdItlg1MGZg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 084CC87A9EA; Fri, 21 Apr 2023 06:47:57 +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 EC0932166B34; Fri, 21 Apr 2023 06:47:56 +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 E02D41946A40; Fri, 21 Apr 2023 06:47:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E1D151946A4B for ; Thu, 20 Apr 2023 10:06:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 19D0840BC798; Thu, 20 Apr 2023 10:06:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 132F440BC79C for ; Thu, 20 Apr 2023 10:06:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 EB7C58996F3 for ; Thu, 20 Apr 2023 10:06:05 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-348-IDjQJ9O1OYGvNBlqian6gQ-1; Thu, 20 Apr 2023 06:06:02 -0400 X-MC-Unique: IDjQJ9O1OYGvNBlqian6gQ-1 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-3f09b4a1584so3685245e9.2; Thu, 20 Apr 2023 03:06:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985160; x=1684577160; 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=UHB27r2VAJYtptv/DszRuaYXLzHwMALFS99ixQeQIrk=; b=aDnEI3he1lao/TE6CVYxv8w1mjm/8WGbMBat9t6PK+UNhCmutfdL5Y8i1L0CZ+9Qqc wUmiPcCMsiWelGMTGhG68PmLZYWzVJ4DwrlPQNaZ6en7L/VNjcGIz6O5ovxgA56UaxNO rD/XuEq0QoeTvg5vdxZL4RZMsrcKWta36R2xfjt1prkjPs4kVcPA8GyXnNXUT7jbiLw6 zfGP/xd3C6UXrJQEqJJR1ogVtEMIVv63EcoUp6Yn1ai4BxehVAraBVoqH0hsc9gOBpVp nuhhTwsW0IHtA4k1IityyUFyIJ7lfn0i0n+k8OVksrXS5Uso/JlZTEQY05x76GtK6UG+ iIJQ== X-Gm-Message-State: AAQBX9d2ywXS8cRsrcRsVAHbnX2cNYRNTeDBF3Pt+Dmo/rc3fX1p3xtf uNt7+KcfKWWtf4z1okwkWqs= X-Google-Smtp-Source: AKy350YxSTxTnEZJlt1GVQL88IhbsHQlCxv5AUQ75S1ft6jRo+CEl5H+9DfaCVJ+16oh6uYY4md1jA== X-Received: by 2002:adf:f209:0:b0:2f5:ace2:8737 with SMTP id p9-20020adff209000000b002f5ace28737mr903415wro.32.1681985159938; Thu, 20 Apr 2023 03:05:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:59 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:47 +0200 Message-Id: <20230420100501.32981-9-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.2 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 08/22] btrfs: repair: use __bio_add_page for adding single page 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.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The btrfs repair bio submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 726592868e9c..73220a219c91 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -224,7 +224,7 @@ static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio, repair_bio = bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_NOFS, &btrfs_repair_bioset); repair_bio->bi_iter.bi_sector = failed_bbio->saved_iter.bi_sector; - bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); + __bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); repair_bbio = btrfs_bio(repair_bio); btrfs_bio_init(repair_bbio, failed_bbio->inode, NULL, fbio); From patchwork Thu Apr 20 10:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219534 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.133.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 1962CC77B78 for ; Fri, 21 Apr 2023 06:47:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059675; 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=WNDYwaP5bk/Zm/B9j57F0qa5FVi0HicHbR5IaazQA7Y=; b=Jduq8hHHQUBPSSfznyqaSc0CsjJ7+O9gWAwqFZ840AKZoN4X+GXR/SiiwtTBmRsgilBA1N svwNgbnAgutH4Dwsgcdg/IKmrW8/k/umiagCl9F9up0oUkscvUOUB44VpiUo3Z22Fy3UUY o6snXAjndcDNtpl13PEg0vFOOSAsDzU= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-kFk9WQXTOPGRlG--eYsVcw-1; Fri, 21 Apr 2023 02:47:54 -0400 X-MC-Unique: kFk9WQXTOPGRlG--eYsVcw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F5031C0A5A6; 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 3C33A2166B37; Fri, 21 Apr 2023 06:47:51 +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 4701E1946A4F; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0BCE41946A6C for ; Thu, 20 Apr 2023 10:06:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D03A440C2023; Thu, 20 Apr 2023 10:06:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C927640C2022 for ; Thu, 20 Apr 2023 10:06:06 +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 ACC62884EC0 for ; Thu, 20 Apr 2023 10:06:06 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-laZuIbxDMROpmbES3Zx6sw-1; Thu, 20 Apr 2023 06:06:03 -0400 X-MC-Unique: laZuIbxDMROpmbES3Zx6sw-1 Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-3f176a16c03so3360155e9.2; Thu, 20 Apr 2023 03:06:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985161; x=1684577161; 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=XSziFxMRLlc78BEY3ZIcArKRUqB+ur0VzFu/o2eWTQg=; b=QnFd/qD7gTdTMUi8S3IC8x5iYL0xdBPB8Rh6NgdkueaUF6budVXfynHLxdFIDNhyaH 8hiP2lbJ4dGn5EFKnrqPhl4GCU0StoDMIw4Jzstr66NZJz/M3kGwswMD/bnc+EjlLeCO l8Au1BLkwPMDFgyyJhxmzyQn4TvZi9vIDp77rnZin3I+WMdeyUOaq+5MBonRvd5TuPLs Kvf7cFOFmyTARxJI+6b8281zsDJIHVt7novw9pMbYLjIgxWhAoVOtsXK5rUfOK7yOopr E/rpKma1WtFlPvS7KAGKVctEvPqV77hf5VlmcQwdBLxqGnL0UmfqtYDzns0iTcPMh8zS IPnw== X-Gm-Message-State: AAQBX9e1ingk1fgu6896qsGWpLuCH+KyGivapyUbJNf3LLLWYa6OrqhQ U9RLF5+zTY8hScP2QxR+m84= X-Google-Smtp-Source: AKy350YaG3KN92VetUrzcVoSFywGceMQufxfAD2B5CXNNTFsILzF+cTK0i2X3r4O7jeyW50fb6yefQ== X-Received: by 2002:a05:6000:1105:b0:2ff:f37:9d02 with SMTP id z5-20020a056000110500b002ff0f379d02mr782954wrw.69.1681985161137; Thu, 20 Apr 2023 03:06:01 -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.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:00 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:48 +0200 Message-Id: <20230420100501.32981-10-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.1 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 09/22] btrfs: raid56: use __bio_add_page to add single page 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.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The btrfs raid58 sector submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/btrfs/raid56.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 642828c1b299..c8173e003df6 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1108,7 +1108,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio, bio->bi_iter.bi_sector = disk_start >> 9; bio->bi_private = rbio; - bio_add_page(bio, sector->page, sectorsize, sector->pgoff); + __bio_add_page(bio, sector->page, sectorsize, sector->pgoff); bio_list_add(bio_list, bio); return 0; } From patchwork Thu Apr 20 10:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219545 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 58D6FC7618E for ; Fri, 21 Apr 2023 06:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059684; 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=QbFS52YonzSRQGXEvYK+qTvhQN/mipmlit47iSI729o=; b=InrRAQK55LzZeGx8gQ/9bWNNOgcOgFlNi7USU4070YSx75DUi+jvQi43YAME69ycs9ZMOJ l1jz/pCZ/FR1qo0oPGbHuUxAYQlQgpQp0xGUkKNRDo1Rffcb3RG5AkQENTC7zRI7OMv+d4 fnL2QKgHX2VMQYVmrsnciYNK6uef9+M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-xhSZT3-UPMaxdL66xUIsqA-1; Fri, 21 Apr 2023 02:48:02 -0400 X-MC-Unique: xhSZT3-UPMaxdL66xUIsqA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5472C280BCA7; Fri, 21 Apr 2023 06:47:56 +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 3E2D21410F21; Fri, 21 Apr 2023 06:47:56 +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 B8B0D1946A5A; Fri, 21 Apr 2023 06:47:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 256C319472CA for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4E8A81410F28; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46AA81410F2C for ; Thu, 20 Apr 2023 10:06:09 +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 2A9FD29AA3B8 for ; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-317-KuxDd7h_OlSiaOJ9G9AdiQ-1; Thu, 20 Apr 2023 06:06:04 -0400 X-MC-Unique: KuxDd7h_OlSiaOJ9G9AdiQ-1 Received: by mail-wm1-f52.google.com with SMTP id e13-20020a05600c4e4d00b003f18e479d9aso38947wmq.1; Thu, 20 Apr 2023 03:06:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985162; x=1684577162; 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=CtDbz8KQ5RO2QKOv20A9cNZoc5bLawdSeLMzRI4Z4l0=; b=Ywx8edlm6foGlcsS6BY3eRE/oSlsOxRwFxbIyyhQEDl2KIjHz1zuDVR8rUh2GdbxoE qmoYJWiSKBJMluwxvtCR+QPa3bQWN5Hu/tQLDlKPY2z0uCxLDFR2xTgH83c98tOhHN4Y m+SmiijGgtPKRmARRBB0oIgD/JTzonRx2fTZfuKsgZ2i8s/zSo7uU/+er1Claf2qHCbc FvwsxogSUxG2Uiw/hhvd51DHrzAXl9FlMi2VAYKEyIfGIw2Suaote8DMZXnZT30BeluR Lxdddtnsmaq4HkRt12Ta4410EZgei8gxtSHQbuonnDKarXNm4yi+90Ue/bOtsbpZ/a9L jqyg== X-Gm-Message-State: AAQBX9cn8gLYexLYjARG0VbfOWoZwmqPhQscyRYj71rmL+1o5vdp8MEY qylzpShFUz+U3AetFf+51vA= X-Google-Smtp-Source: AKy350a56mipr+vcuuvteCVl6vdSUSuvPbGu+8fAW6sNayakzeH2qwRUzfz6kUaOZKyAbztXT40fIw== X-Received: by 2002:a1c:750b:0:b0:3ee:96f0:ea31 with SMTP id o11-20020a1c750b000000b003ee96f0ea31mr908797wmc.18.1681985162344; Thu, 20 Apr 2023 03:06:02 -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.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:01 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:49 +0200 Message-Id: <20230420100501.32981-11-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.7 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 10/22] jfs: logmgr: use __bio_add_page to add single 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, Dave Kleikamp , 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The JFS IO code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Dave Kleikamp --- fs/jfs/jfs_logmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 695415cbfe98..15c645827dec 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1974,7 +1974,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone; @@ -2115,7 +2115,7 @@ static void lbmStartIO(struct lbuf * bp) bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone; From patchwork Thu Apr 20 10:04:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219539 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 B6486C7EE21 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=Bag6PbUn67x8Md42tz7/JgCd4ZbSIkIcoC3KT1GlxpI=; b=OXQzUgtPyo1LjAaoda045LVfyv4jBlkwO6Ky/SisYfYKITVZ3HWrOXts0l5mGlPFQ5owkr 6m1CjRGzoFMxp3x4hO/MADQB9QrhwEN71Gq8qix/M+8XIoK6BV7Z+kHV3itaVB8izr4HT4 3FkgImYefpgplCUDGu5nnpaoxFS6qxQ= 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-627-IZQamXSQPce9o2ZqMyRS9g-1; Fri, 21 Apr 2023 02:47:57 -0400 X-MC-Unique: IZQamXSQPce9o2ZqMyRS9g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 89CC485A5B1; Fri, 21 Apr 2023 06:47:53 +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 76E30492B01; Fri, 21 Apr 2023 06:47:53 +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 1619A1949738; Fri, 21 Apr 2023 06:47:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 27AB619465B9 for ; Thu, 20 Apr 2023 10:06:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 384BCC16047; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30BDFC16045 for ; Thu, 20 Apr 2023 10:06:09 +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 14F31811E7D for ; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-LGbt8nPgO3enwfV-DbEPVA-1; Thu, 20 Apr 2023 06:06:05 -0400 X-MC-Unique: LGbt8nPgO3enwfV-DbEPVA-1 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-3f17b967bfbso14827095e9.1; Thu, 20 Apr 2023 03:06:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985163; x=1684577163; 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=3G8vgZAFagEXL1mcgIvsIV/u4Cz0QizBZkd2HYzCGxY=; b=jaHSKqzdAwzCFXydQ9hDTDj64pzMgRdMaJzp0hNC8zl+ockcBvQMv4wfE3FROK0Vom sX1Ez0ZkLjNvm9cLbKZxxR2un3DFS7etg1JUyYytnFWVfEnB/+LDXXtrgUPO3ttylg1D gFnpX5mY/Hvpfg5TFzoJEZFva8wmmJLRTKa61aGXNQhUdl+X5bA7JDd+dbRU6uNu+6fC 8BX1RxRTl+uzezmzSHvr7I6x9Gslq41n16qDM3Zp4JM28Io0NuPEKG9YyQdNqJEl3ZdY H1v/WOwCENbjzgo/RrPc/Qo9do7ReVQFU3O2zbwAGFpd83nPERHiIDjJrNzoCOjojs3i mMyg== X-Gm-Message-State: AAQBX9fdbTMtaxsD6LA3lk7hGgVYoYGey4ExjM0x2xcaT4YjLcn8IO12 r2eV4vHs4ILokrw0TmsCK94= X-Google-Smtp-Source: AKy350Zwu6RqojLD2/82sYHKfY3An39L6ReZ+83ih6pfN87F+BwdyWXKO+szShokbvWeEtwYoIEk5g== X-Received: by 2002:a5d:544e:0:b0:2fb:539c:5e89 with SMTP id w14-20020a5d544e000000b002fb539c5e89mr1022598wrv.4.1681985163497; Thu, 20 Apr 2023 03:06:03 -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.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:03 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:50 +0200 Message-Id: <20230420100501.32981-12-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.8 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 11/22] gfs2: use __bio_add_page for adding single 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.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The GFS2 superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Reviewed-by: Andreas Gruenbacher --- fs/gfs2/ops_fstype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 6de901c3b89b..e0cd0d43b12f 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -254,7 +254,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) bio = bio_alloc(sb->s_bdev, 1, REQ_OP_READ | REQ_META, GFP_NOFS); bio->bi_iter.bi_sector = sector * (sb->s_blocksize >> 9); - bio_add_page(bio, page, PAGE_SIZE, 0); + __bio_add_page(bio, page, PAGE_SIZE, 0); bio->bi_end_io = end_bio_io_page; bio->bi_private = page; From patchwork Thu Apr 20 10:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219536 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 090F7C7EE20 for ; Fri, 21 Apr 2023 06:47:58 +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=P3j2GxvA4wIyPLyk727CMcvN+KSh+QLo3d9/kVapFEM=; b=ZcHCjrd4H2kqYYb7d++nCFSW9KTpHxG0LuYk66O7MQp++OHAuag2a35E7iYCmztgzLItBh w4Bn7ar26dcK1SGC/x3jHUzNFvAzzyXAoQJdCX+t4h913Iis/8HMFj99W8gQGLZ0DZ9xAb dML3mRFenCY0D5wcCojhoEliMqLnJ24= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-347-v8tGnYmMPn-HmCquqruCsA-1; Fri, 21 Apr 2023 02:47:54 -0400 X-MC-Unique: v8tGnYmMPn-HmCquqruCsA-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 6C8711C0A5A3; 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 5942D20239E1; 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 9AFE11946A6E; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E6AD81946A47 for ; Thu, 20 Apr 2023 10:06:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3613D20268C4; Thu, 20 Apr 2023 10:06:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E08F2027179 for ; Thu, 20 Apr 2023 10:06:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 0F6C2800047 for ; Thu, 20 Apr 2023 10:06:08 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-AwesHehfOqqauHf5whHRKw-2; Thu, 20 Apr 2023 06:06:06 -0400 X-MC-Unique: AwesHehfOqqauHf5whHRKw-2 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f09b9ac51dso15223045e9.0; Thu, 20 Apr 2023 03:06:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985165; x=1684577165; 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=JN1Y2bvJVpq6/q4dmcPnKZ0rBsOm/7Q8Ad5f4nAyRoc=; b=a4iZwxcnZ4aCrE2rS5HRFLU//efTBnzeGQ89ODHsod4ptqi3AFfYRz8hqRMtB7LonQ yFTiFNWyytrshoLuXrwMdu6sXiINVdy0VUJTh8KsMuUMEjgVW3UsjrSQpCPr2voiJDWL qYtHbr5YX1du8AYbExJulsuHN2zxH5aRUSICFz2hUNjrjPGC0AuWSrIO/aGW25Kf4kkK 5IlqYpQyP+JRVj/zAwm+bsKeEV9nzqyWyr9vSVggs1v/xec6QvwnRNBRwcpjvwKd9haS qV4Vxai9j3d6QySWZccEsnb7E6lFiPigpxPirz6bHi2JbN+gi7eNnTjpwuu1Ca4YHJ8U rlHQ== X-Gm-Message-State: AAQBX9e4zMJHbEytEpEgsh/kKVEHKFlCXTJ/TWur+9cBdjMdV+LmuPtn Ekz9n+a5vxLaf6BZZXAWk90= X-Google-Smtp-Source: AKy350bZO9H6VdEX4U511+f90s6OY6x4jbtQEdcc2xOoFywxWKRM3Dh+QbBQ+ZMvXg8fuNS0QB1TpA== X-Received: by 2002:a5d:58d3:0:b0:2f0:583:44be with SMTP id o19-20020a5d58d3000000b002f0058344bemr1030678wrf.0.1681985164633; Thu, 20 Apr 2023 03:06:04 -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.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:04 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:51 +0200 Message-Id: <20230420100501.32981-13-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.4 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 12/22] zonefs: use __bio_add_page for adding single 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 zonefs superblock reading code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Acked-by: Damien Le Moal --- fs/zonefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 23b8b299c64e..9350221abfc5 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -1128,7 +1128,7 @@ static int zonefs_read_super(struct super_block *sb) bio_init(&bio, sb->s_bdev, &bio_vec, 1, REQ_OP_READ); bio.bi_iter.bi_sector = 0; - bio_add_page(&bio, page, PAGE_SIZE, 0); + __bio_add_page(&bio, page, PAGE_SIZE, 0); ret = submit_bio_wait(&bio); if (ret) From patchwork Thu Apr 20 10:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219553 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.133.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 01C48C77B75 for ; Fri, 21 Apr 2023 06:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059691; 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=kXpB421/CzufXNePUa2LWEgklC+TV4eWTh1Q6/O1j+U=; b=BsnDndxAXsCcJCAElNK63/Pba3i3yCJI5/jsDzgKt/gtoHRtO95nJDUHym4hlxCn9cZQ7v V2CfqBHdoV/EzAj6IlaFCIAq20qahpfOURsr0YXXQ6eAR97ZOZSYySRE4mzqUHY9Eyotea YrWF7sow702cqH7AyIEXzuvm7WDf4PU= 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-444-uowynueyMraYqy3MsZWkjA-1; Fri, 21 Apr 2023 02:48:04 -0400 X-MC-Unique: uowynueyMraYqy3MsZWkjA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14D7C884ED9; Fri, 21 Apr 2023 06:47:56 +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 EF9562166B40; Fri, 21 Apr 2023 06:47:55 +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 3AABD1949741; Fri, 21 Apr 2023 06:47:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2557019472C8 for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3C4B62166B39; Thu, 20 Apr 2023 10:06:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 346522166B3F for ; Thu, 20 Apr 2023 10:06:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 CEC86800B35 for ; Thu, 20 Apr 2023 10:06:11 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-8EtrsGKFP8yFNJT52Tdbnw-2; Thu, 20 Apr 2023 06:06:07 -0400 X-MC-Unique: 8EtrsGKFP8yFNJT52Tdbnw-2 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f177cb2c6cso3447905e9.2; Thu, 20 Apr 2023 03:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985166; x=1684577166; 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=D58hy5/Cr3/DLqz8bPLF+cijdU1EeyUsaB6+w7+K1A4=; b=N8+yCqdO5sz8AiPEk93dOZKkNPYB6aY7lFFD5gUardbRz5sZ8JocWhvPea9fFa4eQd PlMmLFJhLUye9/IGtzp/qW2XYLyA2gs1x78VapayMnTaicezKILFSOeVwHkjz5Ckd3hI ADaX3vIyM9+aAczMEDSDr5MkW1oo6f4t0NIqfoaNPBi79aCVRvtMcNaZu/Xy7REawRW8 Ln9bSVfstJSUW9C++95E1lssLyLSSugJeBb0u9M2NCPhVVgUDcHYr6IAWz1zVKsuU/t1 ++uELeJVsee0sx4uCfE11eKM3AD+UThpCqFKtTsspvuAiXmF/h+FxCIWuUgWtsHRZk17 dRpQ== X-Gm-Message-State: AAQBX9dMQyVPToq7696cJEyoujQkLoaVIitCvt7IdBEHdE1Cu8EvimXq wmagukhzR2NwfYQAUR9HBu0= X-Google-Smtp-Source: AKy350bXJClLxz7rmMe8gZjcJmijV8o1TvktEKHe1Qv5MkDKw9WPVystlZxB2+xk1NShvg63MQKQYA== X-Received: by 2002:adf:fec6:0:b0:2ef:1c8c:1113 with SMTP id q6-20020adffec6000000b002ef1c8c1113mr929778wrs.9.1681985165839; Thu, 20 Apr 2023 03:06:05 -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.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:05 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:52 +0200 Message-Id: <20230420100501.32981-14-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.6 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 13/22] zram: use __bio_add_page for adding single 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.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The zram writeback code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Reviewed-by: Sergey Senozhatsky --- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index aa490da3cef2..9179bd0f248c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -760,7 +760,7 @@ static ssize_t writeback_store(struct device *dev, REQ_OP_WRITE | REQ_SYNC); bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); - bio_add_page(&bio, bvec.bv_page, bvec.bv_len, + __bio_add_page(&bio, bvec.bv_page, bvec.bv_len, bvec.bv_offset); /* * XXX: A single page IO would be inefficient for write From patchwork Thu Apr 20 10:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219549 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 4FE78C7EE23 for ; Fri, 21 Apr 2023 06:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059685; 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=PpOgZ4xTI7VSwDCO4wiOGH5y3qFE3YqssuJ72Z5Gp8M=; b=W+Y+AZ1KbSz5YnuqVWX1opMSWjiOiSnSbx3FIUKfdvVDokjv8XJYCLTLY+t0HzQIR+v89S q8/sowDkN5PUrJD3fBuWPABvai91/X/bPmvNkREnc0/Me77pMuDSlsojFIOJg7zNFcbxEF nykbFiqiaTnCW9fBiuAMYi9ODEwdnNo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-bo9YyOnsPf6xxN2f7npOnw-1; Fri, 21 Apr 2023 02:48:04 -0400 X-MC-Unique: bo9YyOnsPf6xxN2f7npOnw-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 D55EA381D4E6; Fri, 21 Apr 2023 06:47:55 +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 BFED82028B5F; Fri, 21 Apr 2023 06:47:55 +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 139811946A47; Fri, 21 Apr 2023 06:47:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id F1B851946A61 for ; Thu, 20 Apr 2023 10:06:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1EDAA63A5D; Thu, 20 Apr 2023 10:06:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17A17637A3 for ; Thu, 20 Apr 2023 10:06:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 ED4D6800047 for ; Thu, 20 Apr 2023 10:06:09 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-DSuGbJXOMpCkK_ha_oCy3Q-3; Thu, 20 Apr 2023 06:06:08 -0400 X-MC-Unique: DSuGbJXOMpCkK_ha_oCy3Q-3 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f09b9ac51dso15223785e9.0; Thu, 20 Apr 2023 03:06:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985167; x=1684577167; 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=KLQcibH4QQVSvQQ/bVwiqZIZ4Gz6ywI38VTMDoqxjbc=; b=OBIl3vjVylczTBZ5puOQqq/dQX4xCn9y6dFn1/dhveIIj+fz0x9NJIE1Llo10VsnX2 EdtwMv3hYZesxaZiIhSnMNrueWqRAzGAPtJUKo4+ION8hIOB8lWR44tpTW6t35zR2rVp iGFBr3Yg+cuvfWiVw0yUB4lW3B88vu12Lk100hf9VK+1yB05plPKJOx0Sng7SqNzViLs CONAMSKK6Fma9k4MEtitzv24VBb/6aKaxNj9LalrM0TdUACk3Dw4tElYdW+EFlumaAGw I8LbIGhF6NSzK+9NDNp4Is5v28+TT0b7f7ub3JHJbjjxUM85t2ODkC9K1q8PtG4jfEBG T8PQ== X-Gm-Message-State: AAQBX9eTIiOmo3K+SnwRVGMmsnUb/oulRJO9JkaRHG1uQzmRlS9p820p lBreOnZPpohcX6zn4nQvr9s= X-Google-Smtp-Source: AKy350ZcFFlxF5q3NJunushXVpPXUYuiC4N/We+M7gafEQiS6iroYF7bHjMp40rssazkY5tuAvcmdQ== X-Received: by 2002:a5d:4603:0:b0:2fa:a8ad:c49b with SMTP id t3-20020a5d4603000000b002faa8adc49bmr929488wrq.1.1681985166988; Thu, 20 Apr 2023 03:06:06 -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.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:06 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:53 +0200 Message-Id: <20230420100501.32981-15-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.5 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 14/22] floppy: use __bio_add_page for adding single 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 floppy code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 487840e3564d..6f46a30f7c36 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4147,7 +4147,7 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive) cbdata.drive = drive; bio_init(&bio, bdev, &bio_vec, 1, REQ_OP_READ); - bio_add_page(&bio, page, block_size(bdev), 0); + __bio_add_page(&bio, page, block_size(bdev), 0); bio.bi_iter.bi_sector = 0; bio.bi_flags |= (1 << BIO_QUIET); From patchwork Thu Apr 20 10:04:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219537 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 767CDC77B7E for ; Fri, 21 Apr 2023 06:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059677; 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=os1hbude9J0T+iHrqHE24VyZe+Tu9d/zGaEoSXtAddc=; b=S/FpSJCvILxxgo1KdqsMMX8H1//uTwiSdZQbdDhxvScCzkZpVN6D9tq4K1v2/YQ6OveuTj B/vCP/rjfgbFgfJ47CSfn3VX9vZ76o3SMhCdM6xm4HTqZHYsPmZmTvo9RN+7t39pTQkHDm MHHwm7SFyzLqzpTtOtyC/NG5LOOm4LI= 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-651-z2T1nkLjPGq07-ErGmtGkw-1; Fri, 21 Apr 2023 02:47:54 -0400 X-MC-Unique: z2T1nkLjPGq07-ErGmtGkw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 315AB884EC0; 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 201AB40C83B7; 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 9B7361946A6F; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2565919472C9 for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6D279492B0F; Thu, 20 Apr 2023 10:06:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 648DF492B05 for ; Thu, 20 Apr 2023 10:06:13 +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 44E483C0E47B for ; Thu, 20 Apr 2023 10:06:13 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-07n1bDh-Oiq-maHQQvlVCQ-1; Thu, 20 Apr 2023 06:06:09 -0400 X-MC-Unique: 07n1bDh-Oiq-maHQQvlVCQ-1 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-3f09b9ac51dso15224315e9.0; Thu, 20 Apr 2023 03:06:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985168; x=1684577168; 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=u8TpFiJZXriCSIuX4H6qm/DmnDRMN3dAYFyNsYcZw7Y=; b=No7b5tDXUF95YU/N67p4XpDMSH/Fks6+p+fGKzPjLlYBApdxBWXlBq6XNs4cS/AAfX VSuC2MnqqJWnHy0odevnTtcix0w7aDYncgQHg5R9aZvF4IUENOTnkX78KDQva74ZsZxX Xm0KdpON7/VA8YCYRBWpHmR6cK6zi6id1w7W+HzrV3jd6SUpCLtM9X6ZOV/Z5x4a1nDw NkYj9b4XCIWSfWK0NkVNfRhxQUdpM4x6qgrC/h6CVvwk6wefu7cAjhuw0gFtQGNf7gMR uaDw2obJCSJf/+nC1Gufte+3r14mZjCF3CQq4e9spprm26ET6FLpGMn5yC5ihZ9ERfSG /71A== X-Gm-Message-State: AAQBX9f4bhngnQ5ewPYaGwxsYhID1c+F6U6MByK2stIgkXD5IW72zPEC nXH5+jkHihfNWun6kJEi9m4= X-Google-Smtp-Source: AKy350bW2EgyTCeppAYbGJgJ4MBVKwGKy3Cxhhh/Q4CkNUysK8MiWFufZI+smKPXyAJBB06Awe3bOQ== X-Received: by 2002:a5d:6a11:0:b0:2f6:661:c03c with SMTP id m17-20020a5d6a11000000b002f60661c03cmr996930wru.28.1681985168177; Thu, 20 Apr 2023 03:06:08 -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.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:07 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:54 +0200 Message-Id: <20230420100501.32981-16-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.9 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 15/22] md: check for failure when adding pages in alloc_behind_master_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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn alloc_behind_master_bio() can possibly add multiple pages to a bio, but it is not checking for the return value of bio_add_page() if adding really succeeded. Check if the page adding succeeded and if not bail out. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/md/raid1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 68a9e2d9985b..8283ef177f6c 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1147,7 +1147,10 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio, if (unlikely(!page)) goto free_pages; - bio_add_page(behind_bio, page, len, 0); + if (!bio_add_page(behind_bio, page, len, 0)) { + free_page(page); + goto free_pages; + } size -= len; i++; From patchwork Thu Apr 20 10:04:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219552 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.133.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 83E29C77B78 for ; Fri, 21 Apr 2023 06:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059689; 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=tlORFrx5JHqvgSw2TadGHkBABITFP4viI2lmWrI1DjY=; b=BxNgvWm4rGLuwqvD5W05hcUGT3V55chS2Ikzl52cSM7GJRfE7z8gdZX2Lhk8WC0yjoqOjP o3uryC7QC+5pHzQOkG1QQ7K74g6RzKamAaLrg3esORmqdf/tfxo+Je76I8VWGzVzPnBQM1 yNs2HhbVA783GYZ4TeGclPMT/pvSfP8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396--gg-kYTfODOrMYq4xyAJBA-1; Fri, 21 Apr 2023 02:48:04 -0400 X-MC-Unique: -gg-kYTfODOrMYq4xyAJBA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C6B4C1C0A5AE; 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 B03D640C84A3; 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 CF84819452CB; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 26FB019472CB for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6465040C20EE; Thu, 20 Apr 2023 10:06:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CC3240C2064 for ; Thu, 20 Apr 2023 10:06:14 +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 41C2F811E7B for ; Thu, 20 Apr 2023 10:06:14 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-5-f7U3zuIpO-C2Byp7twjNiw-2; Thu, 20 Apr 2023 06:06:10 -0400 X-MC-Unique: f7U3zuIpO-C2Byp7twjNiw-2 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-3f17b967bfbso14829635e9.1; Thu, 20 Apr 2023 03:06:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985169; x=1684577169; 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=6vsuN/DXTgv6nXT8tixf/9v37orpsS/ZRMb3IsbWCsU=; b=UE88mcrbE3D2aFDGZVxAXkS6w1++5tpyZk//7kSb3y/Rm/2j/Tkee/HVPJt3ScfzYE D99zJSAgZ1GfY+Aa8gFR9wMpuHWqXtOP2LzngR9SI1vwHqDhAzZZzfUKCjIhP+vdRTNV ByLSbW65yMmBq98TjtLRMAeRHCSDnBRH8e6kxzasbp4Gelqc2yVx5188ZzofA/r1fZiZ JQ/RUiuAO2tJjF2n0vyOTldUYU1wCPBI5pQjeTpB7ckeLoOMbU4y+5SUmOZBVBP3W/yZ FEcjHHeiCgIciuGDpIGFV47xMRZKlSBPnjwS4vzBnRtqxvLSXMTA1X9515iVByLktmc6 uzcg== X-Gm-Message-State: AAQBX9dp52Csou1t5W3Uh71hVWR/SApVbBI4ZlKsg2N0bOfFjjApLgR+ G95lSltGU0mXr7hRUusZiQ8= X-Google-Smtp-Source: AKy350bi17OiBWEFnlcQi09SOCVUbwgGf05MJ1fWFG3PfYDqnN4wrKiZQ9TzOmB9mPzeZUp0HmKXDA== X-Received: by 2002:a5d:458a:0:b0:2fa:3108:f962 with SMTP id p10-20020a5d458a000000b002fa3108f962mr4684729wrq.24.1681985169353; Thu, 20 Apr 2023 03:06:09 -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.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:08 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:55 +0200 Message-Id: <20230420100501.32981-17-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.1 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 16/22] md: raid1: use __bio_add_page for adding single 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.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn The sync request code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 8283ef177f6c..ff89839455ec 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2917,7 +2917,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, * won't fail because the vec table is big * enough to hold all these pages */ - bio_add_page(bio, page, len, 0); + __bio_add_page(bio, page, len, 0); } } nr_sectors += len>>9; From patchwork Thu Apr 20 10:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219540 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 11A3BC7618E for ; Fri, 21 Apr 2023 06:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059681; 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=WFZIKGts/bMdII4InFmr1iaYFUcQU4U/WaQmYVPj/1M=; b=QCUYjjT3Ldad8xRKZEnF1c/gx+AMjm3w2yGOX71qcfj0R2TMpZ4N80VJJ/mw2R340V61I+ n66kkNLjwaBYSlcfSOdffJ3BbzPvw/GALl/Ivn6ztquq4aELhj44btn5wLHrKbdr90yE9x L3p4Gah5dj2/ovHw+239eD9YVWIWQC4= 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-517-bRHI_AK6OHuCOUP6zOp6iA-1; Fri, 21 Apr 2023 02:47:56 -0400 X-MC-Unique: bRHI_AK6OHuCOUP6zOp6iA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 887D2185A78B; Fri, 21 Apr 2023 06:47:53 +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 76B7A140EBF4; Fri, 21 Apr 2023 06:47:53 +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 1655E1949739; Fri, 21 Apr 2023 06:47:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 21AE419472C1 for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 39CE340C20FA; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3223840C2064 for ; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 138498996E3 for ; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-a8NPSxsgOmeLFzscBEiYEA-1; Thu, 20 Apr 2023 06:06:12 -0400 X-MC-Unique: a8NPSxsgOmeLFzscBEiYEA-1 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-2f8405b3dc1so277546f8f.3; Thu, 20 Apr 2023 03:06:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985170; x=1684577170; 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=NtU3y1Zr3yjzTsE4b676R+MqirB7TojNGzCXkCz9E5c=; b=beyF/e9UXY7QWwo4OedNFZmHd8tRtXuoVkCeee77jEtB7mB6ICGXz9TeGeKGELLBEH JJpt9Hi1xuS90UquSJ5LeNGRxfbeJbTkrfzfb3HbI/QTn8kauj3t/JCYGbC9j1SzYB+n 8dGBz0/PvZWtVedEqdHKN2OJqsnTGpILRdaQxY23+1UW515AsTd6cNjKda42MGhCCrAP 26DA8oNwDJBfyhSXohMKq+k2SglRkmVjFZkgNHDilSiuWvryKEy9HOvkuLjnmqioqOCh uHdduDq0VudzjveIEgwqRw95+YOe+FzMgN4wS3exMpyrV+8xTynsdcdH/yK68yYVYDtm Z6Ew== X-Gm-Message-State: AAQBX9f1DUDv+AMQduGHiVhQKdoTpYBocfVD1FB0qgKdOmGKbwxgrccl Hhz0cdcmkUwQGSDbpeuU8ok= X-Google-Smtp-Source: AKy350Yf43FTKduuCP1kMcXqJDkEawnut9n4ItV54pfFrm9DNgw20nsuo8ykxVcEagPqAFCwlrvDXw== X-Received: by 2002:adf:f4d0:0:b0:2f7:e3aa:677a with SMTP id h16-20020adff4d0000000b002f7e3aa677amr912509wrp.46.1681985170733; Thu, 20 Apr 2023 03:06:10 -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.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:10 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:56 +0200 Message-Id: <20230420100501.32981-18-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.1 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 17/22] md: raid1: check if adding pages to resync bio fails 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn Check if adding pages to resync bio fails and if bail out. As the comment above suggests this cannot happen, WARN if it actually happens. This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/raid1-10.c | 11 ++++++----- drivers/md/raid10.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index e61f6cad4e08..cd349e69ed77 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -101,11 +101,12 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, struct page *page = resync_fetch_page(rp, idx); int len = min_t(int, size, PAGE_SIZE); - /* - * won't fail because the vec table is big - * enough to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + return; + } + size -= len; } while (idx++ < RESYNC_PAGES && size > 0); } diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 6c66357f92f5..59e52cf01569 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3804,11 +3804,11 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, for (bio= biolist ; bio ; bio=bio->bi_next) { struct resync_pages *rp = get_resync_pages(bio); page = resync_fetch_page(rp, page_idx); - /* - * won't fail because the vec table is big enough - * to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + goto giveup; + } } nr_sectors += len>>9; sector_nr += len>>9; @@ -4985,11 +4985,11 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, if (len > PAGE_SIZE) len = PAGE_SIZE; for (bio = blist; bio ; bio = bio->bi_next) { - /* - * won't fail because the vec table is big enough - * to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + return sectors_done; + } } sector_nr += len >> 9; nr_sectors += len >> 9; From patchwork Thu Apr 20 10:04:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219544 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 F15D7C77B7F for ; Fri, 21 Apr 2023 06:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059683; 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=ycjWOM0FUIbzyr+H4kWaN4FxKzHK3hCWxmNB7PM9DxM=; b=fvKN0XDQlOsuk9EnccsrW+XWtA+NHj0FiHM6t/Y7IG7oyhk8UYCCq5z36boOoVY0+EVGE+ KyR/iuyoOTcaobOzvlCL+8pQnSKP8MSPU2f8MaTBY/zrpKtlvrpwvh+GIWL2H8Mi+xm6Gr SA4dzZqUwfGDXiFQmWI0G84DPE0Q4gQ= 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-567-LMRVIfulPPWaPOrn8bGa2w-1; Fri, 21 Apr 2023 02:47:59 -0400 X-MC-Unique: LMRVIfulPPWaPOrn8bGa2w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E404F10146E4; Fri, 21 Apr 2023 06:47:54 +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 D15F9140EBF4; Fri, 21 Apr 2023 06:47:54 +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 84CD21946A6E; Fri, 21 Apr 2023 06:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 342171946A4D for ; Thu, 20 Apr 2023 10:06:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6565DC164E8; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D9A2C164E7 for ; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 4061085A5A3 for ; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-286-9jCC_5seMDKDRVh0F7tINA-1; Thu, 20 Apr 2023 06:06:13 -0400 X-MC-Unique: 9jCC_5seMDKDRVh0F7tINA-1 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f18335a870so3452075e9.0; Thu, 20 Apr 2023 03:06:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985172; x=1684577172; 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=/zlw+dyGlfnLYWyTWZyG7072cksvgegzTzOhlPnlIpY=; b=SPyBUygtGvnHUMRgLkYccNGPZz8/Q8SH6+3fRYBVYDbnNZ9mE6Jt79XeOuw9LYWIXT A73VwcbxQdgI6fdQRosxqTFg+2pA04DMxzBTDDp0qCLKpZ69to2CqU8ynHeib65/+nx/ EcdCStOzpHKiR9JBwrrjggDGwxIY/y3n1h2yk6nY5Qxx5YYrDU/w0XBpuI9aBXoOjNE4 UVmtnELhqnHwEdf3z44lawm7Au61O4zzLanIGLcejKkKvt5Hi79tg802HwyogP/bc/we f2pECfKBllaN14Rp/RtMjq6l16Q3Ga7SrvY4CYdujLeF5U9qt315n0RAXKnetacHbUuR BSRA== X-Gm-Message-State: AAQBX9dTqYHorOdh9WpCVhJIsTgIFUTJYD8iIF9+QRYYXPHeUtRjc9SW 6sGxgcaqwZG7hLMrFd0nzFM= X-Google-Smtp-Source: AKy350b4+pGxVTyaXt7ZP5FpDVVarQnYRrcgBCCIE1KFKr5Sq8P0zgMU35+ypve4Bt1qBgDPW2LUww== X-Received: by 2002:a5d:640a:0:b0:2ee:d53b:d9ef with SMTP id z10-20020a5d640a000000b002eed53bd9efmr813643wru.55.1681985171893; Thu, 20 Apr 2023 03:06:11 -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.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:11 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:57 +0200 Message-Id: <20230420100501.32981-19-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.8 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 18/22] dm-crypt: check if adding pages to clone bio fails 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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn Check if adding pages to clone bio fails and if it does retry with reclaim. This mirrors the behaviour of page allocation in crypt_alloc_buffer(). This way we can mark bio_add_pages as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/md/dm-crypt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 3ba53dc3cc3f..19f7e087c6df 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1693,7 +1693,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned int size) len = (remaining_size > PAGE_SIZE) ? PAGE_SIZE : remaining_size; - bio_add_page(clone, page, len, 0); + if (!bio_add_page(clone, page, len, 0)) { + mempool_free(page, &cc->page_pool); + crypt_free_buffer_pages(cc, clone); + bio_put(clone); + gfp_mask |= __GFP_DIRECT_RECLAIM; + goto retry; + + } remaining_size -= len; } From patchwork Thu Apr 20 10:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219547 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 D674FC77B78 for ; Fri, 21 Apr 2023 06:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059685; 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=IbNQziB1o+jkDyXafSWKNECLYyLbmzHrlvTA73oncOE=; b=YCBkaeZSIdaJ+FRr76m3mC5s2VjRUIkZ/LU41vIV+8op/Hjh40mo+jAmKT03hwPd0+f6T+ /uOLBKpMqQjIm5OG7E72j4Q0sdw9aWoo0Mj9cgKMLStrY4kA9aWvXHXL/ZUsv0vgdzvNsK bX+0VW8FR3w1tKOK0asId7heQKBt+9s= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-6lD-QGO3NWaIcz_SRrb14w-1; Fri, 21 Apr 2023 02:48:00 -0400 X-MC-Unique: 6lD-QGO3NWaIcz_SRrb14w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2FA038173EA; Fri, 21 Apr 2023 06:47:55 +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 8EDB0407D45A; Fri, 21 Apr 2023 06:47:55 +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 E087619451F8; Fri, 21 Apr 2023 06:47:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E770C1946A4F for ; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9569763A51; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E98263A5F for ; Thu, 20 Apr 2023 10:06:18 +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 73FEA101A553 for ; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-JG-0oTksPOWAUs-0q5HjNA-1; Thu, 20 Apr 2023 06:06:14 -0400 X-MC-Unique: JG-0oTksPOWAUs-0q5HjNA-1 Received: by mail-wm1-f42.google.com with SMTP id bg5so99134wmb.1; Thu, 20 Apr 2023 03:06:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985173; x=1684577173; 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=ExnlLXqiP3hLS8bpFiqaYIxJLAKQF5DCX5VPxtSPsPo=; b=iUYXSa8mZRThwGArxI0HYvHA9HFUt6GSputDI0kkA191dSH4t1do+M4EOTY5i7hUfL +uzPQSZ0rIXbGNSEKZkD1Z/xGrn60c0Q426zD/vCG1yq4pZpQK3cwwLPez3UY679xJ4b p9FOrV0hxC+5BiFxcAXPwiHR55psQ55S//o9DzMogsRSc/YkmQwrdNIJWPWAj0c/L5eV gt9PSHTKwHSQ7w4SPLElzczubzaDa2p05Erg1/LFCYyP7LQWkHBGTNfzrKqSCsx7pUp8 fRoxw7Wo98YernMNoLds1bHo6RH0x1BaDoY5dTo8pFBBzHfd2S0JXHNHTaNKZMRFqZ/1 dDQQ== X-Gm-Message-State: AAQBX9cL6f7lbQrzPwbwk4L+GDzBXwKc3pVIcovYiuwg6K3N1J3vBjY6 2sL2W5/J/F75rkYCvrafKgk= X-Google-Smtp-Source: AKy350Y9Lh9XIY3qybGhOCpyPMv4/qCxT9O5teS3GZxkrMtKC5XpeBENII5mka0Be7VFkgyszAIoCQ== X-Received: by 2002:a7b:c4c6:0:b0:3f1:7006:e782 with SMTP id g6-20020a7bc4c6000000b003f17006e782mr804698wmk.25.1681985173032; Thu, 20 Apr 2023 03:06:13 -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.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:12 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:58 +0200 Message-Id: <20230420100501.32981-20-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.5 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 19/22] block: mark bio_add_page as __must_check 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.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index d766be7152e1..0f8a8d7a6384 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -465,7 +465,7 @@ extern void bio_uninit(struct bio *); void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf); void bio_chain(struct bio *, struct bio *); -int bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); +int __must_check bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); bool bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned int, unsigned int); From patchwork Thu Apr 20 10:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219535 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 840D4C77B7F for ; Fri, 21 Apr 2023 06:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059677; 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=DPFhCl/Tt8UClpuiaQg1A87hBRUG1+bk9dCAsEibBkM=; b=eQtC0WYaFUNQyfLFMMJhoyMf7qD/nxO314OPT4dOeehxTnf42ZKuNJY0o+nOMDEXysxGUE lfX0xE/G1vSsH3B98GVaPj2B37jv/egVWKdaMGKpGUUwyDFNydM3VjHj2UWv2y/l/n0Sp9 NnSmrpo7Gnv2KQiZe/TGHWhRcIgww1Y= 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-59-6Kez3yjPPQ2QTamPAFGHsw-1; Fri, 21 Apr 2023 02:47:54 -0400 X-MC-Unique: 6Kez3yjPPQ2QTamPAFGHsw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 10A28877CA7; 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 9DEFE40C2064; Fri, 21 Apr 2023 06:47:51 +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 729471946A62; Fri, 21 Apr 2023 06:47:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1FC801946A7F for ; Thu, 20 Apr 2023 10:06:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 86C3C40BC7A0; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F5AA40BC79D for ; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 5E439811E7D for ; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-2AlhWcCIMD-TN4XfpV75og-3; Thu, 20 Apr 2023 06:06:15 -0400 X-MC-Unique: 2AlhWcCIMD-TN4XfpV75og-3 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f177cb2c6cso3448465e9.2; Thu, 20 Apr 2023 03:06:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985174; x=1684577174; 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=ybte8ln4cL1imogQbfLUc6IIuAFaJLWmv8LuzJpUUJE=; b=DhwH0iljwzW+gife+Y9l5HegbpR5b9BWKxwyjv7MXsfht+uPzuNfVX2FvrUHJzSv7N txaMBRoVONb6QIuhjSafgjDRM1w0Kwsi7/CL//K2QRtIVEYHZ5S8h7Kp4Y4dlQkQiGn1 SNDldx1VE0LAKkDE9XM6I9pbkmqsKAxHcIwdgwv55GUIwUZAFRaF3roGKxcWiaGrj99e aS3y7qq4Yp+zBoGNn0H3t1j0ZruHrNcIirZhXLnomu9F3zY6AJ9uCeUgQm9bD232Mcsc i4W4s5UIqXRF6bmzLfYLPxXtCsIkaQxmGSPWMh6E4HA/ZAXGMngDMnyIunVXVFh+LHy8 FEew== X-Gm-Message-State: AAQBX9dyYF3eCrOsWaVJGw3QXxrL8SvpJiTgK9ipYYvOplyYHtgMZ8rs JiDSTPwdQFDzQkkiPQPyaEc= X-Google-Smtp-Source: AKy350ZrFHrJO95XpjLsqvNhaT3Lj7em6PpVK0jNKwO81XYdkMaIRUgqMSWWRox8APZBVDphzDkYwQ== X-Received: by 2002:adf:f384:0:b0:2f2:9198:f0f with SMTP id m4-20020adff384000000b002f291980f0fmr833210wro.10.1681985174142; Thu, 20 Apr 2023 03:06:14 -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.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:13 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:59 +0200 Message-Id: <20230420100501.32981-21-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.2 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 20/22] block: add __bio_add_folio 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: linux-block@vger.kernel.org, damien.lemoal@wdc.com, kch@nvidia.com, agruenba@redhat.com, linux-mm@kvack.org, shaggy@kernel.org, johannes.thumshirn@wdc.com, snitzer@kernel.org, jfs-discussion@lists.sourceforge.net, willy@infradead.org, ming.lei@redhat.com, cluster-devel@redhat.com, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, dsterba@suse.com, linux-raid@vger.kernel.org, song@kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org, rpeterso@redhat.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn --- block/bio.c | 8 ++++++++ include/linux/bio.h | 1 + 2 files changed, 9 insertions(+) diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..f3a3524b53e4 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1138,6 +1138,14 @@ int bio_add_page(struct bio *bio, struct page *page, } EXPORT_SYMBOL(bio_add_page); +void __bio_add_folio(struct bio *bio, struct folio *folio, size_t len, + size_t off) +{ + WARN_ON_ONCE(len > UINT_MAX); + WARN_ON_ONCE(off > UINT_MAX); + __bio_add_page(bio, &folio->page, len, off); +} + /** * bio_add_folio - Attempt to add part of a folio to a bio. * @bio: BIO to add to. diff --git a/include/linux/bio.h b/include/linux/bio.h index 0f8a8d7a6384..99fa832db836 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -473,6 +473,7 @@ int bio_add_zone_append_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off); +void __bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter); void __bio_release_pages(struct bio *bio, bool mark_dirty); From patchwork Thu Apr 20 10:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219548 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.133.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 C2AFCC7EE22 for ; Fri, 21 Apr 2023 06:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059684; 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=PSA8iIJoPjx5ZWdVdkXY9TCCopKiMactTNNehyocRLI=; b=PYs7SXuJO0q8soNfdSg8tcY7+v/VbJwnfLro6D0FC/mhHNXsGBAIu+bvg+7HMamscDbaiA f3B1eynfdPzXbYwyfK79zaRss602iX7T65INKZeg13qoZBYHrFhHTHZ9ug6jeFzcFSkMa2 3Iu5a9aVJT7VKd9V7H0haHU/jN/oVLM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-370-Yp8KCzaxMr68_5-WEijx4A-1; Fri, 21 Apr 2023 02:48:02 -0400 X-MC-Unique: Yp8KCzaxMr68_5-WEijx4A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D14B91C129B7; Fri, 21 Apr 2023 06:47:57 +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 BB2A21410F1E; Fri, 21 Apr 2023 06:47:57 +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 939D51946A4E; Fri, 21 Apr 2023 06:47:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3323E1946A4A for ; Thu, 20 Apr 2023 10:06:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7808AC090DC; Thu, 20 Apr 2023 10:06:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70BA7C16045 for ; Thu, 20 Apr 2023 10:06:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 56ABF1C087B3 for ; Thu, 20 Apr 2023 10:06:19 +0000 (UTC) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-3c4vFA2HNCOovhMXLPyqGQ-1; Thu, 20 Apr 2023 06:06:17 -0400 X-MC-Unique: 3c4vFA2HNCOovhMXLPyqGQ-1 Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f0a80b686eso3442995e9.1; Thu, 20 Apr 2023 03:06:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985175; x=1684577175; 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=R6+NeAX2XCjGoXZTYs/vHx8pZBcBY0nCsbbwup4DNoY=; b=XedjZuWxZvDCfnZwvd9vJfITMew+9Q9bEhbD+HV8a+1JRPbK1ATtEy8fHumWQ++qLu dDaRBEKZ1LdGzuWWjO4S8CZ1aT6x1Lir8HULEUR/GFO7T4xrRcgc5GaZp0FPcdctJijr Wbe1iV7iRhvBaDlZ15TniIbr2TCZAOuyJEpSc3BEYSAcmu8lqJ7wa6rXhfiKaQW0v08y j2cvb6kCNEmUusjgQ+CyIJrCdgLYCmTiZZITEVlewFwfUghvD9MaA39UNPzxOs87JZfZ xIMO1ZIoHx+tsAKS6Re/NK388tbxXkz2KV0z1pmybBK2NimoejoIbvmNaCD13Bh+HM5X dPiA== X-Gm-Message-State: AAQBX9dy8WzDthditQBUQ66NRTTPJbUsXV9ZmLmW1rNwsQk4+sL3A4bL jl2Oob13IyCjYegYarx8dFA= X-Google-Smtp-Source: AKy350aN3PsOr81dbQugpISlk+yjR+a+4/2N8Qu7GaXUJdAVlidoOhFCKUKxX0oN92RzWan4aBS9aQ== X-Received: by 2002:a5d:5957:0:b0:2f4:3b2c:1b2e with SMTP id e23-20020a5d5957000000b002f43b2c1b2emr951041wri.31.1681985175440; Thu, 20 Apr 2023 03:06:15 -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.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:14 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:05:00 +0200 Message-Id: <20230420100501.32981-22-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.8 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 21/22] fs: iomap: use __bio_add_folio where possible 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: linux-block@vger.kernel.org, damien.lemoal@wdc.com, kch@nvidia.com, agruenba@redhat.com, linux-mm@kvack.org, shaggy@kernel.org, johannes.thumshirn@wdc.com, snitzer@kernel.org, jfs-discussion@lists.sourceforge.net, willy@infradead.org, ming.lei@redhat.com, cluster-devel@redhat.com, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, dsterba@suse.com, linux-raid@vger.kernel.org, song@kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org, rpeterso@redhat.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn When the iomap buffered-io code can't add a folio to a bio, it allocates a new bio and adds the folio to that one. This is done using bio_add_folio(), but doesn't check for errors. As adding a folio to a newly created bio can't fail, use the newly introduced __bio_add_folio() function. Signed-off-by: Johannes Thumshirn --- fs/iomap/buffered-io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 6f4c97a6d7e9..473598b68067 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -312,7 +312,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, ctx->bio->bi_opf |= REQ_RAHEAD; ctx->bio->bi_iter.bi_sector = sector; ctx->bio->bi_end_io = iomap_read_end_io; - bio_add_folio(ctx->bio, folio, plen, poff); + __bio_add_folio(ctx->bio, folio, plen, poff); } done: @@ -546,7 +546,7 @@ static int iomap_read_folio_sync(loff_t block_start, struct folio *folio, bio_init(&bio, iomap->bdev, &bvec, 1, REQ_OP_READ); bio.bi_iter.bi_sector = iomap_sector(iomap, block_start); - bio_add_folio(&bio, folio, plen, poff); + __bio_add_folio(&bio, folio, plen, poff); return submit_bio_wait(&bio); } @@ -1589,7 +1589,7 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, if (!bio_add_folio(wpc->ioend->io_bio, folio, len, poff)) { wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio); - bio_add_folio(wpc->ioend->io_bio, folio, len, poff); + __bio_add_folio(wpc->ioend->io_bio, folio, len, poff); } if (iop) From patchwork Thu Apr 20 10:05:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13219554 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 6659BC7618E for ; Fri, 21 Apr 2023 06:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059691; 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=V5KAEgoAH3eED8c/MFZM8YfrAfMYS+WNFi37JIHsLzk=; b=h8eOSY80Ic7F6s+IyX6lFNpV29apbOumUwzBvoq6fXCxnO+Hl7PgKOu7Yo3adCWYc5aI0C yM73I6VO+yPZks7ngYbQ6DqPxS3PTw3SV6YVcinunQbKnxtBK5ZIgNyRIZgbJtT2Oozziv sttGLURJYz21NQX3vDsjr55p8j7E/PE= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-635-bwf79ixyMw6bkCsv_1Hvgw-1; Fri, 21 Apr 2023 02:48:07 -0400 X-MC-Unique: bwf79ixyMw6bkCsv_1Hvgw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77E3E280BCB9; Fri, 21 Apr 2023 06:47:57 +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 6216A2166B35; Fri, 21 Apr 2023 06:47:57 +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 4118B1946A48; Fri, 21 Apr 2023 06:47:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 23E8B19472C4 for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 624422024CDF; Thu, 20 Apr 2023 10:06:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5AC152024CDE for ; Thu, 20 Apr 2023 10:06:22 +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 3EFD329A9CA5 for ; Thu, 20 Apr 2023 10:06:22 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-6Q6pQEx1MfSZ7MVyLQ4j-Q-1; Thu, 20 Apr 2023 06:06:18 -0400 X-MC-Unique: 6Q6pQEx1MfSZ7MVyLQ4j-Q-1 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-3f1728c2a57so5546325e9.0; Thu, 20 Apr 2023 03:06:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985176; x=1684577176; 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=bdnAdvAKJlDAz7pM0pp8Diurpm3+TR0sCY4FonfaEe4=; b=cL/WWMv9Lp4ugbMMR8r3EOuBg8Xzl51v4nQsi4ylKbZVM0F9FYxXGWcsPQxWQZR/zx UmF6iV8neQxjLttbuVSAppCGimeadEXZl0tLlAyUu8auY3tq/FFY8M04Uf5H/Mb0Bpml pgDU7g1SedO2eseeANoZe4n3dbb+hFUj256VkrJcRsgsXiyyCx96wE7cmqP5u34RLJ69 +zAQYouuE6sVvwhTargWkBvHvXUORfsYXz5VlSrki0MpjATGWbZLNl3BZSqrNbA2bWKH zhGiJTEYXLePgkoZnagf5ugaZrt+vSG2SCYLnFpX4MBnX4uYJKN9jVvHWI8Lup6NYLWl IX5Q== X-Gm-Message-State: AAQBX9e2xXOcQPtUh0k4cwLZ4jjZ64o5wEB2UH6YFSiVwIY8S8UVxxav MN+iQfGBqFsTW/NBGLR6YpA= X-Google-Smtp-Source: AKy350bs2gtzNI5cB6yEjD27bAOubU763Pln69XpJllBqakY/TYBXJ5mOXnM5tQ2B75UHodvDIFK3A== X-Received: by 2002:a5d:6dcc:0:b0:2fa:43e7:4a32 with SMTP id d12-20020a5d6dcc000000b002fa43e74a32mr694948wrz.66.1681985176558; Thu, 20 Apr 2023 03:06:16 -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.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:16 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:05:01 +0200 Message-Id: <20230420100501.32981-23-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.4 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 22/22] block: mark bio_add_folio as __must_check 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: linux-block@vger.kernel.org, damien.lemoal@wdc.com, kch@nvidia.com, agruenba@redhat.com, linux-mm@kvack.org, shaggy@kernel.org, johannes.thumshirn@wdc.com, snitzer@kernel.org, jfs-discussion@lists.sourceforge.net, willy@infradead.org, ming.lei@redhat.com, cluster-devel@redhat.com, linux-fsdevel@vger.kernel.org, dm-devel@redhat.com, dsterba@suse.com, linux-raid@vger.kernel.org, song@kernel.org, hch@lst.de, linux-btrfs@vger.kernel.org, rpeterso@redhat.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn Now that all callers of bio_add_folio() check the return value, mark it as __must_check. Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 99fa832db836..36cfc091caed 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -466,7 +466,7 @@ void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf); void bio_chain(struct bio *, struct bio *); int __must_check bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); -bool bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); +bool __must_check bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned int, unsigned int); int bio_add_zone_append_page(struct bio *bio, struct page *page,