aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <[email protected]>2021-03-21 16:24:31 -0400
committerMatthew Wilcox (Oracle) <[email protected]>2021-09-27 09:27:30 -0400
commitf94b18f6653ab6d3aa503213c2e1e79b18f05a30 (patch)
treee9615892e789b4b6ad272e3d278c2f48bbb15d49
parent9257e15677384d1ccdfe0619c4455e34cb0342c7 (diff)
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) <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Jeff Layton <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Reviewed-by: William Kucharski <[email protected]> Reviewed-by: David Howells <[email protected]> Acked-by: Mike Rapoport <[email protected]>
-rw-r--r--include/linux/pagemap.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e7b46223239a..95e83a9e73c7 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -407,6 +407,17 @@ static inline pgoff_t folio_index(struct folio *folio)
}
/**
+ * 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.
* @index: The index we want to look up.