Message ID | 20230502101934.24901-19-johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 E08F6C77B73 for <linux-mm@archiver.kernel.org>; Tue, 2 May 2023 16:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E78E6B0071; Tue, 2 May 2023 12:49:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 498A06B0072; Tue, 2 May 2023 12:49:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 360016B0074; Tue, 2 May 2023 12:49:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2725E6B0071 for <linux-mm@kvack.org>; Tue, 2 May 2023 12:49:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E562B1C7F4D for <linux-mm@kvack.org>; Tue, 2 May 2023 16:49:23 +0000 (UTC) X-FDA: 80745900606.15.7CEF3D0 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 05CC51016C3 for <linux-mm@kvack.org>; Tue, 2 May 2023 13:21:28 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CVnT4Ujy; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033729; 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=MYBDhVOwI/2b3PaBKbTYoIa/G/0NeynYVC65r/J9gLE=; b=bLA0utmq6e/HBNTiewXocyKykcj3w5zX+qXmXqg9oCV5kushM+/Pdt6kf5/z9+lbGzOMs8 cGDCTJLCDCcHCD58JyslFnNTNqYN3pyM5HcfPn/mY5z9XeWMBJUIM0hlF7q+tYuYEr/dG3 ZTh3KrmJQjy/CSq6rlhHekOd9d1DTD4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CVnT4Ujy; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033729; a=rsa-sha256; cv=none; b=S+AjNzLJxK7uQL6TdBaGZpo+NaiVLRIaXBCtR31SFAW3U3LlQNJy63hSd3Ckoy4suH7miw 6Hl4bVrWGbsU+jq6cTrKN/4BX+4SRC1SpUGzXS6+u/3xA7s4vOj4Q2wES5KOFy2jhVJKIs SNRe1BUM9RiRUOPjFNKYOYzuNGAwkTU= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033729; x=1714569729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MB8IrW3XRF0b8tjpVHZZO4VEKTGu+LfkwhaA4xbI4qQ=; b=CVnT4Ujy67MaKc1Oxk8qdqYiuVnccHaSBK757tjoJEW6ZfY7w0apar3R Psh7v7KSWq5q56K1apukoHn5W8awEPJIUZQw6zQgI7ySr4ZFUX5gdzGNk ydMCDz6VytwHFtoqQS9pnDXeFzMu2gI4RjCvPL0y/mWawDi5WcvaABN5r xWvdTJBU8VdYeD5bf2sCRbNWXdbtv3MHoEMS6cQXwMfudrmchdF3PUKbV cLjdwVu2AjfSpqXBJOx0PKWsB51Dyqxz+VdRueGSKOdb6Y8lOJvhnNXU+ 9t59spLNwtXexm0r4O8nfTox9ffcPmPHW1TiWGnJtO11Z2FYLRU4BR/MD A==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747231" 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:58 +0800 IronPort-SDR: veaakyWQoMRG6xduEbnOw7lA4sA2LdwRzvFqydr0SW9onKHOJwP7mFArWYk7eA7FxEAvKhYUu9 FVWkYPfxcMld5tYz6CCn2AVZb9pWeb1F4cHpRAwdAJ543ZDtAZ0vHNuQ3FAA3Lml37WqlNCALh 1KqWgG9NwLcCyjRjUlyrAHLOpitWLni43565RqEW1beIvYiLr9zsBR6tZXprhJ12RFZ6hux45X M0xOyCixDFYdJ9z8FqcoQSMNN8hfiOmCi/cwG0azkxt/Iq/KPDWprHcQAe/CUKJ+3djVPT1gvL evY= 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:31:45 -0700 IronPort-SDR: dt0ORTo7y2OvtYPVqxqZKcSlk8TEG/M5IxYJloXDNMtpbFDpduCookvi33MCWWG4kgtbDfnjoU qNWcylSMPeGsO0kq0NXDl4G2C7gt3I+rFtkistntPpO5mSXx+HBp1mYREWSzEfGneChk6WparM /i8YU9a9mKVsFFGu/e5aSvIr5Y8Ea9LImoNB16+9AysmzPJOxOBZEoak3fvRhFlXukbVn/nkDx drQrakT6xd36x6OU6prDHLUpKa5+rnrr2e8A/8Ynql1R4XRsK2thU0KyPWPdS53E7jOulhZ7Dk rYQ= 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:55 -0700 From: Johannes Thumshirn <johannes.thumshirn@wdc.com> To: "axboe @ kernel . dk" <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 <johannes.thumshirn@wdc.com> Subject: [PATCH v5 18/20] block: add __bio_add_folio Date: Tue, 2 May 2023 12:19:32 +0200 Message-Id: <20230502101934.24901-19-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 Content-Transfer-Encoding: 8bit X-Stat-Signature: 5mzfnu57xr8h6a5jt1fmbzk9833ky3jd X-Rspam-User: X-Rspamd-Queue-Id: 05CC51016C3 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033688-625362 X-HE-Meta: U2FsdGVkX18DaNLossmYDdo0L4w8hNADLVYuO5rpkRxssAKQh8/iDoS69q9e87I9FmL2oUFFlDk2pcXlFBs+ZTW07xd8BIkjYgPr9Vua2atv2O+HgNZAJd7f1bJNEwT/eWTIRKxjVSckm6rjGd9u0424RPhuZkIDnmby4Ml9grnqZ7H+CNdQf78oZL9ESh4DSYTJb3DJXH/B9Q3zjbenPFJaV1xGtocFVAfs7JXQ7Dv16kEijKoPaTbOy475h8RC9roT6oTKrdR3elJAwB5OTG6eOaS/bned1sdhycoEGH3kWVTzCVY9SST5h/DZIlDpzGsUxmS4NhZON0unG0UfH6vc8ob2VXT+siaoTmGwyydcSuG6iirOOmVoc3P86UGxGBzKMXKgEZAjHJdo1FuAs5N28nb4BGfk1oZm8cQyjjW2N9+WW3WVQzKIkvTbPQWqD1fUNQU5Db/W9YG3T7lZ9KYb9S73Gfetsmz80/8J/LW7zuOugY3alC6UWXG5dvdtMhtHSk3KVViCkg5MfJVoWkJ2A7B4xN5YU/A10K3PbJ5XIDWrgWoX8nExC1UQv2HVR6L1eb87kuuKQZRqaEa9Ju060VVNWl7m1M3PXbgqHHRXvJluXVt1mexV2U7g04m7zjWsypt5JEPjrcF8xl5zOW/Kcm9rbUjUJ5hLPjsoKVWz9Qh0r/f3kjqzmJzNQPqSaRH0K2P6XuyilAhMt+GqLV23z+E6zmz5m4HevLpy3NozT9s22z9qW1PKQe/OvGhTqRif7R8ZHrzuzH0TBgCoDA+F91txD9UCEBl1DyuX7Y5uAftDKYVkyfCbyVwxYMNyO37i1AZXpH6UEbsH2WeGwZDMplU2pQHUowuRcCBIlZUw0wriSpgt0sGRJ34NgJBslbr0JIfMv8mmgE7T6UgQU1tK3g1wOwBFiivhEA0151VlSt/O3Du3Ws0g4Unq6EkB5d85My3/KeLot0Vppm6 WvrgqP/g xpAo76vPhR/03/Rjrf4kFUwF7TP29ubz2z5FG2Qi8uaO4n2dYm7OT0oYXHt5BxKCw/GegRzHVv4pukyunv4jLdXhn3dYAusBtdKTGm++IcTZ8bwcWXHefK+ZKLT7Mhi88H164PGNxVN/gyGNZbE+SfEr0SB0eHa1/HWqY6OmsC3JNcmKhc4tBUAILDiRGRgaFam/elfLYVeuMI6oN2Obqxd9kHZA/McWSVBGP 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: <linux-mm.kvack.org> |
Series |
bio: check return values of bio_add_page
|
expand
|
diff --git a/block/bio.c b/block/bio.c index 043944fd46eb..350c653d4a57 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1138,6 +1138,14 @@ int bio_add_page(struct bio *bio, struct page *page, } EXPORT_SYMBOL(bio_add_page); +void __bio_add_folio(struct bio *bio, struct folio *folio, size_t len, + size_t off) +{ + WARN_ON_ONCE(len > UINT_MAX); + WARN_ON_ONCE(off > UINT_MAX); + __bio_add_page(bio, &folio->page, len, off); +} + /** * bio_add_folio - Attempt to add part of a folio to a bio. * @bio: BIO to add to. diff --git a/include/linux/bio.h b/include/linux/bio.h index 5d5b081ee062..4232a17e6b10 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -473,6 +473,7 @@ int bio_add_zone_append_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off); +void __bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter); void __bio_release_pages(struct bio *bio, bool mark_dirty);
Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- block/bio.c | 8 ++++++++ include/linux/bio.h | 1 + 2 files changed, 9 insertions(+)