@@ -2115,7 +2115,7 @@ static inline int thp_nr_pages(struct page *page)
*/
static inline struct folio *folio_next(struct folio *folio)
{
- return (struct folio *)folio_page(folio, folio_nr_pages(folio));
+ return (struct folio *)nth_page(&folio->page, folio_nr_pages(folio));
}
/**
@@ -275,7 +275,7 @@ static __always_inline unsigned long _compound_head(const struct page *page)
* check that the page number lies within @folio; the caller is presumed
* to have a reference to the page.
*/
-#define folio_page(folio, n) nth_page(&(folio)->page, n)
+#define folio_page(folio, n) (&(folio)->page + (n))
static __always_inline int PageTail(const struct page *page)
{
Discontiguous memory may require the use of nth_page instead of adding to struct page arithmetically. However, discontiguous memory cannot exist within a single folio. The function folio_page is mostly used for accessing a page within a folio, therefore using nth_page for it is overkill. Move it to the only place where it's needed, which is folio_next. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>