From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: [PATCH 5/7] btrfs: fix dirtied pages accounting on sub-page writes Date: Mon, 28 Nov 2011 21:53:43 +0800 Message-ID: <20111128140513.528601145@intel.com> References: <20111128135338.249672012@intel.com> Cc: Jan Kara , Chris Mason , Wu Fengguang To: Return-path: cc: Peter Zijlstra CC: Christoph Hellwig cc: Andrew Morton Cc: LKML Content-Disposition: inline; filename=btrfs-account-redirty Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 Signed-off-by: Wu Fengguang --- fs/btrfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- linux-next.orig/fs/btrfs/file.c 2011-11-17 20:13:47.000000000 +0800 +++ linux-next/fs/btrfs/file.c 2011-11-17 20:18:51.000000000 +0800 @@ -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])); }