OSDN Git Service

Export __set_page_dirty
authorMatthew Wilcox <mawilcox@microsoft.com>
Wed, 11 Apr 2018 05:39:01 +0000 (22:39 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 11 Apr 2018 05:39:01 +0000 (22:39 -0700)
XFS currently contains a copy-and-paste of __set_page_dirty().  Export
it from buffer.c instead.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/buffer.c
fs/xfs/xfs_aops.c
include/linux/mm.h

index 9a73924..0b487cd 100644 (file)
@@ -594,7 +594,7 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode);
  *
  * The caller must hold lock_page_memcg().
  */
-static void __set_page_dirty(struct page *page, struct address_space *mapping,
+void __set_page_dirty(struct page *page, struct address_space *mapping,
                             int warn)
 {
        unsigned long flags;
@@ -608,6 +608,7 @@ static void __set_page_dirty(struct page *page, struct address_space *mapping,
        }
        spin_unlock_irqrestore(&mapping->tree_lock, flags);
 }
+EXPORT_SYMBOL_GPL(__set_page_dirty);
 
 /*
  * Add a page to the dirty page list.
index 19eadc8..c67683e 100644 (file)
@@ -1472,19 +1472,8 @@ xfs_vm_set_page_dirty(
        newly_dirty = !TestSetPageDirty(page);
        spin_unlock(&mapping->private_lock);
 
-       if (newly_dirty) {
-               /* sigh - __set_page_dirty() is static, so copy it here, too */
-               unsigned long flags;
-
-               spin_lock_irqsave(&mapping->tree_lock, flags);
-               if (page->mapping) {    /* Race with truncate? */
-                       WARN_ON_ONCE(!PageUptodate(page));
-                       account_page_dirtied(page, mapping);
-                       radix_tree_tag_set(&mapping->page_tree,
-                                       page_index(page), PAGECACHE_TAG_DIRTY);
-               }
-               spin_unlock_irqrestore(&mapping->tree_lock, flags);
-       }
+       if (newly_dirty)
+               __set_page_dirty(page, mapping, 1);
        unlock_page_memcg(page);
        if (newly_dirty)
                __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
index ad06d42..47b0fb0 100644 (file)
@@ -1454,6 +1454,7 @@ extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
 extern void do_invalidatepage(struct page *page, unsigned int offset,
                              unsigned int length);
 
+void __set_page_dirty(struct page *, struct address_space *, int warn);
 int __set_page_dirty_nobuffers(struct page *page);
 int __set_page_dirty_no_writeback(struct page *page);
 int redirty_page_for_writepage(struct writeback_control *wbc,