Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10387282rwp; Thu, 20 Jul 2023 20:59:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlECDx+44W5NQ3Gj6Qp0CBTwcRN24RONpWwS9OwlwoqPggDDbj7f3VnRTtfXv9wOtATG4hnd X-Received: by 2002:a9d:4b0f:0:b0:6b8:dcd2:8b9e with SMTP id q15-20020a9d4b0f000000b006b8dcd28b9emr991231otf.7.1689911947830; Thu, 20 Jul 2023 20:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689911947; cv=none; d=google.com; s=arc-20160816; b=1CWwk+KYB68hyb3xUCctV/lPvhq8RRFBdtY+n/meCN1kzv6tMYU7sw4oNRaufcJBhe QWsr0v+tbrA7ZMo1Ag3z8dZw6zQMrL1yhYV1Pdz6apIp5rDP8RtL2mgPw/afpl1tqLoJ OzMzJFeZqTyBbZEA+MzpnUJL1HQzwdyhauBgQXSftYc4Hrs6/zyyqKVcIAImF1JmZjjn lRtmTUs9nBNPfVvlBFAd1L+Z/axuaFG4IW5/TbhRkr9SnO5S/axMPBq67hERcq645vaQ VCDZPq0njHpEh7hN4wxqpHq2mzmW1ihdU2jgN+c6MCzNtsB+kDG4dLYp504qFj/iFG02 7BYA== 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=zzDBAjgTvtOd9u40rcr4ucfHfeVMNQjcFeInEjoOsdfPcbNRuWyUe8Uk2aqvyCnFqa QCDVcrFu8J5ZFObia3DmYQTtNAdJb//9EX+wRycyHMxqQJniyTsbWq7wyptSNKmYSwff 7pxQQSAgqE0wKGHkhH92cTZH8jy19sdWUewSnyCta+4bDeSKjoj39wGlOW4iNrZcstOj FlbtdQgxs0oK4KdgtFpXoEl1aTIZSnMv/9s0GasWEfzxwAwCeZpFq2nOOxyzLVFch2uT VDkQNtTkcio+Qi+F/8+h12ddl3wIQ1NNbU54kV7ctltE9jHIXcAcspbglOmEmwCqkMb9 Dd6A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a63de57000000b0053074c54c3fsi2053446pgi.868.2023.07.20.20.58.55; Thu, 20 Jul 2023 20:59:07 -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 S230140AbjGUDpV (ORCPT + 99 others); Thu, 20 Jul 2023 23:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjGUDpN (ORCPT ); Thu, 20 Jul 2023 23:45:13 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FFB6272E for ; Thu, 20 Jul 2023 20:45:12 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 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)); -- 2.25.1