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: "zhangpeng (AS)" X-Patchwork-Id: 123283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3119869vqt; Thu, 20 Jul 2023 06:30:45 -0700 (PDT) X-Google-Smtp-Source: APBJJlG4nG/21BNPaNU6coh/RkS3sDmfg4nEOMHbwmaXYBRMMVlXjW8ugPyK+CiUyDvcnDjXQy/g X-Received: by 2002:a05:6a00:15c6:b0:66c:6766:7373 with SMTP id o6-20020a056a0015c600b0066c67667373mr26078928pfu.23.1689859845288; Thu, 20 Jul 2023 06:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689859845; cv=none; d=google.com; s=arc-20160816; b=kdQV185/1BIATCl7CL2nBIuXoYWHoBKoancIQ3kQl7Rl9G8qnHZ7e3pk0RlCxC53lv Jovw0mpyaesbcbEh4ljqcO/iVKgM53bO2iIa9P32ZZKM15FyS3MN/J0c/UU2fPezRrqM K5zIdJtpXFzZoonfvJNGiynhRTeUoM2Tk5TrQ2QW5FjmHnD23kvhSWl8ZS1JH+ACNuzQ ZhZD1htWdxVkYxvc+MLxUlnDJddBAu6BosWPdHDTroRwvk3xPH46c3HcyM9WeX4+yHTI 5hHHDxxEQm4aOiLryvL6EZATWZgOiXXH12VyNAuvO1s1KZnPNN+guZH6sDfXjr+foMf2 TinA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8Y1QTHugPEXYbpmyf3lw/Ri5X8PoHToRc+NjX/L8NgQ=; fh=q8rOnvZaN5Z50YvgZS1uBArX5ZcEEwPcusRFazgmNUQ=; b=wOwrUOA/vGIhngnk+YJXbHl+3ecLC13UI38oSRS/Q7c4XZmHhEFvJBDOklSuT14yxU 4zNiH/SSCC1PD0pLO4m5IwDOddowDlPYWtiL0IqVrHC8RewK+toj6RerBVQx27fd3Aeh yGuEObEg7gPs96V3/WYoqDVW68y93vBZC0INfrDmmLn3SE2o4aJFUFFI/BbTgARzZjqy jyTb9w6Z9dK0BB7bo5WjdIQZO40dVBz4iGQP6z8GDoicDbOIbdFWXHcD1IL5DoQZIN0A y7E5mnNZWM9rhLbl/9e2Bexw8kJElhE45TIwLNgcGbxWDRsjvBRqP0MAF4iGtM2IfC55 whkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a056a00248f00b006834175c797si1003575pfv.330.2023.07.20.06.30.31; Thu, 20 Jul 2023 06:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjGTNCV (ORCPT + 99 others); Thu, 20 Jul 2023 09:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229781AbjGTNCU (ORCPT ); Thu, 20 Jul 2023 09:02:20 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699C910D2 for ; Thu, 20 Jul 2023 06:02:19 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771946477029004431 X-GMAIL-MSGID: 1771946477029004431 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));