From patchwork Thu Apr 20 10:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13218309 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 26E13C77B72 for ; Thu, 20 Apr 2023 10:06:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D49C690000C; Thu, 20 Apr 2023 06:06:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF71D900002; Thu, 20 Apr 2023 06:06:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B21FC90000C; Thu, 20 Apr 2023 06:06:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A3BAD900002 for ; Thu, 20 Apr 2023 06:06:17 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7088B401F1 for ; Thu, 20 Apr 2023 10:06:17 +0000 (UTC) X-FDA: 80701339194.05.A38AA41 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by imf23.hostedemail.com (Postfix) with ESMTP id 8BE18140026 for ; Thu, 20 Apr 2023 10:06:15 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.49 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=1681985175; 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=ybte8ln4cL1imogQbfLUc6IIuAFaJLWmv8LuzJpUUJE=; b=2cMBHZdbWfWvMfOkFha6PWD9oaXPwhvzn9wzZFB9Pm6tznt10UpSwoCo7f+irYVTUEWp57 axiKQKL/kzebudYFiJ7UButKD2WOc9Li3pRnEWVAEC0yVozSUKyCZMGa5RiKEDcVJp3v6N 3SOwYiy+7pNzWuUByDkvr2rgb2GT5fk= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.49 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=1681985175; a=rsa-sha256; cv=none; b=qOwJVILqEJRuq2muF4pgsNup14m0KaMOf+002DInv2FmyBhmjxXWY8zCOFiA2bX1t2r6l7 kTAXczPu4e6m8jhnP6n8z0yJVGi2qmeTa8UWXBf83aMGlhluN38WuwfXP41PxMAjgGXQ9W VhJQXn4PIXmJyCAQ3d8cPn1gGMGDuT4= Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-3f17eb6b10fso3445445e9.3 for ; Thu, 20 Apr 2023 03:06:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985174; x=1684577174; 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=ybte8ln4cL1imogQbfLUc6IIuAFaJLWmv8LuzJpUUJE=; b=BMX9ssqJBED9NgEgpduyE0XzBfYkXLkGEqxF8+WWl+Pi1ahu3IH1fli2MgJU0tNA2Z 6M4Sv6ZNTSrGKKQtevXVp8NPDn+IiO+wYV4rUzP9QLy0pBmgqYPt/w0xTKfbX2lWq/rP kH81504QhNDKLFXo1ovGDcZlTh+/vv8k3BSEIwmX4XsndWvr1TagZi6qe+mNAnUuxfQo jtO12F4sTIWFcM214WaFlvaCxiqJx/ZvqcdObmv+N9oSjeH7rEGqzhMaKGF6QGp4EVxF 4JC5gusd5gT1jpMcaMBXkvgp6GRCTitYArRh2hfj8egJ/56PR/cdogmH3p6VHp7VQPJY MG7g== X-Gm-Message-State: AAQBX9fq2Z8RUQAGUugF3kjIY4u0H7TrgCOhsBkIB6ri16K/XVRfT+vG cX9XDnA1+JRk4m0+ktt1uSA= X-Google-Smtp-Source: AKy350ZrFHrJO95XpjLsqvNhaT3Lj7em6PpVK0jNKwO81XYdkMaIRUgqMSWWRox8APZBVDphzDkYwQ== X-Received: by 2002:adf:f384:0:b0:2f2:9198:f0f with SMTP id m4-20020adff384000000b002f291980f0fmr833210wro.10.1681985174142; Thu, 20 Apr 2023 03:06:14 -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.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:13 -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 Subject: [PATCH v4 20/22] block: add __bio_add_folio Date: Thu, 20 Apr 2023 12:04:59 +0200 Message-Id: <20230420100501.32981-21-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-Stat-Signature: q9ijfpa5sifhqjwcyg41jzq1sngomggn X-Rspam-User: X-Rspamd-Queue-Id: 8BE18140026 X-Rspamd-Server: rspam06 X-HE-Tag: 1681985175-555937 X-HE-Meta: U2FsdGVkX1+2914xHz/l6Y/cCoAwWGinx69w7w6pu5lOMUXjXtqMtMdDHtUcssWBGAvowzY1WoDb+c+DrRQTIORHLQrXjnXcRrEPuJQqIJPS280wwmSFWWkoVh8ojMnN+SaCmDjNwXEWcHA90HBmbxdm+S0GJqqSy01Bmdfi+pIJDMJHCa0OcFYxYBNDdElxfTxYsp7abONesriiA8S8UlVHHsM0yia8lI7Amyy6gI8gIbZJo1HXSfq6pHqPdyPchC5q0abWHhC6xf2Fiqcg39hniTid9a4DvkmuxlnjdT5sLtie5O36EuKEn1pGR6iKvPlXwtPTSJCFYc53KB8fI4sFPZhNpyrqAcGgCXI7Y6Lt9ZxZAt8gsInLlIeE2I0Hb1WTgSB2knXNKLaKrl9tM7bNmpdZWlPv1rwE5ZIdFSogLLbXxipvdV/t+K7oPslCM/O3a/J6PUEQK8QgZN2vupWWyTRESmXF8o0vcDh4FK+VXPdoNK6KanCHr6Yg5UE9lC7Tb1VaC3AEG+AHJdTTVcUYcCcB3WRnFw/qo2RZl3Jnrybd334/FG35CC9RCEZ+9fMXemhUtwH4klbqnvhNWF59u8DpVDuiMPblzI6ubklhFzVFmncZJWgBD5Z6fJFsgI0VHDNDwB5OGNHoWIbBpeHKsFgSYZwBnYHGiDr8Exb0bDpQCVBu8pOL4u+AfxDALQW/RIHKPOvH6UlVd3n4NhOcJQxxnFXW9PrZYgiYMDzILXrhO+BMaPsgUlhN7AR0Kr142ZFdsLlNuNz2TvMo2NbtewwTSUzxtgyHnSqK1iG0KiyGGXzdWfQJCIRJgmiKD1tZSwdT/HO1blHW15EkOLI9TQmgSrDWhg8hBFjUmmlc7RWgEWXOzTlu5iZa+dlZAvFuU1a9V1/4jK5HxxD5pBWgntV9DW+3ZEvE8N/oniTm4v61YUfmE8ckio2/LQuyRD1ZMP0Jq0IrfL8SSiT qyd+SEd0 Ka8JLicMMuDMIO5e1dF4GfXZKfdr+U/swJW5RLZzLw13s59uihmfZkN0U8tKiALjIMQyKlm+xgG5xzHqddBbTH0RnQHf0Qzr5eTdin57CDXe4ClY+Ju+Vo9re2sdP3sJgckz/4iakMe0zrkcLZxV9mrCX2PXJeFUecPoPKVfW9HL4d+x4qi7LV/8h0COdpprtUy/b1wca77lwL2NeAj+jUqMbxwbXvVNvXiyRtg0TPIAzCdIk63e/byA5ei7VCaCQTi4XQ6szQxDcOkgvE9oZ/JBWcaUlFkVRjDxLe66RpM7RHiL3A0ZUMUx0tN/L1aWi2aWrNKD4PGgwdiCy51WgE/Ea2RVPLIe7lmGlndEY/vTNPtNImJy27QlHgOgHRTNO/ouyDa/LYjGdjBflt3o+7gy0WAYeYh1eYlrE+3qkUgq1LYZiesiOoZTRV7GAXpuxPbZppu//T2dQfp2UNfHomH9fWSX1HWy59zDGJwBZXXx56IwQ/7YQJhXA7TMk8oayqxxdBBQESjnX1a9seVp2/YiI9Bs+dGOJmTFqsnHvfT0bJ70l4oKes1jPpkHkE1kE6svJ 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: From: Johannes Thumshirn Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn --- block/bio.c | 8 ++++++++ include/linux/bio.h | 1 + 2 files changed, 9 insertions(+) diff --git a/block/bio.c b/block/bio.c index fd11614bba4d..f3a3524b53e4 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 0f8a8d7a6384..99fa832db836 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);