Commit b05f41a1 authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

filemap: convert filemap_range_has_writeback() to use folios

Removes 3 calls to compound_head().

Link: https://lkml.kernel.org/r/20220905214557.868606-1-vishal.moola@gmail.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 710bb68c
...@@ -632,22 +632,23 @@ bool filemap_range_has_writeback(struct address_space *mapping, ...@@ -632,22 +632,23 @@ bool filemap_range_has_writeback(struct address_space *mapping,
{ {
XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT); XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT);
pgoff_t max = end_byte >> PAGE_SHIFT; pgoff_t max = end_byte >> PAGE_SHIFT;
struct page *page; struct folio *folio;
if (end_byte < start_byte) if (end_byte < start_byte)
return false; return false;
rcu_read_lock(); rcu_read_lock();
xas_for_each(&xas, page, max) { xas_for_each(&xas, folio, max) {
if (xas_retry(&xas, page)) if (xas_retry(&xas, folio))
continue; continue;
if (xa_is_value(page)) if (xa_is_value(folio))
continue; continue;
if (PageDirty(page) || PageLocked(page) || PageWriteback(page)) if (folio_test_dirty(folio) || folio_test_locked(folio) ||
folio_test_writeback(folio))
break; break;
} }
rcu_read_unlock(); rcu_read_unlock();
return page != NULL; return folio != NULL;
} }
EXPORT_SYMBOL_GPL(filemap_range_has_writeback); EXPORT_SYMBOL_GPL(filemap_range_has_writeback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment