From patchwork Tue May 30 15:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260554 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 5CA21C77B73 for ; Tue, 30 May 2023 15:49:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E269D90000A; Tue, 30 May 2023 11:49:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD784900005; Tue, 30 May 2023 11:49:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C773690000A; Tue, 30 May 2023 11:49:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B8DBA900005 for ; Tue, 30 May 2023 11:49:56 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5CDE21A027D for ; Tue, 30 May 2023 15:49:56 +0000 (UTC) X-FDA: 80847357192.20.570ACBF Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 43C0C1A0026 for ; Tue, 30 May 2023 15:49:53 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=feItHmtb; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf19.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685461794; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1S2DSWAZA9qgvAvQBzAiSeR/Df+u9UWYi0qKutiToQ8=; b=6HcBPsmDL8XzhMWAG8D9akg5qz79WOLXFzIp9BBceqrcqDo6Byq5teQkoVh6ZCn9lz4OzJ qOTk5OBAA8qKQ7W1J3W84cXvvo3bClqzlAZRziiTfZbvrCFHn+YeOqaUfCsb6oIfCzIH9n h59DBi8oPHCrT1joN3pyXlj8ud6OPm8= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=feItHmtb; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf19.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461794; a=rsa-sha256; cv=none; b=iqFPzoDFaym6lb3cGcUtaIzW6oepLs9wUgopbRRRAfwJkMiUAy7B87Hm8eEIImc2u1gi0O fcK4LsT7BN9i3ENDETlX5q+8ce7MCHjcpOTDunULBMoiBokYHqNNSfigwu4rBccfrXdRdr ce5ZD5WPMnzX/7ql3Vo18yomqTd8oq8= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461794; x=1716997794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3krWE0DP9xJWhQSqe7JjRJmAUx3KR1tDfQYkyCcToNw=; b=feItHmtbihtlr3h7+dOyrVe8+TpvxQaxjTJclmI+RYEaFJ81mJ7GWps+ hQY5CrpsV/t2z9okiS9anc05kNXY6E/7YqNrBqD5Q5D4SeY9ojkVQumO4 v0jTMCyG4Sr8VpjrDHQKLOaVvmx/wnoMJF9MlnvwrnpwEnCgLFLrRbW4f fy1zPYpvRqJ5R+GDk0GUzzMNdv07PfSKOl+6PtG1yahzyT28r5b/Xnewt pj7/AeFGhPHuIgvAixvM9ml7AFIl3s1DZEa0cvtDcVApMlEtp+OFhUxcp vbTn8dpcK7gulJdG8cHRRCkEuuIhmqKLgFeM6ssfVA2qIaHrACvpgKyPH w==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="336465958" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:49:52 +0800 IronPort-SDR: zBcC/azQruG3jy/y53zIegFCkbihUPHmlvRnDPPmJ31JBUhbrmQRiq/I0sll71K8vXMU5FxLTo dh9Aiv45H4w3ccYgqaQWAoGLzG3fwYks3bln9MDtpO3chFsCMmrd/ExKMIEiVOWTOSCtDB57pf frkGV1wjNi/FAXi1FMuVmSYaqUOGCeJjj+ZkIOstUt0aGEYlhRpgPAHS7LvLLnT1DL9aAk5SEo 6YfwTQ+hQJl8697MH20UIBmyasZaFI1CqyhHT38ttWvS5ybY4mRZM3YfMkYrIMpkg27XL/c+Ob 1uc= 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; 30 May 2023 07:59:05 -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 X-Rspamd-Queue-Id: 43C0C1A0026 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: k9tqqakr7a93ebjs5a87s8wjf5znmyf5 X-HE-Tag: 1685461793-273202 X-HE-Meta: U2FsdGVkX1/Pm9LJPvRqHdCdN5b6gYDtin1mS1n3s89cM3gKYGsJPgNkWl3JX3NVeg4kFgFA1uMtk83zV0BZX1l36tPbg+zDUhmEUcK3o7tMa2XJDq6uvl9f2T/BEo5ypo1SX0HC4op/vP5rm+8Qvwmm5AWC4hw7AG5CK2XnH63ycKS5H2Lsz9o1VXzi2ET9nnYbPVLOx5kpWdPzpUMo/yJfWYC++d+/9FviZcVDgT21wDkDliX4BztJcppRpSRPzRL7xQ7JBpbR79Rv42wj9V6sIZXfSqMyJw6K+RtEcPoVUpr7xiTZkwldIy3AYpmD1Fucfljzno2OVlFzpGV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eLxbPWUbhpnmIigUCEHQ51acRc= 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 Reviewed-by: Christoph Hellwig --- 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);