Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp77821pxv; Wed, 14 Jul 2021 23:14:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnY/wB6Lsyj03Njqwl+cM716EwWkqNR6sWf/mmJYR0nJ6vbTaBFluA6Zour2eDCtd3zK9g X-Received: by 2002:a05:6402:d2:: with SMTP id i18mr4262418edu.17.1626329675636; Wed, 14 Jul 2021 23:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626329675; cv=none; d=google.com; s=arc-20160816; b=c55jcMmtK7RD/nvKCsPqV4eShJO/AIHx3UT8R93bkA4fEQGGSx85YqujJxBO3USxEv GbGyxUeEV4Cz2+nlaEb6+69UmjE2xb/KwbHOSu2dKrN1IwUXH/Pw6uTrENux7gZcryB/ POXt+uNyz43mXobo3TTYj8VchvLJlodwV+Wiggt5+DAqkegwCGMQWSNv7UpchhEudIjm 4Xry+cLMO70eqpVsybHbaOJw0VaY3byfRVq2arEXDBggkcxsnKGY/ptNKcMJr37YwQE0 UE1HIG54ARA+Blcmb6y3U0OTxYrLHl9cRIVw5l0j9B+PHgKoP4q3wjUOtaqHjCK95v1c o2xw== 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 :dkim-signature; bh=vawLqeT0vEJiZnrPwSOeCWDUYdE4eNiMl7PF9VneWmI=; b=lR6zxpbqs31yfIzewtzGcLqQxq59dw9FPCFxQuAsgki5SHhgbbRxn79ij/Zfn0tetC Xx7kINEgycezj1ENLFlfp6+cqIf3DbnL2awk5SKnsJNOFZmcAu/oDFRFeqKSJLcvao8O bsMPRADvOcpcitGE8BO6m1IzT4/Vu7pQ8b+PjsNPzeTOudHS0Fytzq6ZUJDgUdXfPPmE hVifX3p0rnVB+uoi6SPr3FNsmrBiNLeqighOGIrd1MIjBu41driX50b9prW1qNdtcHr0 3ka9sfcghUPOo2Qe48ittsdEXMnP9lkbLjMnP3ek4sERFFwPJXJaV+dZaTescP56ypo0 b5ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="lFD6/ZEM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji15si4199693ejc.676.2021.07.14.23.14.12; Wed, 14 Jul 2021 23:14:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="lFD6/ZEM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234263AbhGODvR (ORCPT + 99 others); Wed, 14 Jul 2021 23:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbhGODvQ (ORCPT ); Wed, 14 Jul 2021 23:51:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27CDEC06175F; Wed, 14 Jul 2021 20:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=vawLqeT0vEJiZnrPwSOeCWDUYdE4eNiMl7PF9VneWmI=; b=lFD6/ZEMiG55WeBetP3ildreex LGp8SFEBHJvf4vE/sj5ouHiYz/dUbPjMZDW5DEd7XEUdeqb+7uvQYu4EiYA9yfUs+kgjK8jikOUG6 0Pe/jY5T6io6BuqUJD0DZdTsMtkrZsYHlvWQCqHwFLRqZJQnH5zAiajP5s+nN6roM0FvNg4Ad1DQh q+0yAcYzxMIR/Qy3nQZTyijlF8hVFUeEVbFXzRLID6mInBFz6dpjhAlYmJ8m0KL5X5NgTQz4P6q4a DeoS7v1w86CgXvQoQTV7zneGL3Iq4wL5MlRBs5wlfnu0Mpc+FyA3pVZXHm1KYD+RrTia2XGLpXqT/ ql7HAUWw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3sKv-002uqF-Mr; Thu, 15 Jul 2021 03:47:23 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Jeff Layton , "Kirill A . Shutemov" , Vlastimil Babka , William Kucharski , David Howells Subject: [PATCH v14 014/138] mm/filemap: Add folio_next_index() Date: Thu, 15 Jul 2021 04:35:00 +0100 Message-Id: <20210715033704.692967-15-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This helper returns the page index of the next folio in the file (ie the end of this folio, plus one). No changes to generated code. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton Acked-by: Kirill A. Shutemov Acked-by: Vlastimil Babka Reviewed-by: William Kucharski Reviewed-by: David Howells --- include/linux/pagemap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index f7c165b5991f..bd0e7e91bfd4 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -406,6 +406,17 @@ static inline pgoff_t folio_index(struct folio *folio) return folio->index; } +/** + * folio_next_index - Get the index of the next folio. + * @folio: The current folio. + * + * Return: The index of the folio which follows this folio in the file. + */ +static inline pgoff_t folio_next_index(struct folio *folio) +{ + return folio->index + folio_nr_pages(folio); +} + /** * folio_file_page - The page for a particular index. * @folio: The folio which contains this index. -- 2.30.2