filemap: convert filemap_range_has_writeback() to use folios
authorVishal Moola (Oracle) <vishal.moola@gmail.com>
Mon, 5 Sep 2022 21:45:57 +0000 (14:45 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:02:56 +0000 (14:02 -0700)
Removes 3 calls to compound_head().

Link: https://lkml.kernel.org/r/20220905214557.868606-1-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/filemap.c

index 68bd70fe71d59936c6494118ff62b086bff4589a..aab125d423b8f9c7b5ee500b6d8c4bcfd0234c55 100644 (file)
@@ -632,22 +632,23 @@ bool filemap_range_has_writeback(struct address_space *mapping,
 {
        XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT);
        pgoff_t max = end_byte >> PAGE_SHIFT;
-       struct page *page;
+       struct folio *folio;
 
        if (end_byte < start_byte)
                return false;
 
        rcu_read_lock();
-       xas_for_each(&xas, page, max) {
-               if (xas_retry(&xas, page))
+       xas_for_each(&xas, folio, max) {
+               if (xas_retry(&xas, folio))
                        continue;
-               if (xa_is_value(page))
+               if (xa_is_value(folio))
                        continue;
-               if (PageDirty(page) || PageLocked(page) || PageWriteback(page))
+               if (folio_test_dirty(folio) || folio_test_locked(folio) ||
+                               folio_test_writeback(folio))
                        break;
        }
        rcu_read_unlock();
-       return page != NULL;
+       return folio != NULL;
 }
 EXPORT_SYMBOL_GPL(filemap_range_has_writeback);