page_writeback: put account_page_redirty() after set_page_dirty()
authorKonstantin Khebnikov <khlebnikov@yandex-team.ru>
Wed, 11 Feb 2015 23:26:55 +0000 (15:26 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Feb 2015 01:06:04 +0000 (17:06 -0800)
Helper account_page_redirty() fixes dirty pages counter for redirtied
pages.  This patch puts it after dirtying and prevents temporary
underflows of dirtied pages counters on zone/bdi and current->nr_dirtied.

Signed-off-by: Konstantin Khebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/btrfs/extent_io.c
mm/page-writeback.c

index 790dbae3343c4f965eaa58e317c08d702ad0a7ff..c73df6a7c9b6ce0b8ee9beec01f4f0fe48ba5705 100644 (file)
@@ -1407,8 +1407,8 @@ int extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)
        while (index <= end_index) {
                page = find_get_page(inode->i_mapping, index);
                BUG_ON(!page); /* Pages should be in the extent_io_tree */
-               account_page_redirty(page);
                __set_page_dirty_nobuffers(page);
+               account_page_redirty(page);
                page_cache_release(page);
                index++;
        }
index fb71e9deca856903def056230fa46f687f207a3f..6a73e47e81c67fa86838941e6a16b27a956d77e7 100644 (file)
@@ -2168,9 +2168,12 @@ EXPORT_SYMBOL(account_page_redirty);
  */
 int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page)
 {
+       int ret;
+
        wbc->pages_skipped++;
+       ret = __set_page_dirty_nobuffers(page);
        account_page_redirty(page);
-       return __set_page_dirty_nobuffers(page);
+       return ret;
 }
 EXPORT_SYMBOL(redirty_page_for_writepage);