Skip to content

Commit 031da73

Browse files
neilbrowndedekind
authored andcommitted
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>
1 parent 6f2a6a5 commit 031da73

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/mtd/devices/block2mtd.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static int _block2mtd_erase(struct block2mtd_dev *dev, loff_t to, size_t len)
6262
memset(page_address(page), 0xff, PAGE_SIZE);
6363
set_page_dirty(page);
6464
unlock_page(page);
65+
balance_dirty_pages_ratelimited(mapping);
6566
break;
6667
}
6768

@@ -152,6 +153,7 @@ static int _block2mtd_write(struct block2mtd_dev *dev, const u_char *buf,
152153
memcpy(page_address(page) + offset, buf, cpylen);
153154
set_page_dirty(page);
154155
unlock_page(page);
156+
balance_dirty_pages_ratelimited(mapping);
155157
}
156158
page_cache_release(page);
157159

0 commit comments

Comments
 (0)