From patchwork Tue May 30 15:49:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260565 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 23FCCC77B7A for ; Tue, 30 May 2023 15:50:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF1D8900005; Tue, 30 May 2023 11:50:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA214900003; Tue, 30 May 2023 11:50:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 943AF900005; Tue, 30 May 2023 11:50:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 83F92900003 for ; Tue, 30 May 2023 11:50:28 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BBFFC120294 for ; Tue, 30 May 2023 15:50:27 +0000 (UTC) X-FDA: 80847358494.26.A5222B4 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by imf27.hostedemail.com (Postfix) with ESMTP id 924E94000E for ; Tue, 30 May 2023 15:50:25 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=QSJMo5Xp; spf=pass (imf27.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.153.144 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=1685461825; 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=XqmW/pWhr1cgDEAd3F/aGuYlTwkOFNTZjCl2H81a0pc=; b=xsxyUEVe6ohsucTkXuJddeSIt/AwoOA6iqj5PPNsy5HoMXLCNY5JTQvZw+YIejzrNcahY3 CiId9yIX+FsYi73qX3fLqtPJkUVqElt8OMv+3cc867pogScwvpmIxUQzbbspRciBlsA/Ym Uv9uPrE7AfXAcAa1fo6mNVd3Frt0uVI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461825; a=rsa-sha256; cv=none; b=cdOireoioyX2k89NEC0NBKabgPZ9MhdpP9GZGQJtJ3XQFWWFnWJwPFVC4I3O6kMql+h30Y /Uy/zLmEfgT3Zz07enZvDaaWuzlknFpFRoDZMFGbSwucG+E+iIREucQI0csv5nvXk+IN19 t157w4toyQ09kQXjyBS38Rpkvi4+aWw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=QSJMo5Xp; spf=pass (imf27.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461825; x=1716997825; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wr+M2zDQXb1A/M8JUY7t1USwG0IIo/LDQXKOrkxoR08=; b=QSJMo5XpoNnAQGoDNxkamwqVQnMHQfdJ0TDjpmDpdpYq/lcKcnbeFnK0 T2Q4vv/i3xInZiIRUOBz51PZfB0NnqgugF6EX0de/BKG+iaI+gwfS/OW5 7r3sswKCItAw5Wmqbpqf509cLsdjXiIWF5OHKkTN4234bzZtaEsYnMaaM IQTEMoOKjE/ShH3GXxw17r4WpqBxzUmfpBbTYuLSnVSWlNxt9QI5ImGVO f2OcggSd2AdZTh0TOmtdwVj3eRVMjm0JloQ79NbZaJm/HiI0MuBhSQBac +2xthwvVtHieyUVvKD6Fw2Lk6Wy+mnV5tEp/pX2r+wHvxb9L1bc8qdQle Q==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="231905791" 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:50:25 +0800 IronPort-SDR: SVpu8M76fNaLqpIt+Z9YHawBKN2XC/YwtkwqZNqPqrg3cjACI9Xb51O3F8VW7d8xoYKtiVHRuk gXoB7tYo2v5im18kJld0Y/eD5maH+9Y72/HXTk3Mk/GUZMC2djYYuYKtJuu1uvgpWE+U7k4tl3 KOrtgroN6+pmckNB6dZKnaQKBeL2tl1obx9vMM2swhuTTIAe1ZF5zyOtHTEn9eTeYcQ11NFlTp M8xC6Dg+SLW4elWWkA3Dvet0n+SPfMHQB1xn5/3txD9BA8Vkt/v4OCq3y9YXEprm0xQ8MaL8hm 7Zs= 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:37 -0700 IronPort-SDR: ZseWV5fWdzcZGsBvaK1MnzJbe6LJ/RDHXZo6rvQuZIvPrGhH7sOBfNMut82zppqTmYnoXKTB7z QrMk0hDekgJdL7i7w/cfcGZBQUO8WxGw7qvwaCfyj9g9v8vpCBL79fSHs9c7ocbmkyi+tKeTnl 5yWwIot/krgGKEZrPU2K+W7DW94upy4aq9B0nKyn95xRamrF3GJ6KUciaCyMyK5wqC2s2vs9RF va9UVub6OltLs9qszN3A4HrAJxFVHZVWU6ZfU0MHB8DAntksi1VUcnPRTCZpwc76EDliVEcshA NQc= 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:50:21 -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 Subject: [PATCH v6 18/20] block: add __bio_add_folio Date: Tue, 30 May 2023 08:49:21 -0700 Message-Id: <5a142a7663a4beb2966d82f25708a9f22316117c.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: 924E94000E X-Rspam-User: X-Stat-Signature: wjz6tyey4e55smtprntxzjegwg6k4zwp X-Rspamd-Server: rspam03 X-HE-Tag: 1685461825-877352 X-HE-Meta: U2FsdGVkX184HQ+Q/miC47aI+6c40/kkmUH22oa/bHCFi6lIf7HBgjWQ3a/ZcK/Q8oz0QGnUuh8Azs/k8SiB5DOunCJrXiweJF1I3cHY/v8CoX7jqZx6VwmhDtItg/YYPZmuFNaBquV4puMTh6vJT71OEJtvIRfCZ1RpcmH4eWn7QpbOOear430yrbRID4GPhMzpME8em+mEpecJUx/D+DhHAdnBB3jIPgtA2tdrl39Z/YKthcVb0D+MTs5oFtvmqBURk+n50ute6jgqkTtPWoMd6JIphJL/TZnj114d8kLawzzjwY67LFG/ZFEWLwYMbnHIfING8sU4zixEpiYDBLpQXDi+/WDUq75bmY8iySC6/xFrK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ner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn Reviewed-by: Matthew Wilcox (Oracle) --- 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 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);