AltraMayor / AltraMayor/f3

f3probe writes multiple MiB of data

Open
#147 4 comments 0 reactions 0 assignees View on GitHub
Documentation
Dominant language
C
Stars
3.4k
Forks
177
Avg merge
2d 15h
Merged PRs (30d)
2

Description

Adding diagnostic output to `write_blocks()` and also simply looking at an I/O monitor, there clearly is a lot of data being written to the flash disk while running `f3probe`. The readme says it is the "fastest" and "only writes what's necessary". I'd think the following procedure would suffice. What would be wrong with this approach, assuming like `f3probe` that fake flash simply discards one or more top address bits?

1. Write 1 block with unique contents to the last block of the fake disk, i.e. at position `fake_size_in_blocks - 1`. Assign this position to `a`.
2. Since we assume that fake flash has at least 1 block of real storage we do not need to test that the block can be read back at position `a`. It will, unless there is some other damage and we are not interested in testing for this here.
3. Set `n = log_2(floor(a))`.
4. Read at position `a - 2^n`, i.e. clearing the top non-zero address bit.
5. If our special block comes back record that address bit `n` is not connected.
6. If `a` is not `2^(n+1) - 1`, write our unique contents also to position `2^n - 1`.
7. Set `a = 2^n - 1`, i.e. the last block of the next smaller power of 2 fake drive size.
8. Go to step 3 if `a` is not 0 (or above some other reasonable threshold, e.g. 2048 if assuming there is at least 1 MiB of real storage)
9. Report fake flash if at least 1 bit is not connected
10. Report useable size as `block_size * 2^m` where `m` is the lowest address bit not connected

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.