From patchwork Tue May 30 15:49:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260552 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 F2C63C77B7A for ; Tue, 30 May 2023 15:49:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A8D3900008; Tue, 30 May 2023 11:49:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 859E5900005; Tue, 30 May 2023 11:49:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FA53900008; Tue, 30 May 2023 11:49:48 -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 5FEC4900005 for ; Tue, 30 May 2023 11:49:48 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0FE03C02A4 for ; Tue, 30 May 2023 15:49:48 +0000 (UTC) X-FDA: 80847356856.10.9A766E6 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by imf08.hostedemail.com (Postfix) with ESMTP id 45C26160025 for ; Tue, 30 May 2023 15:49:45 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=lY1S7Xac; spf=pass (imf08.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461785; a=rsa-sha256; cv=none; b=l5iHSmiFcZCem39UR/h1kOUGzswvhajml6hHMRrH9YYCco9Wz1xcRWCQCQtmA7F+J0L+nt kzmC8EXQ3CEfL2590kUrL3upFox0XBV3mUcAVwFElYBhSAFwZ3XpU4oGbr0Qu0gs6HLlhm an3zYoDiWxrgmvPFxSwlfdTg22ysSvM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=lY1S7Xac; spf=pass (imf08.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685461785; 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=JaOdRASqHT7xzwXc2NQuDZOUhvsv6oArp6EMJMX683Y=; b=pQcquImczOwnQ18cslIIHgI3ZSR6Yih/dRJmzMXyAVUVraw8aFyYJAjEYKPNdmhTDVMu4x 0Cs6G+0VJ1T6QXcZat63MpU84apixNaVD9TgLZMn0nwnC9kGGIpfy/qREKTZRD0gXZSOKJ oVsdGSa01d5C+t3n1BEy9MEwmY148Ro= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461785; x=1716997785; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I1+TGenMrGdtSWKYS446AepXRO4LZgePrjmNY71VmmU=; b=lY1S7XacT7XbJFt10xYyXmY5A8w7A6LoQLrr2ZkynFv+FypNtyH8VyTf kgm5nQIO/uuGuyJkfIUnpVl3hRhPzO2Ie0N7QIfj7YOT0sZq4+OSC4Xnl q8jJZ3coQ9tpeY6xa1MbXKP+/FU7pK2+jv2KanlRKoDx9PfiXYPjChzTB TKG64ufx6nfldfGLahYsq1EDiF2awDSLp/WillKuFOq9ewRGgylICvkim ecvQJ1mE2FgwL4Cn0FlJFd2bk4GM8KCPpZ8bq/6kWBc2gokKGZSX4Je7M QDt6yv8XMd0q4kKJLKZ0+5dNyZXy2x/J+plWcUlbiu0APixeEBWeBy4rm Q==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="230129757" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:49:44 +0800 IronPort-SDR: SodrCq/b4x4mZbK5u0GR3LYvsAMkbsAX4HxLRdW7NDFOFFInIgeUXyrcDUwy9Jy/BiN5FwMpHD lAM7hHAeF25xXxTBCDr8VEJI7RoH2XWQopidvYmYqVWIm0BhCehDhKDq3ZWCo2UkOxa5T9zsSq RvQYi/zwiTB+j13ptnom2n8OtZl6WRHpLBAPSt/xic/4YGvvoZCw8iw/DQkoMbQz8Utfn1dGFR aaEwIugMJSSSHNhoibjWFGfrHHRAJAcLjajfuF7zZHPGx06VCT8vCNYOwRDr+qQq/iVIjAPL0N I/s= 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:58:57 -0700 IronPort-SDR: KJrqulCfq2cqwjkpQuj6PyVKpC28Y9PRziJGpvtZLpCh0rnCFASYlRta5kVMItHLPqq5rbqivp lMPfQqlHbxJojiNO1f2byMk3lcSCsyJM5076LR2t1Uk8MU+mMSei3mzF7GpXMo0mg3+kEecLxf OyMUtTmjzDB92M0Oo1Hytx+Eufwx2D2FdxOYnT1IorOXPeITVFL5E8NvDvefbboj9O9qo/Gmak p1SuxcEHaJrwbUasxNHzxhTj/f1bmxtqyWfrTpTKU/3g7I5gd2SasjsbToJ4cuAKPzx8T5MMe9 2F0= 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:41 -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 05/20] md: use __bio_add_page to add single page Date: Tue, 30 May 2023 08:49:08 -0700 Message-Id: <8b046033b3b073d1ea91c45cd278b7aadd0b7e1e.1685461490.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 45C26160025 X-Stat-Signature: rctxpmau8mt6wf4ijnsi79ty9sucz9nd X-Rspam-User: X-HE-Tag: 1685461785-349574 X-HE-Meta: U2FsdGVkX18AU00WatD7F53SlVuE+HCUGDowoKHIunQQwCh6fdIKKFs1bzmrTBoky0JSEtZ3lek9IfHJ8J/lHW9KIUC5aNs/KXzuzlcWW/CHVX9+z382woYo8ezj6HTKbqXr/MFvIDRM6+hzpdav9RymC3BhKAO89oHLJ3OuIcpvG9Zxl6KtODHUe2BZcxKlZvLJYFNJUAUf3ohdPpFi8EHVnEIE3+vxtE+0Uu514/g1HEF3+xIvskEhikcwvAEAlnaFoAUu2wDBKmy6OYLbTkiybY0OTcITYwBrI7qvGMEigXq0e/RBFm9iHfMefAyw3XPmycR+yS7M+4lST3qt1kd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igI59FL2ITQjcYEDUq3nkcsuo= 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 md-raid superblock writing 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-of_-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu Reviewed-by: Christoph Hellwig --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 8e344b4b3444..6a559a7e89c0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -938,7 +938,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev, atomic_inc(&rdev->nr_pending); bio->bi_iter.bi_sector = sector; - bio_add_page(bio, page, size, 0); + __bio_add_page(bio, page, size, 0); bio->bi_private = rdev; bio->bi_end_io = super_written; @@ -979,7 +979,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, bio.bi_iter.bi_sector = sector + rdev->new_data_offset; else bio.bi_iter.bi_sector = sector + rdev->data_offset; - bio_add_page(&bio, page, size, 0); + __bio_add_page(&bio, page, size, 0); submit_bio_wait(&bio);