fs: remove noop_set_page_dirty()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 29 Jun 2021 02:36:27 +0000 (19:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:48 +0000 (10:53 -0700)
Use __set_page_dirty_no_writeback() instead.  This will set the dirty bit
on the page, which will be used to avoid calling set_page_dirty() in the
future.  It will have no effect on actually writing the page back, as the
pages are not on any LRU lists.

[akpm@linux-foundation.org: export __set_page_dirty_no_writeback() to modules]

Link: https://lkml.kernel.org/r/20210615162342.1669332-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/dax/device.c
fs/ext2/inode.c
fs/ext4/inode.c
fs/fuse/dax.c
fs/libfs.c
fs/xfs/xfs_aops.c
include/linux/fs.h
mm/page-writeback.c

index db92573c94e864109680d613e52b194f7774a874..dd8222a42808d64aa465887ab87210f58fe6f6d7 100644 (file)
@@ -337,7 +337,7 @@ static unsigned long dax_get_unmapped_area(struct file *filp,
 }
 
 static const struct address_space_operations dev_dax_aops = {
-       .set_page_dirty         = noop_set_page_dirty,
+       .set_page_dirty         = __set_page_dirty_no_writeback,
        .invalidatepage         = noop_invalidatepage,
 };
 
index bf41f579ed3ed6b1283f5bb2b3b3d7230a0d68ad..dadb121beb227c2f7a8f4c9c507799728afea517 100644 (file)
@@ -992,7 +992,7 @@ const struct address_space_operations ext2_nobh_aops = {
 static const struct address_space_operations ext2_dax_aops = {
        .writepages             = ext2_dax_writepages,
        .direct_IO              = noop_direct_IO,
-       .set_page_dirty         = noop_set_page_dirty,
+       .set_page_dirty         = __set_page_dirty_no_writeback,
        .invalidatepage         = noop_invalidatepage,
 };
 
index fe6045a465993bbf4234580d34080583f3e93e35..b8170a00859056a2849970e5d8774320b031992b 100644 (file)
@@ -3701,7 +3701,7 @@ static const struct address_space_operations ext4_da_aops = {
 static const struct address_space_operations ext4_dax_aops = {
        .writepages             = ext4_dax_writepages,
        .direct_IO              = noop_direct_IO,
-       .set_page_dirty         = noop_set_page_dirty,
+       .set_page_dirty         = __set_page_dirty_no_writeback,
        .bmap                   = ext4_bmap,
        .invalidatepage         = noop_invalidatepage,
        .swap_activate          = ext4_iomap_swap_activate,
index ff99ab2a3c430f685d6574733830fd7be1ec5875..515ad0895345f9bdc5e199f43003573c9b564e3a 100644 (file)
@@ -1329,7 +1329,7 @@ bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi)
 static const struct address_space_operations fuse_dax_file_aops  = {
        .writepages     = fuse_dax_writepages,
        .direct_IO      = noop_direct_IO,
-       .set_page_dirty = noop_set_page_dirty,
+       .set_page_dirty = __set_page_dirty_no_writeback,
        .invalidatepage = noop_invalidatepage,
 };
 
index 3fdd89b156d654101a5cc6dd12f4579944ae4bda..51b4de3b3447fdcb04bb16986685e4c7d35e02c9 100644 (file)
@@ -1171,22 +1171,6 @@ int noop_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 }
 EXPORT_SYMBOL(noop_fsync);
 
-int noop_set_page_dirty(struct page *page)
-{
-       /*
-        * Unlike __set_page_dirty_no_writeback that handles dirty page
-        * tracking in the page object, dax does all dirty tracking in
-        * the inode address_space in response to mkwrite faults. In the
-        * dax case we only need to worry about potentially dirty CPU
-        * caches, not dirty page cache pages to write back.
-        *
-        * This callback is defined to prevent fallback to
-        * __set_page_dirty_buffers() in set_page_dirty().
-        */
-       return 0;
-}
-EXPORT_SYMBOL_GPL(noop_set_page_dirty);
-
 void noop_invalidatepage(struct page *page, unsigned int offset,
                unsigned int length)
 {
index a335d79dcff8e49a1d64d73458470b4b1a94fddd..cb4e0fcf4c76eef6440fc09bb7675eff78be4749 100644 (file)
@@ -575,7 +575,7 @@ const struct address_space_operations xfs_address_space_operations = {
 const struct address_space_operations xfs_dax_aops = {
        .writepages             = xfs_dax_writepages,
        .direct_IO              = noop_direct_IO,
-       .set_page_dirty         = noop_set_page_dirty,
+       .set_page_dirty         = __set_page_dirty_no_writeback,
        .invalidatepage         = noop_invalidatepage,
        .swap_activate          = xfs_iomap_swapfile_activate,
 };
index 86990934542006ee7aaf5a798ad6a5159805af0a..fad6663cd1b01b3008a3ecd263dcfc1cfc078d67 100644 (file)
@@ -3417,7 +3417,6 @@ extern int simple_rename(struct user_namespace *, struct inode *,
 extern void simple_recursive_removal(struct dentry *,
                               void (*callback)(struct dentry *));
 extern int noop_fsync(struct file *, loff_t, loff_t, int);
-extern int noop_set_page_dirty(struct page *page);
 extern void noop_invalidatepage(struct page *page, unsigned int offset,
                unsigned int length);
 extern ssize_t noop_direct_IO(struct kiocb *iocb, struct iov_iter *iter);
index 8bd69dc5379a75b903b0b718441e741cfe4bd373..e5b38ffe9fca5fdf72dbe9a82735c303f94879ee 100644 (file)
@@ -2417,6 +2417,7 @@ int __set_page_dirty_no_writeback(struct page *page)
                return !TestSetPageDirty(page);
        return 0;
 }
+EXPORT_SYMBOL(__set_page_dirty_no_writeback);
 
 /*
  * Helper function for set_page_dirty family.