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: 13216923 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 988FFC77B73 for ; Wed, 19 Apr 2023 14:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbjDSOLE (ORCPT ); Wed, 19 Apr 2023 10:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231590AbjDSOK4 (ORCPT ); Wed, 19 Apr 2023 10:10:56 -0400 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3497616B24; Wed, 19 Apr 2023 07:10:36 -0700 (PDT) Received: by mail-wm1-f47.google.com with SMTP id eo4-20020a05600c82c400b003f05a99a841so1503473wmb.3; Wed, 19 Apr 2023 07:10:36 -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=Q5xCnygSQUhrVqIkPPTJei7APjikXCUWOw1C7uXa3mPs/lF1M2ksQcis2jcUpTJO62 wZVAz1cJlXtMdepB0DUbSaMXtBln9B6ABUIzkf3Jf9SiJZbx3FUEk36p40ExCtSm6anh 7RRFjFrV37jFOzygyKFJI382zZstbp/QPtHwA3SSkJFSPY0KDM3OQTL8MfwOTW8UraMi B4Cf4roUbr90m2UPsv+i+u2QdA6g4sRWPLzngllFt7jbe+a4oLjEDlH+Uz1Ev8SypgxG S4EZXZ09ipL4hT0A6tkn33gt6xPsVn5REKy04IrUTCbhyhSql+9x77wFFETzkLbB6fJ6 iesA== X-Gm-Message-State: AAQBX9eR5Od6S6rz1t8nGoqDHoQqVGiDgEDAnaRg8iDaUFulIL2eo7Lz MlHHrcsqdn4i1ds+IbUCr50= 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 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 v3 04/19] fs: buffer: use __bio_add_page to add single page to bio Date: Wed, 19 Apr 2023 16:09:14 +0200 Message-Id: <20230419140929.5924-5-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230419140929.5924-1-jth@kernel.org> References: <20230419140929.5924-1-jth@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-raid@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;