From patchwork Thu Jul 20 13:01:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13320493 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 00B82EB64DC for ; Thu, 20 Jul 2023 13:02:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BDEB280102; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 845CD28004C; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E6C8280102; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5D3F828004C for ; Thu, 20 Jul 2023 09:02:54 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 2DB48160206 for ; Thu, 20 Jul 2023 13:02:54 +0000 (UTC) X-FDA: 81032005068.23.FDD8465 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf14.hostedemail.com (Postfix) with ESMTP id D9B71100209 for ; Thu, 20 Jul 2023 13:02:22 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689858145; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Y1QTHugPEXYbpmyf3lw/Ri5X8PoHToRc+NjX/L8NgQ=; b=Larkof9nbLscmvoTQ0tjAEFGPcQAWal5x6XwrPzVxlnwayx06tm+urt8Zd/jhRBNNE4C/M qWUin42FgvgczpaWLhwSnBaH4gLdegmwppoPSwZ89lBNTaKxq741dlJwroXpIGmlpNIoIF V98ALppJn/OqX+wwQl+0/V1mWFYrL2c= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858145; a=rsa-sha256; cv=none; b=0Qin38xRYZcpuSIhBQIAWp46gauywbeL+lfH81j0gYxCHblml+lpBJ9dHOCeDNZESy2JHr 512ny0kmOZXM4coDHJHXnTHb7edqOFdnRNQcBQwvsUXd8RnICNwG11n8rHe2CgiBTlzrWQ IbUrG+jcMN6I/UzPKCXAgzTh1VMgFo8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R6CT02qTZzLntD; Thu, 20 Jul 2023 20:59:48 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 20 Jul 2023 21:02:16 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 03/10] mm/page_io: introduce bio_first_folio_all() Date: Thu, 20 Jul 2023 21:01:40 +0800 Message-ID: <20230720130147.4071649-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D9B71100209 X-Stat-Signature: 4dwa9o594o37yhqqd1nnrugoby13d61y X-Rspam-User: X-HE-Tag: 1689858142-923931 X-HE-Meta: U2FsdGVkX1+Y42qKkRujDu0DYkYn3x17sHU+qvZvvUzny7dhYXjDug33I0Vsuy6kwdFtMLQJfJ0WHfMIaBZE3JVNVm/0caXNr2WG7Qu5Za/MtA4oQux3ugGzwHw1j0we5ecENzh6+RkzazwSEuIR3dR1FcuZWHiBQZhRIrLydiuSDuLU27ETp9d+W6CBW5Ierkyl8sy7/XGVpuUCT3WlALVtHsERxu+zUvj0L2AughqvPwtxwkUjNqq+UPzDvXx7iHvT+Y/w60Z1IxuJ5utNu0EV8qP1/1hMGfjHlJ2pr7r12oCigxkj7PPNAH9Fsl3TCHMXySmSpbQlOcC6RTlq57USXWIdcTGaf98/cwXihF6qTazuhv5EK1y7D02Yu87LnysTKxPBghcE3kwC4LeKJGAi0BzbAfD3X6YALFkzc8asCKx9X0natmd9NUpPuILxxQZTMGZ1OzRohOtPchNA7mTRu8OehhfKaAAsICoCOAqI9LYNS8YYTLaD1vFdauTIgkGKIdYyZJrPycMA3rokGV/9+OhHF2pAAgh7TdLFZR/4QE5S7KIdLBV4xKBNbmxz2axFiu1cAH4wkwKlxsJ6kaUMkb+T67YquO9jPV88tPUBU6oiu34KvvmT9Ro0hQ3GcUXgeePzDAk3qdHEgk0gvoANMSrP770LrxmPYnmzAcCuDik5FiBsa6vp6K3Jui6UMFD2vQAjHBwuG+hQDUSb8bPpT31bbeI6iEMMa8yeWOdL6EYTaOHK056h6+GPMOdrMOoHlRgag3nm7CB82Z8qGv4L5PTD77fr/gMiI1jCUSDnpTyE7D18C2E41MOV1N4GKxw/igt0m/FngrNzBwH2BaI4/nI6nHpz7XVHb3jYHhD/UzlBmqC6gYxIS/iC9pWGxoGentM933QpUkELor5IHYIDF5GeE1Z/7ZVAzFqxsb8zO5p8b/R+3rQwCnk26Olyajz3ChpGJ3kVY2eoXvZ 5HiDGWrA gli3dEftqpyclrzFuNtpkF8JRPFwCmWhoVGAawCsOKcecoQ0HKAEeaIuaTQPw5VZgPTQR//0Mx+DRmH3+2j6EqO6s4H3EVx9g9ym0oxioVaWuXo6BTdVSe7ODTH/pxeDPZyc1WfWchhEV7BncTjro1qcsi6V7l9RJAVn+xBdZIfyXp+vhP3oouUMypbxcAHxxFqJul+MOZxEazx0g/M3z3q3QgTWOHMCMBkANZxERCGIppJW93cFgf/St9c1xL8w92D+I 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: ZhangPeng Introduce bio_first_folio_all() to return a folio, which makes it easier to use. Suggested-by: Matthew Wilcox (Oracle) Signed-off-by: ZhangPeng --- Documentation/block/biovecs.rst | 1 + include/linux/bio.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Documentation/block/biovecs.rst b/Documentation/block/biovecs.rst index ddb867e0185b..b9dc0c9dbee4 100644 --- a/Documentation/block/biovecs.rst +++ b/Documentation/block/biovecs.rst @@ -134,6 +134,7 @@ Usage of helpers: bio_for_each_bvec_all() bio_first_bvec_all() bio_first_page_all() + bio_first_folio_all() bio_last_bvec_all() * The following helpers iterate over single-page segment. The passed 'struct diff --git a/include/linux/bio.h b/include/linux/bio.h index c4f5b5228105..027ff9ab5d12 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -253,6 +253,11 @@ static inline struct page *bio_first_page_all(struct bio *bio) return bio_first_bvec_all(bio)->bv_page; } +static inline struct folio *bio_first_folio_all(struct bio *bio) +{ + return page_folio(bio_first_page_all(bio)); +} + static inline struct bio_vec *bio_last_bvec_all(struct bio *bio) { WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED));