From patchwork Wed Apr 19 14:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13217964 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 49D17C77B7A for ; Thu, 20 Apr 2023 06:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681973840; 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=Hex/taGK3JNiigOotlHhUzNADkfaLSRRabBwc77q9aTZO+AGGHhYjxSckl0q6bCO0Y1dPS j8ZLFvuVzWI/j/vdVaJc3W+oDRuaT8SxEqqcDLqsca4YRaR6ZxhXDXwKd3P6cv4NMUdtiT FeSojfUne2dtttQ4x2i9G84cy4YWIF4= 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-325-fbsHudmZP1qSyywADQPQmg-1; Thu, 20 Apr 2023 02:57:18 -0400 X-MC-Unique: fbsHudmZP1qSyywADQPQmg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D821823D44; Thu, 20 Apr 2023 06:57:10 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEC44C164E9; Thu, 20 Apr 2023 06:57:09 +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 1EC981946A67; Thu, 20 Apr 2023 06:57:08 +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 528DE19465B1 for ; Wed, 19 Apr 2023 14:10:48 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 29235112131B; Wed, 19 Apr 2023 14:10:48 +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 20B011121315 for ; Wed, 19 Apr 2023 14:10:48 +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 07AAB81B54B for ; Wed, 19 Apr 2023 14:10:48 +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-35-5cvtw7zkN66s1MqL_BYddw-1; Wed, 19 Apr 2023 10:10:36 -0400 X-MC-Unique: 5cvtw7zkN66s1MqL_BYddw-1 Received: by mail-wm1-f53.google.com with SMTP id he13so22188761wmb.2; Wed, 19 Apr 2023 07:10:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681913434; x=1684505434; 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=Eb+/HHFpd3rOHM2B+2lQUoVmHaX57SETw1oljZAePgHc0YZ6PusFxS3Ow8r3Bm7nC9 9AKKGQuarj0zwPlO4NZGZthOoB3bzupJteEG8Nd4HsGJB/Ur/jtoIjNOsNR856yJS4vs BcG2KQX9C8gnZ6n1CR901bt3nmsAttvD9hYjaLVs4Yw/XGGH8C00mk2dhCmz/LdvKFGw P9h9A/36l2ipao/cueauSrcDQMGv5FV4j9vp0Bdul+Zu9zTjE/SKQ/1RDiRfUfnhHhqO gy/8E3+USXlZRAyxm7CShZT033GKcZlkwhcnkdiUDPDcd/6eO1XA2aYJMWrlISp2wSz1 q/og== X-Gm-Message-State: AAQBX9exFz76dMMCW/i2icDHAt2OV39cbERcRfz0AVNaBrFSu7QeHJcK focA9fBiozCw3uVS+Gm65+s7cwgZ7D2sHnck X-Google-Smtp-Source: AKy350ZcCj3OtSCuaFlwa1p5GTFo/DcYXTM4La563Vsxtqwo67FQ//DkWW6/Tk+RebbTzBTqG0zNZg== X-Received: by 2002:a1c:7410:0:b0:3ef:df3:1693 with SMTP id p16-20020a1c7410000000b003ef0df31693mr16905947wmc.32.1681913434708; Wed, 19 Apr 2023 07:10:34 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-204.dynamic.mnet-online.de. [62.216.205.204]) by smtp.googlemail.com with ESMTPSA id q17-20020a5d61d1000000b002faaa9a1721sm7612089wrv.58.2023.04.19.07.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 07:10:34 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Wed, 19 Apr 2023 16:09:14 +0200 Message-Id: <20230419140929.5924-5-jth@kernel.org> In-Reply-To: <20230419140929.5924-1-jth@kernel.org> References: <20230419140929.5924-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: Thu, 20 Apr 2023 06:57:04 +0000 Subject: [dm-devel] [PATCH v3 04/19] 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.8 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;