Message ID | 20210614201435.1379188-15-willy@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Memory folios | expand |
Matthew Wilcox (Oracle) <willy@infradead.org> wrote: > 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>
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 37a4b583abad..c5c7e061c77c 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.