Commit Graph

1956 Commits

Author SHA1 Message Date
bfc7f96d9f [tests] Enable testing the rust targets
This is a temporary solution for development.
Usage: cargo test --features rust_tests
2021-06-21 23:27:51 +08:00
7daff7350a [thin/cache_dump (rust)] Add buffered outputs, and fix command line options 2021-06-21 23:27:51 +08:00
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
7ab97a9aae [space_map (rust)] Fix nr_free in index entries 2021-06-16 01:39:31 +08:00
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
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
3fda9cc1f8 [thin_restore (rust)] Do not iterate mapping tree leaves twice 2021-06-16 01:39:31 +08:00
de7e79fc06 [btree_builder] Rename Builder to BTreeBuilder for clarity 2021-06-16 01:39:31 +08:00
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
9e061a03a8 [space_map (rust)] Do not reset search position 2021-06-11 20:51:49 +08:00
88e7f8fd69 [array_builder] Simplify array building process 2021-06-11 20:51:49 +08:00
101028ed5f Merge pull request #176 from mingnus/2021-04-28-coverity-fixes
Clear thin superblock flags in restored metadata
2021-06-09 10:10:44 +01:00
60b65ebe7a [space_map (rust)] Fix uninitialized bytes in index block 2021-06-08 20:17:24 +08:00
c32517f827 [thin] Clear superblock flags in restored metadata
The needs_check flag is unnecessary for a restored metadata since
it is assumed clean and has no errors
2021-06-07 19:06:56 +08:00
01aac6c1c1 Merge pull request #175 from mingnus/2021-04-28-coverity-fixes
Fix resource leak
2021-06-04 15:22:24 +01:00
429e7f01d7 [file_utils] Fix resource leak 2021-06-04 21:37:02 +08:00
2413b5d31f Merge pull request #174 from mingnus/2021-04-28-coverity-fixes
Fix issues detected by Coverity
2021-06-03 12:11:54 +01:00
8014643b9e [build] Allow running tests without the --enable-testing configuration
- Make the test targets always available (test, unit-test, functional-test)
- Cleanup include paths, and bring back the CPPFLAGS in commit 3e24cff that
  was overwritten by the merge ca8f6df (PR #60)
- Introduce the dev-tools target for building testing/dbg tools individually
- Leave the --enable-testing option for backward compatibility
2021-06-03 18:54:26 +08:00
050eacf4cb [all] Remove unreachable code 2021-06-03 18:54:26 +08:00
db52308d85 [build] Remove unused sources from the regular build 2021-06-03 18:54:26 +08:00
25ed2dfc9a [thin_dump] Fix warnings on potential NULL pointer 2021-06-03 18:54:26 +08:00
2e62363446 [all] Fix uninitialized class members 2021-06-03 18:54:26 +08:00
3145a1f4de [thin_metadata_size] Fix potential string overflow 2021-06-03 18:54:26 +08:00
759407445f [thin_show_duplicates] Fix potential errors
- Fix error if no --block-sector provided
- Fix errors on pools without mappings, or zero-length file
2021-06-03 18:50:20 +08:00
75c0a3656c [thin_dump] Fix leaked shared object handle 2021-06-02 03:43:58 +08:00
041ed7858c [build] Fix customized emitter linkage 2021-06-02 00:51:39 +08:00
0004dced93 [thin_show_metadata] Fix out-of-bounds access 2021-06-02 00:51:39 +08:00
f7e4a8faa9 [all] Fix resource leaks 2021-06-02 00:51:39 +08:00
b9df99fd6a Merge pull request #173 from mingnus/2021-05-12-cache-restore
cache_restore wip
2021-06-01 09:15:38 +01:00
b12530f580 [space_map (rust)] Fix nr_allocated tracking in CoreSpaceMap 2021-05-28 20:20:30 +08:00
3a653eaa5f [thin_restore (rust)] Build metadata and data space maps 2021-05-28 03:19:42 +08:00
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
13d6c72ad9 [cache_restore (rust)] Build metadata space map 2021-05-28 03:19:42 +08:00
5ecae3ad88 [tests] Fix numeric literal annotation 2021-05-28 03:19:42 +08:00
48d4fc51ed [space_map (rust)] Factor out space_map_metadata 2021-05-28 03:19:42 +08:00
d5e6a69af6 [thin (rust)] Fix the unit of metadata_block_size in superblock 2021-05-28 03:19:42 +08:00
6a29f6a41a [cache_check (rust)] Fix discard bitset availability checking 2021-05-28 03:19:42 +08:00
ce94ba73a5 [cache_restore (rust)] First draft 2021-05-28 03:19:42 +08:00
e336b3a63f [math (rust)] Make the functions generic 2021-05-28 03:19:42 +08:00
1198a3f713 [cache (rust)] Implement Pack for superblock 2021-05-28 03:19:42 +08:00
511ae9e908 [checksum] Support cache and era superblock 2021-05-28 03:19:42 +08:00
159dda9659 [thin_restore (rust)] Tidy up with the builder pattern 2021-05-28 03:19:42 +08:00
1907dab5ee [cache (rust)] Implement Pack and Default for restoration 2021-05-28 03:19:42 +08:00
86e2db3a1a [cache (rust)] Add visitor traits for cache_restore 2021-05-28 03:19:42 +08:00
2a77036fa8 [array_builder] First draft
Not tested yet
2021-05-28 03:19:42 +08:00
a6e1870b2b [array (rust)] Implement Pack for restoration 2021-05-28 03:19:42 +08:00
7e2d69ede9 [cache_dump (rust)] Allow partially broken dirty bitset 2021-05-28 03:19:42 +08:00
db48f51049 Merge pull request #172 from mingnus/2021-05-04-thin-dump-fixes
Make thin_dump runnable
2021-05-27 19:03:05 +01:00
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
30cfcd9a88 [thin_dump (rust)] Use common leaf sequences to pack metadata 2021-05-28 00:07:32 +08:00