314 Commits

Author SHA1 Message Date
Michel Machado
1a576cb6dc f3probe: speed up non-destructive mode
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.
2015-11-17 16:51:29 -05:00
Michel Machado
08dd0e9061 f3probe: avoid division by zero
Since some fake drives do not require resets,
the option --time-ops was triggering a division by zero for
those drives.
2015-11-16 13:09:44 -05:00
Michel Machado
e7769bb77d f3probe: relax cache size comparision in unit test 2015-11-16 12:49:18 -05:00
Michel Machado
3d04fc7b55 f3probe: change default reset to --reset-type=1 2015-11-14 09:33:19 -05:00
Michel Machado
70e07816af f3probe: support any reset type (even no reset!)
This patch allows f3probe to report an accurate usable size
with any type of reset.
It works even with --reset-type=2 that is no reset at all.
2015-11-14 09:26:01 -05:00
Michel Machado
8348bcd909 f3probe: fix unit test
The name of a variable as mistyped.
The bug was innocuous, though.
2015-11-14 08:53:11 -05:00
Michel Machado
83a9c1c87d f3probe/f3brew: add --reset-type=2
Reset type 2 does not reset, that is, it does nothing.
This parameter is only helpful to study the effects of cache on
the F3 algorithms.
2015-11-14 08:38:33 -05:00
Michel Machado
49c7d5fc63 f3probe: avoid resets for drives without any cache 2015-11-13 21:07:12 -05:00
Michel Machado
cedb3f17d2 f3probe: fix a (supposed) race condition
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.
2015-11-13 20:18:12 -05:00
Michel Machado
bf550a0ce9 f3probe: better ballance writes and resets while bisecting
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.
2015-11-13 20:07:06 -05:00
Michel Machado
73e831b35e Bump version to 6.0 2015-11-13 15:19:37 -05:00
Michel Machado
e3fe7a006d f3probe: fix allocation error of safe device
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.
2015-11-13 14:40:43 -05:00
Michel Machado
591ad8a7bf f3probe: add a blank line when --destructive is used
When option --destructive was being used,
f3probe was not spacing the final diagnosis message.
2015-11-13 14:37:42 -05:00
Michel Machado
59ab4e9a8e f3brew: correct messages that refer to f3probe
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...
==================================================================
2015-11-13 14:05:51 -05:00
Michel Machado
fe4e9dd2e7 f3probe: speed up writing and reading
This patch takes advantage of the new interface of struct device
to write and read sequential blocks with a single call.
2015-11-13 11:14:36 -05:00
Michel Machado
067802ca5a f3brew: speed up writing and reading
This patch changes the interface of struct device to allow
writes and reads of sequential blocks with a single call.
2015-11-13 09:09:33 -05:00
Michel Machado
5d76cd84b6 f3probe: deal with permanent cache
This patch addresses issue discussed here:
https://github.com/AltraMayor/f3/issues/15

Given the structure of the solution implemented in this patch,
it's also expected to address the following issue:
https://github.com/AltraMayor/f3/issues/16
2015-11-12 09:55:39 -05:00
Michel Machado
3f0efeb12f f3probe/f3brew: add cache to the model
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.
2015-11-12 09:55:39 -05:00
Michel Machado
57fded9501 f3write/f3read: scripts must be in the same folder 2015-11-11 16:04:00 -05:00
Michel Machado
88c03dea90 f3fix: add missing parameter in argp_error() calls
@pbludov reported and fixed this bug in the following issue:
https://github.com/AltraMayor/f3/issues/26
2015-11-10 14:00:47 -05:00
Michel Machado
246011f053 f3brew: work at block level
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.
2015-11-04 16:41:04 -05:00
Michel Machado
cc24fdf5b2 f3probe: fix a memory leak
This memory leak is innocuous since it happens a little before
f3probe exits.
2015-11-04 11:03:13 -05:00
Michel Machado
add20ef7ae f3brew: test if device moved after reset
Devices might change their names after a reset.
This patch simply adds the same warning that
f3probe already has to f3brew.
2015-11-03 12:55:30 -05:00
Michel Machado
c47a7642fb f3brew: handle lack of access right
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().
2015-11-03 12:43:03 -05:00
Michel Machado
8305e5ad5f f3brew: add block size information
Not only does f3brew list block size, but f3brew also uses
this information to better report results.
2015-11-03 09:06:23 -05:00
Michel Machado
277f61a403 f3probe: rename real size to usable size
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.
2015-10-27 09:00:12 -04:00
Michel Machado
795424c873 f3brew: make output easier to read
The results are grouped, so the output is not too verbose.
2015-10-09 16:43:09 -04:00
Michel Machado
c77db3d9e0 f3brew: fixed bugs
f3brew were inverting the semantic of parameter --debug, and
it was calculating a wrong last block for drives.
2015-10-09 14:41:23 -04:00
Michel Machado
015facf8fe Merge pull request #23 from bor/fix/README
Adapt syntax of README.md for markdown
2015-09-14 15:29:49 -04:00
Michel Machado
fc4af9d255 Merge pull request #22 from bor/fix/Makefile
Add 'install -d' to create dirs in case they don't exists.

This fix helps creating packages under chroot/etc.
for example see
2015-09-14 15:24:23 -04:00
Sergiy Borodych
310eac5bae adapt syntax for markdown
to show it as more nicer at github
2015-09-14 12:54:50 +03:00
Sergiy Borodych
77c00662ab add 'install -d' for prepare dirs (ensure that dirs exists) 2015-09-14 12:25:11 +03:00
Michel Machado
bcf71585a8 f3brew: add --do-not-write and --do-not-read
These new options help with writing scripts and repeating tests.
2015-09-02 10:43:36 -04:00
Michel Machado
4b7d35951f f3brew: accept parameters from prompt 2015-09-02 10:43:36 -04:00
Michel Machado
bce2b9899b f3probe: --debug-block-order and --debug-keep-file
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.
2015-09-02 10:43:36 -04:00
Michel Machado
0121daf4af Edit a comment 2015-09-02 10:43:36 -04:00
Michel Machado
1114987783 Merge pull request #20 from davidknoll/install
Why not have a make install target?
2015-09-02 09:49:10 -04:00
David Knoll
bbdddb23c9 Why not have a make install target? 2015-09-02 00:15:42 +01:00
Michel Machado
64bb916977 Merge pull request #18 from brunetton/master
Renaming README to README.md to make Markdown used by Github
2015-08-25 14:24:52 -04:00
Bruno Duyé
ebccd66c5a Renaming README to README.md to make Markdown used by Github 2015-08-23 12:31:58 +02:00
Michel Machado
d47c05ed17 Merge pull request #17 from brammeleman/patch-1
Use f3read/write in the same directory as log-f3wr
2015-07-18 13:52:02 -04:00
brammeleman
6ff6c00f97 use f3read/write in the same directory as log-f3wr 2015-07-17 23:32:26 +02:00
Michel Machado
4d913c1442 f3probe: handle failures in usb_fd_from_block_dev()
Function usb_fd_from_block_dev() wasn't releasing resources
if any error happened.

Reported-by: Peter Skensved
2015-03-30 07:36:11 -04:00
Michel Machado
902db294ef f3probe: align buffers with devices' block sizes
This patch should address issue discussed here:
https://github.com/AltraMayor/f3/issues/13

Reported-by: Dingyuan Wang
2015-02-14 10:36:07 -05:00
Michel Machado
4f13815dfc f3probe: use physical block size
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.
2015-02-14 09:56:04 -05:00
Michel Machado
8ee3eaca71 f3fix: deal with sectors whose sizes are not 512B
See discussion on this issue here:
https://github.com/AltraMayor/f3/issues/13

Reported-by: Dingyuan Wang
2015-02-12 09:24:18 -05:00
Michel Machado
ea4b33e275 f3probe: fix segmentation fault during manual reset 2015-02-04 16:48:20 -05:00
Michel Machado
d74ef39bdd f3probe: rename a variable for readability 2015-02-04 16:37:46 -05:00
Michel Machado
c3db1edd7c f3probe: improve error handling during resets 2015-02-02 14:41:17 -05:00
Michel Machado
8001dfdadd f3probe: make read_all() return negative errors
bdev_read_block(), who calls read_all(), is
expected to return negative errors.
2015-02-02 13:31:00 -05:00