packagegroup-opendreambox-essential: move to meta-opendreambox
[opendreambox.git] / meta-bsp / common / recipes / linux / linux-dreambox-3.2 / 0007-mtd-block2mtd-throttle-writes-by-calling-balance_dir.patch
1 From 90ae25dd7c5787868bfd92dc9c059d86c6755ec2 Mon Sep 17 00:00:00 2001
2 From: NeilBrown <neilb@suse.de>
3 Date: Wed, 12 Dec 2012 19:32:15 +1100
4 Subject: [PATCH 07/17] mtd: block2mtd: throttle writes by calling
5  balance_dirty_pages_ratelimited.
6
7 If you create a block2mtd device that is larger than main memory,
8 and write to all of it, then lots of pages will be dirtied but
9 they will never be flushed out as nothing calls any variant of
10 balance_dirty_pages.
11
12 It would be nice to call set_page_dirty_balance(), but that isn't exported,
13 so just call balance_dirty_pages_ratelimited() directly.
14
15 Signed-off-by: NeilBrown <neilb@suse.de>
16 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
17 ---
18  drivers/mtd/devices/block2mtd.c | 2 ++
19  1 file changed, 2 insertions(+)
20
21 diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
22 index 67d8b49..e902944 100644
23 --- a/drivers/mtd/devices/block2mtd.c
24 +++ b/drivers/mtd/devices/block2mtd.c
25 @@ -66,6 +66,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
26                                 memset(page_address(page), 0xff, PAGE_SIZE);
27                                 set_page_dirty(page);
28                                 unlock_page(page);
29 +                               balance_dirty_pages_ratelimited(mapping);
30                                 break;
31                         }
32  
33 @@ -170,6 +171,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
34                         memcpy(page_address(page) + offset, buf, cpylen);
35                         set_page_dirty(page);
36                         unlock_page(page);
37 +                       balance_dirty_pages_ratelimited(mapping);
38                 }
39                 page_cache_release(page);
40  
41 -- 
42 1.8.1.2
43