Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: tests: add count parameter to mtd_speedtest

By default mtd_speedtest uses all the eraseblocks of the
MTD partition being tested. For large partitions a
smaller number is sufficient and makes running the test
quicker. For that reason, add a parameter 'count' to
specify the maximum number of eraseblocks to use for
testing.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Adrian Hunter and committed by
David Woodhouse
fc7fe769 e6da8568

+13 -2
+13 -2
drivers/mtd/tests/mtd_speedtest.c
··· 16 16 * 17 17 * Test read and write speed of a MTD device. 18 18 * 19 - * Author: Adrian Hunter <ext-adrian.hunter@nokia.com> 19 + * Author: Adrian Hunter <adrian.hunter@nokia.com> 20 20 */ 21 21 22 22 #include <linux/init.h> ··· 32 32 static int dev; 33 33 module_param(dev, int, S_IRUGO); 34 34 MODULE_PARM_DESC(dev, "MTD device number to use"); 35 + 36 + static int count; 37 + module_param(count, int, S_IRUGO); 38 + MODULE_PARM_DESC(count, "Maximum number of eraseblocks to use " 39 + "(0 means use all)"); 35 40 36 41 static struct mtd_info *mtd; 37 42 static unsigned char *iobuf; ··· 331 326 332 327 printk(KERN_INFO "\n"); 333 328 printk(KERN_INFO "=================================================\n"); 334 - printk(PRINT_PREF "MTD device: %d\n", dev); 329 + if (count) 330 + printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count); 331 + else 332 + printk(PRINT_PREF "MTD device: %d\n", dev); 335 333 336 334 mtd = get_mtd_device(NULL, dev); 337 335 if (IS_ERR(mtd)) { ··· 360 352 "eraseblock %u, OOB size %u\n", 361 353 (unsigned long long)mtd->size, mtd->erasesize, 362 354 pgsize, ebcnt, pgcnt, mtd->oobsize); 355 + 356 + if (count > 0 && count < ebcnt) 357 + ebcnt = count; 363 358 364 359 err = -ENOMEM; 365 360 iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);