]> git.hungrycats.org Git - linux/commitdiff
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)
committerZygo Blaxell <zblaxell@waya.furryterror.org>
Sat, 7 Mar 2015 22:02:47 +0000 (17:02 -0500)
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>
(cherry picked from commit 8d38633c3b4093aca7524945f1e9249d7d3a44da)

fs/btrfs/extent_io.c
mm/page-writeback.c

index fb3c3eaeb7fa10faf9ad64c7a24acbd42dfaabc4..a7392f942d0dfc452f6c3b82a2aaef5f9cd8653b 100644 (file)
@@ -1408,8 +1408,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 d4cbb4bd7d1cf30c859f510dc636ef39d9e8f016..b0d09debed4f616cb9413160eb429cdcc4d73950 100644 (file)
@@ -2170,9 +2170,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);