Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
filemap: convert filemap_range_has_writeback() to use folios
Browse files Browse the repository at this point in the history
Removes 3 calls to compound_head().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Vishal Moola (Oracle) <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
VMoola authored and akpm00 committed Sep 19, 2022
1 parent 0ec4086 commit 321531a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 321531a

Please sign in to comment.