From patchwork Fri Jul 21 03:44:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321295 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 E4531EB64DD for ; Fri, 21 Jul 2023 03:45:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3AED280189; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6192028018B; Thu, 20 Jul 2023 23:45:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 385C8280188; Thu, 20 Jul 2023 23:45:18 -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 0069128018B for ; Thu, 20 Jul 2023 23:45:17 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D244F80122 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) X-FDA: 81034228674.27.0ED33FB Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf23.hostedemail.com (Postfix) with ESMTP id A3ABE140010 for ; Fri, 21 Jul 2023 03:45:14 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911116; a=rsa-sha256; cv=none; b=5kuqzAxgNiW6qg5wcwgCbArvyfGd/T1Smj+aHkRhK2qVSSGsAMB58kaGoca7g1e0Z3POdD 09cwd7nSStHrat2YUQxeFfuOOpRz+v8YT9GgxTuBR43J/n2m1MwLwuAGFZ+KRx6C/s0cTf UYa9TuKjhwhkfKij3rkTAMbh9VFYiMQ= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf23.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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=1689911116; 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=FgeFbPdO5qaFPqUNuzYEmMA8FmK5SROGel2ntTFAo1jJ9GQ3TlYM0DlgLOgn0KTeznIUzR 4+Im7UOR57n+Hvq4QJokzRpyH5qvv6xMKx7fN/1RyVwdMKMb/jvH+H3yb2HaTuj/aWOzBD JzvrEC1E52athAZkvS05ivwBimZMeLY= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6b4w2MtfzVjnH; Fri, 21 Jul 2023 11:43:44 +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; Fri, 21 Jul 2023 11:45:09 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 03/10] mm/page_io: introduce bio_first_folio_all() Date: Fri, 21 Jul 2023 11:44:44 +0800 Message-ID: <20230721034451.16412-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A3ABE140010 X-Stat-Signature: djxq7cg38y1xcp7q49c496aq9tspdp98 X-Rspam-User: X-HE-Tag: 1689911114-615416 X-HE-Meta: U2FsdGVkX18w/fhFgPsnOHpVSD6xjZkgypSS5K/6o1dunWAYpVvkpAcsDVszJ3ztOpBS7c36Ei+4HwBdEBYNvvGdxWbSrV+nT3MvMZEi5+qOJjulWjg+A+qWDvv9zXC5g9q710E+F03edQgRogvJmq70LUj/dQ5b0Z4b7t8itL2fxJOgL9gzOClGwANbEwuWwhZ+pYGpTc15ioGZnk/zEijASKbCMX8B6ETYNibqXbZzWjAFbLykjYMnsMsu0dpi7Iw9s1fr/psE34gIOqufESD9iDPsciQIcUgx31km1xmNOAQbub+7YEqju7O9g2OvwJxnOBQan+qP5UBJMKL03BuROAu+LMN1nUxPrtvuQOymHhrKbkAM2uROdpOGYVYCGBeN6EcykjgVeByAKoSf02J38byWTKFB7jhfjkfWxRSRLRwMvXs9lnyyWFNBqWXK/dLLdWeiHUPoEYM1sOj1imbhw+etRpDvk0BgLDQm4ljHIgkieHildeI9Gslw9XoqkqcMBvrqEr0+HqHtTaniN+LWMyGfcC9aZQhzbadkyBGXWY14Iea6lO8BkSGaSfTF9hwoSmyl/Ase6Zup2KXS+svaQ8KGUhF5ek4Lbk3mcfVOTrm1Vucme93s0KOhD/oZh1CLoQTOOSBHCuenmjsekYuwvXDtrRMhV0lxh0EZyKvykcXjwiQRixTwnaecc8kzpN1weY3K2T3yx4rCeVKKbCumcvQpaUkE4EN3TIxmW/JfAid9Jnx2YGLcGhEIZLod1+H6Gms3jPvCYBcgmnbZcGVCYMzBRyGdSQafAn8BGRAyCqmGkVqA2W8/Pw92A1mfnD9P9nBSvFk63QY7FRBG9j77m/mptv0Ilhy6GswWR9Oj/D36whgk7ocSWk8VzEWPZelsNk4kOwjjCDgYhvDqZabrnaiYL16K37iHvxtEehP3rKnz/+bPIxbCb2OlISRohCy2V/pJstZeC6M1YAN Gtsm+h9c 72EGX64vfRuAY4jsDprcaQwRa9vvZsUl3fq4dGpQcU8JDTIch8tRffmIY3YSeEdfoqH3akgf0nluwXOFEwghr8BmMZ1z/Bu9GeF5jFzjCdfG+4XLOGu1TBQzBQhxeLJT8rl9TwalN4c50VBUODUoWWznwhRF9ioE5Cmz9MT4AJ6LK/FXEl0G97pNuEWeVyiGEWit74s5q/3RNmXReZrPAN/Pk59aDx8DHVdVFRQvHo3LvWRAtDhYTYEjBIw== 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));