Skip to content

Commit

Permalink
fs: Remove noop_set_page_dirty()
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
  • Loading branch information
Matthew Wilcox (Oracle) authored and intel-lab-lkp committed Jun 16, 2021
1 parent 874149c commit 9367b70
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 22 deletions.
2 changes: 1 addition & 1 deletion drivers/dax/device.c
Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion fs/ext2/inode.c
Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/inode.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion fs/fuse/dax.c
Expand Up @@ -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,
};

Expand Down
16 changes: 0 additions & 16 deletions fs/libfs.c
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_aops.c
Expand Up @@ -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,
};
1 change: 0 additions & 1 deletion include/linux/fs.h
Expand Up @@ -3421,7 +3421,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);
Expand Down

0 comments on commit 9367b70

Please sign in to comment.