]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
btrfs: fix dirtied pages accounting on sub-page writes
authorWu Fengguang <fengguang.wu@intel.com>
Mon, 8 Aug 2011 21:19:47 +0000 (15:19 -0600)
committerWu Fengguang <fengguang.wu@intel.com>
Mon, 5 Dec 2011 06:06:31 +0000 (14:06 +0800)
When doing 1KB sequential writes to the same page,
balance_dirty_pages_ratelimited_nr() should be called once instead of 4
times, the latter makes the dirtier tasks be throttled much too heavy.

Fix it with proper de-accounting on clear_page_dirty_for_io().

CC: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
fs/btrfs/file.c

index dafdfa059bf66a489bd3d858990b9025fd50a72f..5da5b669e5def10fbe328e203bafe3960ac2a8f4 100644 (file)
@@ -1136,7 +1136,8 @@ again:
                                     GFP_NOFS);
        }
        for (i = 0; i < num_pages; i++) {
-               clear_page_dirty_for_io(pages[i]);
+               if (clear_page_dirty_for_io(pages[i]))
+                       account_page_redirty(pages[i]);
                set_page_extent_mapped(pages[i]);
                WARN_ON(!PageLocked(pages[i]));
        }