From mboxrd@z Thu Jan 1 00:00:00 1970 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 85A94C77B7A for ; Tue, 30 May 2023 15:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232586AbjE3PuH (ORCPT ); Tue, 30 May 2023 11:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbjE3Ptz (ORCPT ); Tue, 30 May 2023 11:49:55 -0400 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05CD0C5; Tue, 30 May 2023 08:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461793; x=1716997793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3krWE0DP9xJWhQSqe7JjRJmAUx3KR1tDfQYkyCcToNw=; b=Amla5+7OHU70zjPUli+P/m2lcbe3qOkV0UeIR47lxFii51+Z1nl55wx+ 2A/LIV0wMul89VwQTK5hdV/d1Nwjy4KZRUD4p3Uh5e9jrS7HEdu38OSIn xL79erxmdfT5UE/2MwZnOF5JxfH7eqdTUgI9p3cigQ5IWWl06VDMYn22h bVd0/gJMh1x/kvwjdvUvP1MtfYsV8i4XZ5xOovLnRDpwMYx1rjUhclF41 VkXDL82NEj3FlsAUdVT7kdDgbiiX9EXaH0SHaP7WAMpn9dwAyXDNx9T07 YDJapF8ckN73QBgnGPamr20kDnVVx5LZod3JoS1QCJ0ZIkJzNj63Jjv9U Q==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="230129771" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:49:53 +0800 IronPort-SDR: rFMmifD97OKDOSBgE9ARk/h5Q9oCS21XWi6UzFQ1rA1dP639dfUZdrsUSR4E7+0TURHap282Vr fJ91SpVLxYy54hpQKLH597KOnkEiPmxJDSVLJ5lUlHRfMH8Y9bO4xraHSXohwu+MBq4etY05aO 0W7/HlE2CHchUdGyLOvBBBaYwLzSXF6jhE2KJfuJCqRKowZyIMnwX+VLzhQIYwxCuLdHx5ZMtx +ukDODnhoPcOmUakxezUgvSOC1BDP4+vYrs6Kft8l9XjJNn24sJQ+m7pfqNrPb2PbLEHGIPIdM dvw= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2023 08:04:45 -0700 IronPort-SDR: u+PASvmVFMOeoxAfCOzPTJVxs9w/SxKXdV+WL45zR5MhQmBtIcKpxPC+suAbA8R40WSAoABsDU Savu3CckUXivbi6WToWKdQUwLLmbPrlu+t0D2w2adCHgpIa07VBP9yc9YZfQWP/W4p3Ho8L2TP qdpGq1vryZADT62MQ7QL5o4LjYTKjHlalTuDTjetxk+HbtcWGU7QYi1lbKcIylnIUUvlIOyZMf GU4oqaEupybuJkpumSK7vLspE4ZBbcyj/b78AtZhDrf17exWHWQM4qistlncc13/I/U8bGzbTt Qx0= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 30 May 2023 08:49:48 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , Mikulas Patocka , gouhao@uniontech.com, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v6 07/20] md: raid5: use __bio_add_page to add single page to new bio Date: Tue, 30 May 2023 08:49:10 -0700 Message-Id: <6cdf62501852fa43493ba866a49dfc9e859aa5ee.1685461490.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org 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); -- 2.40.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 7143AC7EE32 for ; Wed, 31 May 2023 11:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235415AbjEaLik (ORCPT ); Wed, 31 May 2023 07:38:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235279AbjEaLic (ORCPT ); Wed, 31 May 2023 07:38:32 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91CE10B; Wed, 31 May 2023 04:38:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685533108; x=1717069108; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3krWE0DP9xJWhQSqe7JjRJmAUx3KR1tDfQYkyCcToNw=; b=SlX/RQbvFoDTYHn7WXqOBQs1wlbIIzJMTqxGUuh263gkz0M/O+RYU1Dp iArYxkBam39QR+JvVLBzVwRMge34W5gkyMmHjw1BffsoAvTkcb7n/Rl5j VO0Rvq0WDf+P4YEFA1BFCxZkNMivpoc0cPNDiVSzMASa863iVstxpBX30 X82OxyTVyqR/QdwLIdy+jVyHivcg1sRASZNnXIDoCus8D65RDyErJRLiS uUnmlx48U82YDDkPI37FwAKl00No9Heo4u7WqE9UOoUZq4f5DibNQBPSj oTJSNVW1N5bIfj0Mg11Lh73T1ag1NhGk5rx6nNOodahHGAe7VRAqnTtpJ A==; X-IronPort-AV: E=Sophos;i="6.00,207,1681142400"; d="scan'208";a="344179061" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 May 2023 19:38:28 +0800 IronPort-SDR: SvL1puSwGg8UtgXj9foXvbGD6ckDUVNPikFrqswvarM3eSEvEQquM9icvcX/uocjhKkd9Y67XZ /cDdqvYm1CYh4B5iRiI9h3y89ebmCDl/WowxsIVHh5p/+rh7HziR73TjIyVfv851wrrN8Nti/E OfXvmAAu3jvETZa2bOnX74vFaFpLws468G8diDTkeJgrL3lHH4QW6Hi0PcASl8WyLp3fQPUVll B9DvDb27fqG5rRlYBnQRN1Bqt/+J7nwvSuSe1UWe3GbThzmh8/Sx8BYo8egMgSmcXE55H89omK ngQ= 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; 31 May 2023 03:47:40 -0700 IronPort-SDR: 47ImJaGI0R9IgPMsLaQXXdNwrl6BEebozUMm1VHcJZOy8vHI0VguiDlLtNbCdQ0iVmIlwZf2KH MHqeMR3rx02VYb9EZouZVxWQXSWQLNGu5k0JnkvB1/MmstC7zczZtC9/Xm9nqDLaDvbUVAiLYq 4BiFarfx+Pmel2FLUYvzqM2dKdGWHPP/5Bq1M9lybi1epLOXbOCcLT62MykPChljCayYuf48Gw SwqcdZmp/HRFZLnvhq54wc+8zznlM1jWToLdgjEKNUzcmtTQh/xrIaFC4s29CsGWXKlhWyjqWE ITw= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 31 May 2023 04:38:25 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , Mikulas Patocka , gouha7@uniontech.com, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v6 07/20] md: raid5: use __bio_add_page to add single page to new bio Date: Wed, 31 May 2023 04:37:49 -0700 Message-ID: <6cdf62501852fa43493ba866a49dfc9e859aa5ee.1685461490.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org Message-ID: <20230531113749.QyKkTpn9e_Mpb3hroxi1RtssmRXGSI5t2AFkAAOojIY@z> 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); -- 2.40.1