From patchwork Tue May 2 10:19:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229069 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02E0FC77B73 for ; Tue, 2 May 2023 15:38:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBA0D6B00A4; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A604E6B00A9; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79AC56B00A6; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 39C756B00A8 for ; Tue, 2 May 2023 11:38:08 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683041888; x=1714577888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FXpnjgB/ygwpmZKJ1wgHt/Ki7pqawjz1WS6cXCp7ZKc=; b=i2x5844rB7sCuLmMvEGJ7wek5U0WyUJS8PUfqGj3+kDnUAVIM/6sEAkR 9hzSmis1hCfX5BvmBvyKa2X9ry6e1yT7rFEqlVojG0dDpDeM0cUuf9FHK WRJnekwcq2xN62gUk+N0EMazZTUNF4ZC04meoh+jLUbh10mJi6SgCtgWz IthqTLrAja3RaRKTljvZ5Upb7aRR2sQMyoDaxBXdwT9m8GYZy4J9X9NWE R1Oa8yzytw7Aqw7fCYjtZIUSX3LNtj4OyDnAKkO5t/kuaVXOUWO1vpYFB HgafE3e547YRPqAEGe/nz3Q+yp5pB7SAOZ1HdZ7f8O8my5zTBH/NuqH8A Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672862" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:07 +0800 IronPort-SDR: x7uIzFDIpLNjfsv9gcg/sA6+9TCw+s9k3jRFTs1Df5soYCWlCF+Tb2kIXzK++eGwUbtvkxnRKo 86XmxvOJys5yMeorSEU1oY/qP8SDIRQbKF5Jm6QWeuGDU6UH7MncpyL3xNujlsZiwS3hUulDwQ bU/v0xbpgf8LXwHcmJKA8nXCCB+mHgKB/MlMRGGGamMTGW938LaJ8NV5SS2Cba1zxLTCv7rC7O 2vdz3Anr7yLnyVNZ7hqLj3XWFJzz/CMNR9cXH2srQuQ1joHcu0sJlo7JznX/CLeW3Cy2ie1KZm vOU= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 May 2023 02:30:54 -0700 IronPort-SDR: mWtBTTHy90djKAbegefmDyP3WKoM6oP2zY9LncgzfFocNlEb1JermO/6eC4ZJMDhie29j2OtjW lptdro5cMeGM9kaWql7Z3j6h1oOXaDvNIEWz/ThhgjCFgs+VsseeDM3qqWWaA8jtZNxr812aSF WPCYWUlvjcno+HwbuSlNFNmNJdeO4ey/RN8/SbWz6G8OgGdzvlz05cLYWgBmoPXtw1YB+d9bMD LEIXW/AruICqoDNWgLp43Ig0EObTHoQwnl65bD70v5tSToP+lRLcqP1Zp8ujMKyHqk2IMC6uia kD0= WDCIronportException: Internal Received: from myd008205.ad.shared (HELO localhost.localdomain) ([10.225.1.100]) by uls-op-cesaip02.wdc.com with ESMTP; 02 May 2023 03:21:03 -0700 From: Johannes Thumshirn To: "axboe @ kernel . dk" Cc: agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@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, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v5 07/20] md: raid5: use __bio_add_page to add single page to new bio Date: Tue, 2 May 2023 12:19:21 +0200 Message-Id: <20230502101934.24901-8-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230502101934.24901-1-johannes.thumshirn@wdc.com> References: <20230502101934.24901-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Reviewed-by: Damien Le Moal Acked-by: Song Liu Signed-off-by: Johannes Thumshirn --- 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);