mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA
[linux-2.6-microblaze.git] / mm / page-writeback.c
index 21f4b59..e5b38ff 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.
@@ -2425,7 +2426,8 @@ int __set_page_dirty_no_writeback(struct page *page)
  *
  * NOTE: This relies on being atomic wrt interrupts.
  */
-void account_page_dirtied(struct page *page, struct address_space *mapping)
+static void account_page_dirtied(struct page *page,
+               struct address_space *mapping)
 {
        struct inode *inode = mapping->host;
 
@@ -2466,6 +2468,30 @@ void account_page_cleaned(struct page *page, struct address_space *mapping,
        }
 }
 
+/*
+ * Mark the page dirty, and set it dirty in the page cache, and mark the inode
+ * dirty.
+ *
+ * If warn is true, then emit a warning if the page is not uptodate and has
+ * not been truncated.
+ *
+ * The caller must hold lock_page_memcg().
+ */
+void __set_page_dirty(struct page *page, struct address_space *mapping,
+                            int warn)
+{
+       unsigned long flags;
+
+       xa_lock_irqsave(&mapping->i_pages, flags);
+       if (page->mapping) {    /* Race with truncate? */
+               WARN_ON_ONCE(warn && !PageUptodate(page));
+               account_page_dirtied(page, mapping);
+               __xa_set_mark(&mapping->i_pages, page_index(page),
+                               PAGECACHE_TAG_DIRTY);
+       }
+       xa_unlock_irqrestore(&mapping->i_pages, flags);
+}
+
 /*
  * For address_spaces which do not use buffers.  Just tag the page as dirty in
  * the xarray.
@@ -2483,20 +2509,12 @@ int __set_page_dirty_nobuffers(struct page *page)
        lock_page_memcg(page);
        if (!TestSetPageDirty(page)) {
                struct address_space *mapping = page_mapping(page);
-               unsigned long flags;
 
                if (!mapping) {
                        unlock_page_memcg(page);
                        return 1;
                }
-
-               xa_lock_irqsave(&mapping->i_pages, flags);
-               BUG_ON(page_mapping(page) != mapping);
-               WARN_ON_ONCE(!PagePrivate(page) && !PageUptodate(page));
-               account_page_dirtied(page, mapping);
-               __xa_set_mark(&mapping->i_pages, page_index(page),
-                                  PAGECACHE_TAG_DIRTY);
-               xa_unlock_irqrestore(&mapping->i_pages, flags);
+               __set_page_dirty(page, mapping, !PagePrivate(page));
                unlock_page_memcg(page);
 
                if (mapping->host) {