btrfs: Convert extent_range_redirty_for_io() to use folios
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 9 Feb 2022 20:22:04 +0000 (20:22 +0000)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 15 Mar 2022 12:34:38 +0000 (08:34 -0400)
This removes a call to __set_page_dirty_nobuffers().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Tested-by: Mike Marshall <hubcap@omnibond.com> # orangefs
Tested-by: David Howells <dhowells@redhat.com> # afs
fs/btrfs/extent_io.c

index 9c9952c..3d6dc91 100644 (file)
@@ -1507,17 +1507,17 @@ void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
 
 void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)
 {
+       struct address_space *mapping = inode->i_mapping;
        unsigned long index = start >> PAGE_SHIFT;
        unsigned long end_index = end >> PAGE_SHIFT;
-       struct page *page;
+       struct folio *folio;
 
        while (index <= end_index) {
-               page = find_get_page(inode->i_mapping, index);
-               BUG_ON(!page); /* Pages should be in the extent_io_tree */
-               __set_page_dirty_nobuffers(page);
-               account_page_redirty(page);
-               put_page(page);
-               index++;
+               folio = filemap_get_folio(mapping, index);
+               filemap_dirty_folio(mapping, folio);
+               folio_account_redirty(folio);
+               index += folio_nr_pages(folio);
+               folio_put(folio);
        }
 }