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: 13218313 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58504C77B72 for ; Thu, 20 Apr 2023 10:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234445AbjDTKG0 (ORCPT ); Thu, 20 Apr 2023 06:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234055AbjDTKGG (ORCPT ); Thu, 20 Apr 2023 06:06:06 -0400 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A92F2D64; Thu, 20 Apr 2023 03:05:56 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-2efbaad9d76so446424f8f.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=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=CXhBlQ4gqrAUeNkkz+qgpUahYUtQrlhWckqgjPSih/DnLr1XgHn3Rhkus8kr38nXVh Ia2Ys82JarSrVz0eaiDVlH9Gjf+TdN+zMM36u+AXMsNWQNOZmvJnxCG4/IqEHvGLeHiu SYTeaXsT5Jym6cleZNwRzz6F7oXHjqKUBz+MBlo+l4wC9ncP3ZqRU3SopxU1mzp3xxUz Uh+0d2JbTh1m6Hv/QGH7J2LYC95ghUUGLyaAXilI/BeLeI3i90v9HjbM3e7N4nW5VSCf kXFacuo4COp42lUhMjejhq1IcFsMMM7NkG4Tz5/uzklWDCZJmamnsDN3eHrZMZsl2vUn Fqgw== X-Gm-Message-State: AAQBX9dewxzcS5Tz90lFkKUzIdoQ3hvgE4SAjPu7NuuLZopPJg6Fo8ZW fXchoIAakXZmSd8YwiPRHj8= 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 Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, ming.lei@redhat.com, rpeterso@redhat.com, shaggy@kernel.org, snitzer@kernel.org, song@kernel.org, willy@infradead.org, Damien Le Moal Subject: [PATCH v4 04/22] fs: buffer: use __bio_add_page to add single page to bio Date: Thu, 20 Apr 2023 12:04:43 +0200 Message-Id: <20230420100501.32981-5-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.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;