aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-12-12 03:32:15 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-12-13 06:39:44 -0500
commit031da73fca29ebba3eea5a512746e01d52e542cd (patch)
tree450de5893032902a23a09a7373e24e51cb8297ae /drivers/mtd
parent6f2a6a52560ad8d85710aabd92b7a3239b3a6b07 (diff)
mtd: block2mtd: throttle writes by calling balance_dirty_pages_ratelimited.
If you create a block2mtd device that is larger than main memory, and write to all of it, then lots of pages will be dirtied but they will never be flushed out as nothing calls any variant of balance_dirty_pages. It would be nice to call set_page_dirty_balance(), but that isn't exported, so just call balance_dirty_pages_ratelimited() directly. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/block2mtd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 8debac9efde9..e081bfeaaf7d 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -62,6 +62,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
62 memset(page_address(page), 0xff, PAGE_SIZE); 62 memset(page_address(page), 0xff, PAGE_SIZE);
63 set_page_dirty(page); 63 set_page_dirty(page);
64 unlock_page(page); 64 unlock_page(page);
65 balance_dirty_pages_ratelimited(mapping);
65 break; 66 break;
66 } 67 }
67 68
@@ -152,6 +153,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
152 memcpy(page_address(page) + offset, buf, cpylen); 153 memcpy(page_address(page) + offset, buf, cpylen);
153 set_page_dirty(page); 154 set_page_dirty(page);
154 unlock_page(page); 155 unlock_page(page);
156 balance_dirty_pages_ratelimited(mapping);
155 } 157 }
156 page_cache_release(page); 158 page_cache_release(page);
157 159