diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-03-21 21:24:31 +0100 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-09-27 15:27:30 +0200 |
commit | f94b18f6653ab6d3aa503213c2e1e79b18f05a30 (patch) | |
tree | e9615892e789b4b6ad272e3d278c2f48bbb15d49 /include | |
parent | mm/filemap: Add folio_index(), folio_file_page() and folio_contains() (diff) | |
download | linux-f94b18f6653ab6d3aa503213c2e1e79b18f05a30.tar.xz linux-f94b18f6653ab6d3aa503213c2e1e79b18f05a30.zip |
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) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pagemap.h | 11 |
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. |