This patch makes f3probe issue single calls of
sequential reads and writes wherever is possible to speed up
the non-destructive (i.e. conservative) mode.
Notice that the non-destructive mode only recovers the usable
blocks of fake drives, and all blocks of legit drives.
Although I (Michel) am not 100% sure, the kernel seemed to be
allowing reads to get data from an internal cache in the kernel;
the condition is tricky to reproduce, and trickier to be sure
since fake drives are not reliable or preditable.
The results seems more stable with this patch, though.
f3probe was using just 3 writes to make a decision on how to
balance resets and writes.
When the first 3 writes were faster than normal,
the next pass would go for an unrealistic number of writes.
This patch requires at least 10 writes;
in practice, it will uses 15 writes.
The larger number of writes allows for a better balance.
probe_device_max_blocks() was returning an int that once multiplied
by block_size was out range.
This patch just enforces probe_device_max_blocks() to return
an uint64_t, and does the needed adjustments in the code.
libdevs.c had error messages that mentioned f3probe.
Given that f3brew also uses libdevs.c, this was causing nonsense
error messages such as the following:
==================================================================
$ ./f3brew /dev/sdc
F3 brew 5.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
Your username doesn't have access to device `/dev/sdc'.
Try to run this program as root:
sudo f3probe /dev/sdc
In case you don't have access to root, use f3write/f3read.
Application cannot continue, finishing...
==================================================================
F3 users have identified fake flashes that reserve a portion of
their good memory to use as a permanent cache.
This patch adds this feature to our model in order to allow us to
develop a new probe algorithm to deal with it.
f3brew were working at sector level because
it was borrowing code from f3write/f3read which work at that level.
This patch writes new functions to fill out, and validate blocks.
This change is important because
f3probe needs to validate blocks as well for its coming features.
A side effect of this patch is that all experimental applications
(i.e. f3probe, f3brew, and f3fix) no longer depend on
code from f3write and f3read.
When a non-root user called f3brew on a device,
f3brew would issue the following error message:
Your username doesn't have access to device `/dev/sdc'.
Try to run this program as root:
sudo f3probe /dev/sdc
In case you don't have access to root, use f3write/f3read.
f3brew: f3brew.c:484: main: Assertion `dev' failed.
Aborted (core dumped)
This patch avoids the assert().
f3probe does not try to find the real amount of memory that
a fake card has, but the usable about of memory, that is,
the memory from the first block (i.e. block zero) to
the block before the first failed block.
A fake card may have more memory, but it would be spread among
failed blocks, so it is not usable.
This patch just enables debugging mode when parameters
--debug-block-order and --debug-keep-file are used;
This is equivalent to automatically adding --debug.
It was an expected behavior that wasn't implemented.
f3probe was using a kernel-recommended logical block size.
This patch allows f3probe to always find
the last good physical block of devices.
This patch also renames option --block-order to --debug-block-order
since f3probe detects the physical block size of devices.