Patchwork [1/2] mtd: torturetest: rewrite the erase-write-verify process into one block unit.

login
register
mail settings
Submitter Huang Shijie
Date Feb. 5, 2013, 2:20 a.m.
Message ID <1360030820-21491-1-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/218141/
State New
Headers show

Comments

Huang Shijie - Feb. 5, 2013, 2:20 a.m.
Rewrite the torture cycle, do the erase-write-verify process in
one block unit, not in several blocks unit.

This patch makes preparations for adding the rand data pattern support.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/tests/mtd_torturetest.c |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)

Patch

diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c
index c4cde1e..516cf66 100644
--- a/drivers/mtd/tests/mtd_torturetest.c
+++ b/drivers/mtd/tests/mtd_torturetest.c
@@ -313,21 +313,18 @@  static int __init tort_init(void)
 		int i;
 		void *patt;
 
-		/* Erase all eraseblocks */
 		for (i = eb; i < eb + ebcnt; i++) {
 			if (bad_ebs[i - eb])
 				continue;
+
+			/* Erase all eraseblocks */
 			err = erase_eraseblock(i);
 			if (err)
 				goto out;
 			cond_resched();
-		}
 
-		/* Check if the eraseblocks contain only 0xFF bytes */
-		if (check) {
-			for (i = eb; i < eb + ebcnt; i++) {
-				if (bad_ebs[i - eb])
-					continue;
+			/* Check if the eraseblocks contain only 0xFF bytes */
+			if (check) {
 				err = check_eraseblock(i, patt_FF);
 				if (err) {
 					pr_info("verify failed"
@@ -336,12 +333,8 @@  static int __init tort_init(void)
 				}
 				cond_resched();
 			}
-		}
 
-		/* Write the pattern */
-		for (i = eb; i < eb + ebcnt; i++) {
-			if (bad_ebs[i - eb])
-				continue;
+			/* Write the pattern */
 			if ((eb + erase_cycles) & 1)
 				patt = patt_5A5;
 			else
@@ -350,17 +343,9 @@  static int __init tort_init(void)
 			if (err)
 				goto out;
 			cond_resched();
-		}
 
-		/* Verify what we wrote */
-		if (check) {
-			for (i = eb; i < eb + ebcnt; i++) {
-				if (bad_ebs[i - eb])
-					continue;
-				if ((eb + erase_cycles) & 1)
-					patt = patt_5A5;
-				else
-					patt = patt_A5A;
+			/* Verify what we wrote */
+			if (check) {
 				err = check_eraseblock(i, patt);
 				if (err) {
 					pr_info("verify failed for %s"