Commit fc7fe769 authored by Adrian Hunter's avatar Adrian Hunter Committed by David Woodhouse

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: default avatarAdrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent e6da8568
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* Test read and write speed of a MTD device. * Test read and write speed of a MTD device.
* *
* Author: Adrian Hunter <ext-adrian.hunter@nokia.com> * Author: Adrian Hunter <adrian.hunter@nokia.com>
*/ */
#include <linux/init.h> #include <linux/init.h>
...@@ -33,6 +33,11 @@ static int dev; ...@@ -33,6 +33,11 @@ static int dev;
module_param(dev, int, S_IRUGO); module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use"); MODULE_PARM_DESC(dev, "MTD device number to use");
static int count;
module_param(count, int, S_IRUGO);
MODULE_PARM_DESC(count, "Maximum number of eraseblocks to use "
"(0 means use all)");
static struct mtd_info *mtd; static struct mtd_info *mtd;
static unsigned char *iobuf; static unsigned char *iobuf;
static unsigned char *bbt; static unsigned char *bbt;
...@@ -326,7 +331,10 @@ static int __init mtd_speedtest_init(void) ...@@ -326,7 +331,10 @@ static int __init mtd_speedtest_init(void)
printk(KERN_INFO "\n"); printk(KERN_INFO "\n");
printk(KERN_INFO "=================================================\n"); printk(KERN_INFO "=================================================\n");
printk(PRINT_PREF "MTD device: %d\n", dev); if (count)
printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count);
else
printk(PRINT_PREF "MTD device: %d\n", dev);
mtd = get_mtd_device(NULL, dev); mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) { if (IS_ERR(mtd)) {
...@@ -353,6 +361,9 @@ static int __init mtd_speedtest_init(void) ...@@ -353,6 +361,9 @@ static int __init mtd_speedtest_init(void)
(unsigned long long)mtd->size, mtd->erasesize, (unsigned long long)mtd->size, mtd->erasesize,
pgsize, ebcnt, pgcnt, mtd->oobsize); pgsize, ebcnt, pgcnt, mtd->oobsize);
if (count > 0 && count < ebcnt)
ebcnt = count;
err = -ENOMEM; err = -ENOMEM;
iobuf = kmalloc(mtd->erasesize, GFP_KERNEL); iobuf = kmalloc(mtd->erasesize, GFP_KERNEL);
if (!iobuf) { if (!iobuf) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment