flashbench: start at multiple of erasesize for --open-au
Apparently, 1.5 MB erase blocks or multiples of that are more
common than I first thought, so automatically try to handle these
by starting at a multiple of the erase blcok.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/flashbench.c b/flashbench.c
index aaf4c5d..0a1016f 100644
--- a/flashbench.c
+++ b/flashbench.c
@@ -514,9 +514,9 @@
unsigned long long offset,
bool random)
{
- /* start 16 MB into the device, to skip FAT */
+ /* start 16 MB into the device, to skip FAT, round up to full erase blocks */
if (offset == -1ull)
- offset = 1024 * 1024 * 16;
+ offset = (1024 * 1024 * 16 + erasesize - 1) / erasesize * erasesize;
/* find maximum number of open AUs */
struct operation program[] = {