From: Matthew Wilcox (Oracle) Date: Sun, 21 Mar 2021 20:24:31 +0000 (-0400) Subject: mm/filemap: Add folio_next_index() X-Git-Tag: v5.16-rc1~219^2~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f94b18f6653ab6d3aa503213c2e1e79b18f05a30;p=thirdparty%2Flinux.git mm/filemap: Add folio_next_index() 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 Acked-by: Mike Rapoport --- diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index e7b46223239a7..95e83a9e73c72 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.