Commit Graph

195 Commits

Author SHA1 Message Date
Ming-Hung Tsai
d00388f68a [thin_shrink] Support short options 2021-07-07 16:06:04 +08:00
Ming-Hung Tsai
1526ab3472 [all] Apply cargo fmt, and fix clippy warning of branches_sharing_code 2021-07-02 16:17:52 +08:00
Kay Lin
c18cd42d35 [build] Update dependencies
- Update crc32c to 0.6, which allows it to be built on AArch64.

  - Update base64 to 0.13
  - Update byteorder to 0.14
  - Update io-uring to 0.4
  - Update libc to 0.2.83
  - Update nix to 0.19
  - Update nom to 6.0.1
  - Update quick-xml to 0.20
  - Update rand to 0.8
  - Update tempfile to 3.2
  - Update tui to 0.14

Signed-off-by: Kay Lin <i@v2bv.net>
2021-06-26 00:08:58 +08:00
Ming-Hung Tsai
2cb84236d4 [all (rust)] Tidy command line options 2021-06-23 14:33:28 +08:00
Ming-Hung Tsai
cd48f00191 [all (rust)] Make sync-io the default
Multithreaded sync-io has performance similar to async-io. Also,
sync-io saves the hassle of setting ulimits to get io_uring working
on some systems (commit ba7fd7b). Now we default to sync-io, and
leave async-io as a hidden option for testing and benchmarking.
2021-06-23 14:33:28 +08:00
Ming-Hung Tsai
361d19adaa [space_map (rust)] Fix cache hit with async-io 2021-06-23 14:33:28 +08:00
Ming-Hung Tsai
fba2adbe56 [tests] Fix minor test errors
- Fix command line arguments
- Adapt error messages for rust implementations
2021-06-21 23:27:51 +08:00
Ming-Hung Tsai
7daff7350a [thin/cache_dump (rust)] Add buffered outputs, and fix command line options 2021-06-21 23:27:51 +08:00
Ming-Hung Tsai
c71132c056 [space_map (rust)] Do not use an extra block set for building metadata sm
The blocks storing metadata itself are located continuously within
a certain reserved range, hence there's no need to use a block set
as the representation.
2021-06-21 23:11:57 +08:00
Ming-Hung Tsai
7ab97a9aae [space_map (rust)] Fix nr_free in index entries 2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
4b7b3658ff [thin/cache_restore (rust)] Build the metadata space map in-place
That avoids cloning the source space map
2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
9ab8dfa283 [space_map (rust)] Fix bitmap packing
- Allow packing unaligned number of bitmap entries that could happen
  with the last bitmap. Unused trailing entries are zeroed by memset.
- Fix none_free_before in index_entry
2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
3fda9cc1f8 [thin_restore (rust)] Do not iterate mapping tree leaves twice 2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
de7e79fc06 [btree_builder] Rename Builder to BTreeBuilder for clarity 2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
6d16c5816e [btree_builder] Fix reference counts of btree nodes
A leaf node should be counted only if it is referenced by some internal
nodes, since the leaves generated by <def> sections might be unshifted
and merged with exclusive mappings or other shared defs, or they might
not even be used by any of the devices if the xml was tampered. The
internal nodes should be handled in the same manner.

The new 'reserve' operation is designed for this purpose. Applications
could reserve a block for later use, without setting its ref count
immediately. This way saves the hassles of tracking unused leaves.
2021-06-16 01:39:31 +08:00
Ming-Hung Tsai
9e061a03a8 [space_map (rust)] Do not reset search position 2021-06-11 20:51:49 +08:00
Ming-Hung Tsai
88e7f8fd69 [array_builder] Simplify array building process 2021-06-11 20:51:49 +08:00
Ming-Hung Tsai
60b65ebe7a [space_map (rust)] Fix uninitialized bytes in index block 2021-06-08 20:17:24 +08:00
Ming-Hung Tsai
b12530f580 [space_map (rust)] Fix nr_allocated tracking in CoreSpaceMap 2021-05-28 20:20:30 +08:00
Ming-Hung Tsai
3a653eaa5f [thin_restore (rust)] Build metadata and data space maps 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
c142cd0d48 [space_map (rust)] Fix space map building
- Fix out-of-bounds index
- Automatically flush queued writes before function return
- Track allocated blocks in write_batcher (might be space consuming)
2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
13d6c72ad9 [cache_restore (rust)] Build metadata space map 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
48d4fc51ed [space_map (rust)] Factor out space_map_metadata 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
d5e6a69af6 [thin (rust)] Fix the unit of metadata_block_size in superblock 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
6a29f6a41a [cache_check (rust)] Fix discard bitset availability checking 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
ce94ba73a5 [cache_restore (rust)] First draft 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
e336b3a63f [math (rust)] Make the functions generic 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
1198a3f713 [cache (rust)] Implement Pack for superblock 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
511ae9e908 [checksum] Support cache and era superblock 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
159dda9659 [thin_restore (rust)] Tidy up with the builder pattern 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
1907dab5ee [cache (rust)] Implement Pack and Default for restoration 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
86e2db3a1a [cache (rust)] Add visitor traits for cache_restore 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
2a77036fa8 [array_builder] First draft
Not tested yet
2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
a6e1870b2b [array (rust)] Implement Pack for restoration 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
7e2d69ede9 [cache_dump (rust)] Allow partially broken dirty bitset 2021-05-28 03:19:42 +08:00
Ming-Hung Tsai
2a9e7cf74f [thin_dump (rust)] Split runs at the position with multiple references
That is, an element with multiple references will serve as the beginning
of an atomic run.
2021-05-28 00:18:27 +08:00
Ming-Hung Tsai
30cfcd9a88 [thin_dump (rust)] Use common leaf sequences to pack metadata 2021-05-28 00:07:32 +08:00
Ming-Hung Tsai
4c47fcabbf [thin_dump (rust)] Fix missing outputs 2021-05-27 23:51:37 +08:00
Ming-Hung Tsai
7e53c36d6b [cache (rust)] Fix bugs in array iteration and text outputs
- Fix array indexing
- Fix panic on empty array
- Remove trailing null characters from the policy name
- Change XML tag naming for backward compatibility
2021-05-13 21:36:52 +08:00
Ming-Hung Tsai
1bbb63f06b [cache_check (rust)] Fix discard bitset size checking 2021-05-12 15:50:14 +08:00
Ming-Hung Tsai
b7bf82b8f2 [all] Fix newline in version string 2021-05-12 12:03:52 +08:00
Ming-Hung Tsai
965fbb6e8f [all] Apply cargo fmt, and fix clippy warnings 2021-05-11 23:53:31 +08:00
Ming-Hung Tsai
5baeab4a5c Merge branch 'main' into rust-cache-tools 2021-05-11 23:16:08 +08:00
Joe Thornber
d9a96758b0
Merge pull request #168 from mingnus/2020-10-09-thin-restore-rewrite
Merge recent changes in thin_restore
2021-05-04 09:21:40 +01:00
Ming-Hung Tsai
43e433149b [all] Apply cargo fmt 2021-05-04 16:10:23 +08:00
Ming-Hung Tsai
4b4584c830 [thin_restore (rust)] Apply several fixes
- Fix reading queued blocks
- Fix unnecessary block shadowing when there's no remaining values
- Prevent superblock from overwritten
- Flush queued writes before updating superblock
2021-05-03 00:07:34 +08:00
Ming-Hung Tsai
e9899ac610 Add missing math.rs 2021-04-26 12:47:05 +08:00
Ming-Hung Tsai
cf4b937ade [cache_check (rust)] Check space map counts
- Support space map checking and auto-repair
2021-04-23 16:23:21 +08:00
Ming-Hung Tsai
636d50a38d [thin_check (rust)] Pull out space map checking routines 2021-04-23 16:04:56 +08:00
Ming-Hung Tsai
e1628f9004 [cache_check (rust)] Add more checks
- Check array indices continuity
- Support ignore_non_fatal
- Report blocknr of IoErrors
- Report array block indeices
2021-04-21 23:35:22 +08:00