general_block_device: optimize test_contiguous_erase_write_read() buffer size for large-sector flashes

pull/13848/head
Lingkai Dong 2020-11-06 16:54:06 +00:00
parent 4a47709cb0
commit 76cf78d654
1 changed files with 9 additions and 2 deletions

View File

@ -549,8 +549,15 @@ void test_contiguous_erase_write_read()
utest_printf("contiguous_erase_size=0x%" PRIx64 "\n", contiguous_erase_size);
bd_size_t write_read_buf_size = program_size;
if (contiguous_erase_size / program_size > 8 && contiguous_erase_size % (program_size * 8) == 0) {
write_read_buf_size = program_size * 8;
// Reading/writing in larger chunks reduces the number of operations,
// helping to avoid test timeouts. Try 256-byte chunks if contiguous_erase_size
// (which should be a power of 2) is greater than that. If it's less than
// that, the test finishes quickly anyway...
if ((program_size < 256) && (256 % program_size == 0)
&& (contiguous_erase_size >= 256) && (contiguous_erase_size % 256 == 0)) {
utest_printf("using 256-byte write/read buffer\n");
write_read_buf_size = 256;
}
// Allocate write/read buffer