From: Peter Korsgaard <[email protected]>
Similar to the optimization in flashcp. On a Micron n25q128, this speeds up
flash erase from ~180s to ~120s, and allows userspace to do useful work
while erasing as the kernel driver returns as soon as the erase command is
sent to the chip.
bloat-o-meter busybox_unstripped{,_new}
function old new delta
flash_eraseall_main 848 861 +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes
Signed-off-by: Peter Korsgaard <[email protected]>
---
miscutils/flash_eraseall.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index bf9b739..34e2d68 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -138,8 +138,12 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
/* Don't want to destroy progress indicator by bb_error_msg's */
applet_name = xasprintf("\n%s: %s", applet_name, mtd_name);
+ /* optimization: if not verbose/badblock/jffs, erase in one go */
+ if (flags == OPTION_Q)
+ erase.length = meminfo.size;
+
for (erase.start = 0; erase.start < meminfo.size;
- erase.start += meminfo.erasesize) {
+ erase.start += erase.length) {
if (!(flags & OPTION_N)) {
int ret;
loff_t offset = erase.start;
--
1.8.5.2
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox