Merge tag 'folio-5.18b' of git://git.infradead.org/users/willy/pagecache
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2022 01:26:56 +0000 (18:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2022 01:26:56 +0000 (18:26 -0700)
Pull filesystem folio updates from Matthew Wilcox:
 "Primarily this series converts some of the address_space operations to
  take a folio instead of a page.

  Notably:

   - a_ops->is_partially_uptodate() takes a folio instead of a page and
     changes the type of the 'from' and 'count' arguments to make it
     obvious they're bytes.

   - a_ops->invalidatepage() becomes ->invalidate_folio() and has a
     similar type change.

   - a_ops->launder_page() becomes ->launder_folio()

   - a_ops->set_page_dirty() becomes ->dirty_folio() and adds the
     address_space as an argument.

  There are a couple of other misc changes up front that weren't worth
  separating into their own pull request"

* tag 'folio-5.18b' of git://git.infradead.org/users/willy/pagecache: (53 commits)
  fs: Remove aops ->set_page_dirty
  fb_defio: Use noop_dirty_folio()
  fs: Convert __set_page_dirty_no_writeback to noop_dirty_folio
  fs: Convert __set_page_dirty_buffers to block_dirty_folio
  nilfs: Convert nilfs_set_page_dirty() to nilfs_dirty_folio()
  mm: Convert swap_set_page_dirty() to swap_dirty_folio()
  ubifs: Convert ubifs_set_page_dirty to ubifs_dirty_folio
  f2fs: Convert f2fs_set_node_page_dirty to f2fs_dirty_node_folio
  f2fs: Convert f2fs_set_data_page_dirty to f2fs_dirty_data_folio
  f2fs: Convert f2fs_set_meta_page_dirty to f2fs_dirty_meta_folio
  afs: Convert afs_dir_set_page_dirty() to afs_dir_dirty_folio()
  btrfs: Convert extent_range_redirty_for_io() to use folios
  fs: Convert trivial uses of __set_page_dirty_nobuffers to filemap_dirty_folio
  btrfs: Convert from set_page_dirty to dirty_folio
  fscache: Convert fscache_set_page_dirty() to fscache_dirty_folio()
  fs: Add aops->dirty_folio
  fs: Remove aops->launder_page
  orangefs: Convert launder_page to launder_folio
  nfs: Convert from launder_page to launder_folio
  fuse: Convert from launder_page to launder_folio
  ...

46 files changed:
1  2 
Documentation/filesystems/locking.rst
Documentation/filesystems/vfs.rst
block/fops.c
fs/afs/write.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/inode.c
fs/buffer.c
fs/ceph/addr.c
fs/cifs/file.c
fs/erofs/super.c
fs/ext4/inode.c
fs/f2fs/checkpoint.c
fs/f2fs/compress.c
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/node.c
fs/fat/inode.c
fs/fuse/file.c
fs/gfs2/meta_io.c
fs/hostfs/hostfs_kern.c
fs/hugetlbfs/inode.c
fs/iomap/buffered-io.c
fs/jbd2/transaction.c
fs/jfs/jfs_metapage.c
fs/minix/inode.c
fs/mpage.c
fs/nfs/write.c
fs/ocfs2/aops.c
fs/remap_range.c
fs/zonefs/super.c
include/linux/fs.h
include/linux/jbd2.h
include/linux/mm.h
include/linux/pagemap.h
include/linux/swap.h
include/trace/events/ext4.h
mm/filemap.c
mm/page-writeback.c
mm/page_io.c
mm/readahead.c
mm/rmap.c
mm/shmem.c
mm/swap_state.c
mm/truncate.c

Simple merge
Simple merge
diff --cc block/fops.c
Simple merge
diff --cc fs/afs/write.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/buffer.c
Simple merge
diff --cc fs/ceph/addr.c
Simple merge
diff --cc fs/cifs/file.c
Simple merge
@@@ -532,24 -535,18 +532,23 @@@ static int erofs_managed_cache_releasep
        return ret;
  }
  
- static void erofs_managed_cache_invalidatepage(struct page *page,
-                                              unsigned int offset,
-                                              unsigned int length)
 +/*
 + * It will be called only on inode eviction. In case that there are still some
 + * decompression requests in progress, wait with rescheduling for a bit here.
 + * We could introduce an extra locking instead but it seems unnecessary.
 + */
+ static void erofs_managed_cache_invalidate_folio(struct folio *folio,
+                                              size_t offset, size_t length)
  {
-       const unsigned int stop = length + offset;
+       const size_t stop = length + offset;
  
-       DBG_BUGON(!PageLocked(page));
+       DBG_BUGON(!folio_test_locked(folio));
  
        /* Check for potential overflow in debug mode */
-       DBG_BUGON(stop > PAGE_SIZE || stop < length);
+       DBG_BUGON(stop > folio_size(folio) || stop < length);
  
-       if (offset == 0 && stop == PAGE_SIZE)
-               while (!erofs_managed_cache_releasepage(page, GFP_NOFS))
+       if (offset == 0 && stop == folio_size(folio))
+               while (!erofs_managed_cache_releasepage(&folio->page, GFP_NOFS))
                        cond_resched();
  }
  
diff --cc fs/ext4/inode.c
@@@ -3573,31 -3541,30 +3573,32 @@@ const struct iomap_ops ext4_iomap_repor
  };
  
  /*
-  * Whenever the page is being dirtied, corresponding buffers should already be
-  * attached to the transaction (we take care of this in ext4_page_mkwrite() and
-  * ext4_write_begin()). However we cannot move buffers to dirty transaction
-  * lists here because ->set_page_dirty is called under VFS locks and the page
 - * Folios can be marked dirty completely asynchronously from ext4's
 - * journalling activity.  By filemap_sync_pte(), try_to_unmap_one(), etc.
 - * We cannot do much here because ->dirty_folio may be called with the
 - * page table lock held.  The folio is not necessarily locked.
++ * Whenever the folio is being dirtied, corresponding buffers should already
++ * be attached to the transaction (we take care of this in ext4_page_mkwrite()
++ * and ext4_write_begin()). However we cannot move buffers to dirty transaction
++ * lists here because ->dirty_folio is called under VFS locks and the folio
 + * is not necessarily locked.
   *
-  * We cannot just dirty the page and leave attached buffers clean, because the
+  * We cannot just dirty the folio and leave attached buffers clean, because the
   * buffers' dirty state is "definitive".  We cannot just set the buffers dirty
   * or jbddirty because all the journalling code will explode.
   *
-  * So what we do is to mark the page "pending dirty" and next time writepage
+  * So what we do is to mark the folio "pending dirty" and next time writepage
   * is called, propagate that into the buffers appropriately.
   */
- static int ext4_journalled_set_page_dirty(struct page *page)
+ static bool ext4_journalled_dirty_folio(struct address_space *mapping,
+               struct folio *folio)
  {
-       WARN_ON_ONCE(!page_has_buffers(page));
-       SetPageChecked(page);
-       return __set_page_dirty_nobuffers(page);
++      WARN_ON_ONCE(!page_has_buffers(&folio->page));
+       folio_set_checked(folio);
+       return filemap_dirty_folio(mapping, folio);
  }
  
- static int ext4_set_page_dirty(struct page *page)
+ static bool ext4_dirty_folio(struct address_space *mapping, struct folio *folio)
  {
-       WARN_ON_ONCE(!PageLocked(page) && !PageDirty(page));
-       WARN_ON_ONCE(!page_has_buffers(page));
-       return __set_page_dirty_buffers(page);
+       WARN_ON_ONCE(!folio_test_locked(folio) && !folio_test_dirty(folio));
+       WARN_ON_ONCE(!folio_buffers(folio));
+       return block_dirty_folio(mapping, folio);
  }
  
  static int ext4_iomap_swap_activate(struct swap_info_struct *sis,
Simple merge
Simple merge
diff --cc fs/f2fs/data.c
Simple merge
diff --cc fs/f2fs/f2fs.h
Simple merge
diff --cc fs/f2fs/node.c
Simple merge
diff --cc fs/fat/inode.c
Simple merge
diff --cc fs/fuse/file.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/mpage.c
Simple merge
diff --cc fs/nfs/write.c
Simple merge
diff --cc fs/ocfs2/aops.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc mm/filemap.c
Simple merge
Simple merge
diff --cc mm/page_io.c
Simple merge
diff --cc mm/readahead.c
Simple merge
diff --cc mm/rmap.c
Simple merge
diff --cc mm/shmem.c
Simple merge
diff --cc mm/swap_state.c
Simple merge
diff --cc mm/truncate.c
Simple merge