mirror of https://gitee.com/openkylin/linux.git
iomap: use __set_page_dirty_nobuffers
The only difference between iomap_set_page_dirty() and __set_page_dirty_nobuffers() is that the latter includes a debugging check that a !Uptodate page has private data. Link: https://lkml.kernel.org/r/20210615162342.1669332-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> 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>
This commit is contained in:
parent
2f18be363c
commit
fd7353f88b
|
@ -784,7 +784,7 @@ static const struct address_space_operations gfs2_aops = {
|
|||
.writepages = gfs2_writepages,
|
||||
.readpage = gfs2_readpage,
|
||||
.readahead = gfs2_readahead,
|
||||
.set_page_dirty = iomap_set_page_dirty,
|
||||
.set_page_dirty = __set_page_dirty_nobuffers,
|
||||
.releasepage = iomap_releasepage,
|
||||
.invalidatepage = iomap_invalidatepage,
|
||||
.bmap = gfs2_bmap,
|
||||
|
|
|
@ -640,31 +640,6 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
|
|||
return status;
|
||||
}
|
||||
|
||||
int
|
||||
iomap_set_page_dirty(struct page *page)
|
||||
{
|
||||
struct address_space *mapping = page_mapping(page);
|
||||
int newly_dirty;
|
||||
|
||||
if (unlikely(!mapping))
|
||||
return !TestSetPageDirty(page);
|
||||
|
||||
/*
|
||||
* Lock out page's memcg migration to keep PageDirty
|
||||
* synchronized with per-memcg dirty page counters.
|
||||
*/
|
||||
lock_page_memcg(page);
|
||||
newly_dirty = !TestSetPageDirty(page);
|
||||
if (newly_dirty)
|
||||
__set_page_dirty(page, mapping, 0);
|
||||
unlock_page_memcg(page);
|
||||
|
||||
if (newly_dirty)
|
||||
__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
|
||||
return newly_dirty;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iomap_set_page_dirty);
|
||||
|
||||
static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
|
||||
size_t copied, struct page *page)
|
||||
{
|
||||
|
@ -684,7 +659,7 @@ static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
|
|||
if (unlikely(copied < len && !PageUptodate(page)))
|
||||
return 0;
|
||||
iomap_set_range_uptodate(page, offset_in_page(pos), len);
|
||||
iomap_set_page_dirty(page);
|
||||
__set_page_dirty_nobuffers(page);
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ const struct address_space_operations xfs_address_space_operations = {
|
|||
.readahead = xfs_vm_readahead,
|
||||
.writepage = xfs_vm_writepage,
|
||||
.writepages = xfs_vm_writepages,
|
||||
.set_page_dirty = iomap_set_page_dirty,
|
||||
.set_page_dirty = __set_page_dirty_nobuffers,
|
||||
.releasepage = iomap_releasepage,
|
||||
.invalidatepage = iomap_invalidatepage,
|
||||
.bmap = xfs_vm_bmap,
|
||||
|
|
|
@ -185,7 +185,7 @@ static const struct address_space_operations zonefs_file_aops = {
|
|||
.readahead = zonefs_readahead,
|
||||
.writepage = zonefs_writepage,
|
||||
.writepages = zonefs_writepages,
|
||||
.set_page_dirty = iomap_set_page_dirty,
|
||||
.set_page_dirty = __set_page_dirty_nobuffers,
|
||||
.releasepage = iomap_releasepage,
|
||||
.invalidatepage = iomap_invalidatepage,
|
||||
.migratepage = iomap_migrate_page,
|
||||
|
|
|
@ -159,7 +159,6 @@ ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
|
|||
const struct iomap_ops *ops);
|
||||
int iomap_readpage(struct page *page, const struct iomap_ops *ops);
|
||||
void iomap_readahead(struct readahead_control *, const struct iomap_ops *ops);
|
||||
int iomap_set_page_dirty(struct page *page);
|
||||
int iomap_is_partially_uptodate(struct page *page, unsigned long from,
|
||||
unsigned long count);
|
||||
int iomap_releasepage(struct page *page, gfp_t gfp_mask);
|
||||
|
|
Loading…
Reference in New Issue