Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed May 1, 2019
1 parent bb3cfd5 commit 897e7d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ a file with different state is prepared and the process continues.
Algorithm
=========

Because any single write can be comprise of multiple sectors (it's not uncommon
to write a full page (4KiB) at a time), the generation of images can work
in two main modes - write mode, where the atomic operation is a single write
or block mode, where the atomic operation is a single sector.
Because any single write can be comprised of multiple sectors (it's not
uncommon to write a full page (4KiB) at a time), the generation of images can
work in two main modes - write mode, where the atomic operation is a single
write or block mode, where the atomic operation is a single sector.

First step is to prepare a base image, that is done by taking the original
image, and replying the log up to specific point in time. Few reads past that
point are taken and permutated in order. That permutation is then written
write by write and tested, but only if it would not cause testing the same
permutation multiple times.

Let's analyse situation for 3 writes that do not overlap (0, 1 and 2):

Full list of permutations of three element list would look like this:
```
list(i[:l] for i in itertools.permutations([0, 1, 2]) for l in range(1, 4)) =
Expand Down
3 changes: 3 additions & 0 deletions scripts/write-capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def pread(h, count, offset):

def pwrite(h, buf, offset):
global disk
# we need a timer that is consistent between processes
# so that we know which writes happen in what order in multi-device
# tests
start = time.clock_gettime_ns(time.CLOCK_REALTIME)
disk.seek(offset, os.SEEK_SET)
disk.write(buf)
Expand Down

0 comments on commit 897e7d2

Please sign in to comment.