Merge tag 'folio-5.17' of git://git.infradead.org/users/willy/pagecache
[linux-2.6-microblaze.git] / mm / filemap.c
index 33077c2..2fd9b2f 100644 (file)
@@ -634,8 +634,8 @@ static bool mapping_needs_writeback(struct address_space *mapping)
        return mapping->nrpages;
 }
 
-static bool filemap_range_has_writeback(struct address_space *mapping,
-                                       loff_t start_byte, loff_t end_byte)
+bool filemap_range_has_writeback(struct address_space *mapping,
+                                loff_t start_byte, loff_t end_byte)
 {
        XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT);
        pgoff_t max = end_byte >> PAGE_SHIFT;
@@ -655,34 +655,8 @@ static bool filemap_range_has_writeback(struct address_space *mapping,
        }
        rcu_read_unlock();
        return page != NULL;
-
-}
-
-/**
- * filemap_range_needs_writeback - check if range potentially needs writeback
- * @mapping:           address space within which to check
- * @start_byte:        offset in bytes where the range starts
- * @end_byte:          offset in bytes where the range ends (inclusive)
- *
- * Find at least one page in the range supplied, usually used to check if
- * direct writing in this range will trigger a writeback. Used by O_DIRECT
- * read/write with IOCB_NOWAIT, to see if the caller needs to do
- * filemap_write_and_wait_range() before proceeding.
- *
- * Return: %true if the caller should do filemap_write_and_wait_range() before
- * doing O_DIRECT to a page in this range, %false otherwise.
- */
-bool filemap_range_needs_writeback(struct address_space *mapping,
-                                  loff_t start_byte, loff_t end_byte)
-{
-       if (!mapping_needs_writeback(mapping))
-               return false;
-       if (!mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) &&
-           !mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK))
-               return false;
-       return filemap_range_has_writeback(mapping, start_byte, end_byte);
 }
-EXPORT_SYMBOL_GPL(filemap_range_needs_writeback);
+EXPORT_SYMBOL_GPL(filemap_range_has_writeback);
 
 /**
  * filemap_write_and_wait_range - write out & wait on a file range