All callers have a folio, so use it directly.

Signed-off-by: Matthew Wilcox (Oracle) <wi...@infradead.org>
Reviewed-by: Christoph Hellwig <h...@lst.de>
Acked-by: Jeff Layton <jlay...@kernel.org>
---
 mm/filemap.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 8f07e21a8f29..dfdc04130c5b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1121,14 +1121,14 @@ static int wake_page_function(wait_queue_entry_t *wait, 
unsigned mode, int sync,
        return (flags & WQ_FLAG_EXCLUSIVE) != 0;
 }
 
-static void wake_up_page_bit(struct page *page, int bit_nr)
+static void wake_up_folio_bit(struct folio *folio, int bit_nr)
 {
-       wait_queue_head_t *q = page_waitqueue(page);
+       wait_queue_head_t *q = page_waitqueue(&folio->page);
        struct wait_page_key key;
        unsigned long flags;
        wait_queue_entry_t bookmark;
 
-       key.page = page;
+       key.page = &folio->page;
        key.bit_nr = bit_nr;
        key.page_match = 0;
 
@@ -1163,7 +1163,7 @@ static void wake_up_page_bit(struct page *page, int 
bit_nr)
         * page waiters.
         */
        if (!waitqueue_active(q) || !key.page_match) {
-               ClearPageWaiters(page);
+               ClearFolioWaiters(folio);
                /*
                 * It's possible to miss clearing Waiters here, when we woke
                 * our page waiters, but the hashed waitqueue has waiters for
@@ -1179,7 +1179,7 @@ static void wake_up_folio(struct folio *folio, int bit)
 {
        if (!FolioWaiters(folio))
                return;
-       wake_up_page_bit(&folio->page, bit);
+       wake_up_folio_bit(folio, bit);
 }
 
 /*
@@ -1444,7 +1444,7 @@ void unlock_folio(struct folio *folio)
        BUILD_BUG_ON(PG_waiters != 7);
        VM_BUG_ON_FOLIO(!FolioLocked(folio), folio);
        if (clear_bit_unlock_is_negative_byte(PG_locked, folio_flags(folio, 0)))
-               wake_up_page_bit(&folio->page, PG_locked);
+               wake_up_folio_bit(folio, PG_locked);
 }
 EXPORT_SYMBOL(unlock_folio);
 
@@ -1461,11 +1461,12 @@ EXPORT_SYMBOL(unlock_folio);
  */
 void end_page_private_2(struct page *page)
 {
-       page = compound_head(page);
-       VM_BUG_ON_PAGE(!PagePrivate2(page), page);
-       clear_bit_unlock(PG_private_2, &page->flags);
-       wake_up_page_bit(page, PG_private_2);
-       put_page(page);
+       struct folio *folio = page_folio(page);
+
+       VM_BUG_ON_FOLIO(!FolioPrivate2(folio), folio);
+       clear_bit_unlock(PG_private_2, folio_flags(folio, 0));
+       wake_up_folio_bit(folio, PG_private_2);
+       put_folio(folio);
 }
 EXPORT_SYMBOL(end_page_private_2);
 
-- 
2.30.2

Reply via email to