mmc: mmc_test: make performance test area size about 4MiB

The test area size was set to the preferred erase size but for comparison
purposes it is better if it is the same size for different devices.  Make
it a multiple of preferred erase size that is greater than or equal to 4MiB.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
Adrian Hunter 2011-02-08 13:41:01 +02:00 committed by Chris Ball
parent 12f8ef8fb2
commit 0532ff6358

View file

@ -1426,28 +1426,29 @@ static int mmc_test_area_cleanup(struct mmc_test_card *test)
} }
/* /*
* Initialize an area for testing large transfers. The size of the area is the * Initialize an area for testing large transfers. The test area is set to the
* preferred erase size which is a good size for optimal transfer speed. Note * middle of the card because cards may have different charateristics at the
* that is typically 4MiB for modern cards. The test area is set to the middle * front (for FAT file system optimization). Optionally, the area is erased
* of the card because cards may have different charateristics at the front * (if the card supports it) which may improve write performance. Optionally,
* (for FAT file system optimization). Optionally, the area is erased (if the * the area is filled with data for subsequent read tests.
* card supports it) which may improve write performance. Optionally, the area
* is filled with data for subsequent read tests.
*/ */
static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill) static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
{ {
struct mmc_test_area *t = &test->area; struct mmc_test_area *t = &test->area;
unsigned long min_sz = 64 * 1024; unsigned long min_sz = 64 * 1024, sz;
int ret; int ret;
ret = mmc_test_set_blksize(test, 512); ret = mmc_test_set_blksize(test, 512);
if (ret) if (ret)
return ret; return ret;
if (test->card->pref_erase > TEST_AREA_MAX_SIZE >> 9) /* Make the test area size about 4MiB */
t->max_sz = TEST_AREA_MAX_SIZE; sz = (unsigned long)test->card->pref_erase << 9;
else t->max_sz = sz;
t->max_sz = (unsigned long)test->card->pref_erase << 9; while (t->max_sz < 4 * 1024 * 1024)
t->max_sz += sz;
while (t->max_sz > TEST_AREA_MAX_SIZE && t->max_sz > sz)
t->max_sz -= sz;
t->max_segs = test->card->host->max_segs; t->max_segs = test->card->host->max_segs;
t->max_seg_sz = test->card->host->max_seg_size; t->max_seg_sz = test->card->host->max_seg_size;