From patchwork Thu Apr 20 10:04:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13218303 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 DBC3CC77B78 for ; Thu, 20 Apr 2023 10:06:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 750DC900007; Thu, 20 Apr 2023 06:06:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 70149900002; Thu, 20 Apr 2023 06:06:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C8FD900007; Thu, 20 Apr 2023 06:06:00 -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 4DBB7900002 for ; Thu, 20 Apr 2023 06:06:00 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 27EB61403FD for ; Thu, 20 Apr 2023 10:06:00 +0000 (UTC) X-FDA: 80701338480.20.29DBB99 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by imf01.hostedemail.com (Postfix) with ESMTP id 51CBC4001F for ; Thu, 20 Apr 2023 10:05:57 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681985157; 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; bh=EWddmUi1sUqAJfDu3vTNgbuTywHhrfsi4XwupHN4WwQ=; b=Wbqv2FGeq9bU1VOkCTgMfW3OUfILvVwcehsTryH448LsEF2QZ/15TOrPKzoPlDAPX1sVHJ nS3XJkGJ6nHWMSXGx19J61TzluHTh4ohNr25JRJBZapQkIR5nxJ/EYoHaov/up5iVHmXjN U/DVXTNJ44ujpfR9Ah1Y/27gwgu4T7U= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681985157; a=rsa-sha256; cv=none; b=feMpPUxmTDhO3JxejKb/J//TrnPuHY3qNCM9HXAmzrDH3pMOMdpOOCTwlUFP5QpXXMBs5H BWTwFSWlAPR2wt7KbEfceI8T6XgqfunDUcohb/UFHfPRFFRn0CB8hRj2ikXz+S/NE8P4mD oua5mEyu5DRCC/S6l4LfHFLLP+8+BKg= Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f17b967bfbso14824485e9.1 for ; Thu, 20 Apr 2023 03:05:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985156; x=1684577156; 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=EWddmUi1sUqAJfDu3vTNgbuTywHhrfsi4XwupHN4WwQ=; b=LRzX5h6FqEWqWvbf2rc5uGmuWfcU8Pxd0O5kR+TZk8dGacjQxIpuhhMSlmOWuZMc4u h4ITVnqTXk+55QjOwlP9GDockYXTJdMZ6CE74pSEwd/qy7TxVhCQusZYBQ0vlWEUEhjS LK5Al7raygENwoAzVIzVsRm6YvV9wOvg7sLToUR+3uAEjOTg3rnJEZZn5ZoPWj4Itu4W JcdKFCGKioDCfHy5XGMy/QWBDonp1mZF0Vk4664/t5eJ6BXLxy9BwSiH3UYlQ+zyDRQn vQzuIbONJtqrpD/o2fg9mkJnK6lnLALLB9WKaJfKNH0TU65Tmuqph8e5mejG3ADcr2kH Ilrg== X-Gm-Message-State: AAQBX9eN1woZQAoNgC2s+j8+PiUXhp23XOe8pXSpR9XD90b6kf9P951O j5YDaA7gK7/OIxQ0/btL35M= X-Google-Smtp-Source: AKy350ZauLkuXWs6kSjBHCPBBCSAVBhubP5jzpCR4qZ4hYu8gg1Jhd0aZ4abYsMUbuSqsM3DfmG2NQ== X-Received: by 2002:adf:f2c8:0:b0:2fc:114c:76e with SMTP id d8-20020adff2c8000000b002fc114c076emr899567wrp.27.1681985155941; Thu, 20 Apr 2023 03:05:55 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-208.dynamic.mnet-online.de. [62.216.205.208]) by smtp.googlemail.com with ESMTPSA id l11-20020a5d674b000000b0030276f42f08sm201410wrw.88.2023.04.20.03.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:55 -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 v4 05/22] md: use __bio_add_page to add single page Date: Thu, 20 Apr 2023 12:04:44 +0200 Message-Id: <20230420100501.32981-6-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: 9s9616oxwn5s54558eq88fhwmui6715r X-Rspamd-Queue-Id: 51CBC4001F X-HE-Tag: 1681985157-432276 X-HE-Meta: U2FsdGVkX18mx9+rbsIhay8E8ojqf042ztui5VaWoTYFWHBBG5t80LnfxX2GNzEdQwW5cxyfXfVNSs+NYkzod0DhQ8QzJyJrSPqLJw66f4tbH0LEbhyBc1hOhgaHSdTA1VSu/BxXtA3TwzgiZkk/ZZWvn7rIxGCRezlOP2Y7AT3qwO7HWbk2Y0WAoKOlhxtl1m9+bWJ2tVFxfgvFX6qwqEOUyk5R58ylnDqNU+dpm6wNuE6D0j1V18TeDUbk/cQ+/SqRDPUUYD7zjpIpI2jjRiMwN1nZg6J6wk0QsJmY5qUMIoFIiZNRaEe8KKw3cgtfm9YwsQMlRlClSe9yKR+NyW7BryLRdLWYHXEt8vm6Ff8N+xn/Ve2kSqZ9JrUj7vhlOEijhw9Em1RZeyiWq9Fx1LefuSVDlHEG3FDucbJ6s8rN1ejqUdn0NrI3R8RoAVHAzie4aOlNd4smN/GX8UFoEMCd9mg1PgKU7Kb2c8D3EuUGcxUWpRyr8f41w8MkG/I5rk/nyBQDuDiplPu3VZG3Wf2F4vwH+cmD3tjeBUZMAEE6Jf6UHnKpVnk1O2dbhMJUu9G/1FJNSwfFAQTd+YLbSJaLL6507KTaUKQzbiBtVPNZLnS60wR+LSaiOxROIFoDBbfgJXjbBV3r7waXYQwVR0Hst1jZ3d7rT3iipefWPKNj5uOisj1wMgoWID7X43BnXuGQLzwz4W1h39VPeSfKBoL2231/OPo5lTqIE8PA7CvHO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sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Johannes Thumshirn 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 --- 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 13321dbb5fbc..20b9cd7c2f39 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -958,7 +958,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; @@ -999,7 +999,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);