[PATCH mtd-utils] mtd-tests/flash_stress: allow picking any erase block

Dominique Martinet <[email protected]>
Newsgroups org.infradead.lists.linux-mtd
Message-ID <[email protected]>
unlike the kernel module mtd_stresstest, the read and write operations
in this test program only ever span a single erase block, so we can pick
any erase block in rand_eb()
---
Noticed this while looking at the code (to get a rough idea of how many
erase cycles I'm going through on average for each erase block with this)

 tests/mtd-tests/flash_stress.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/mtd-tests/flash_stress.c b/tests/mtd-tests/flash_stress.c
index da39e1408ed3..ada8596382e9 100644
--- a/tests/mtd-tests/flash_stress.c
+++ b/tests/mtd-tests/flash_stress.c
@@ -150,9 +150,8 @@ static int rand_eb(void)
 {
 	unsigned int eb;
 
-	/* Read or write up 2 eraseblocks at a time - hence 'mtd.eb_cnt - 1' */
 	do {
-		eb = rand() % (mtd.eb_cnt - 1);
+		eb = rand() % mtd.eb_cnt;
 	} while (bbt[eb]);
 
 	return eb;
-- 
2.55.0.dirty



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.