Skip to contentSkip to conversation

mtd-tests/flash_stress: allow picking any erase block

PATCH New Dominique Martinet 1 participant 1 message Aug 14 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd-tests/flash_stress: allow picking any erase block

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(-)
tests/mtd-tests/flash_stress.c +1 -2
index da39e1408ed3..ada8596382e9 100644
@@ -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;
Signature · 7 lines
2.55.0.dirty



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/