Commit Graph

88 Commits

Author SHA1 Message Date
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
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
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
ce94ba73a5 [cache_restore (rust)] First draft 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
30cfcd9a88 [thin_dump (rust)] Use common leaf sequences to pack metadata 2021-05-28 00:07:32 +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
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
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
Ming-Hung Tsai
239ff7dfa1 [cache_check (rust)] Add more checks
- Report errors
- Support reading partially broken bitset
  - The output is a bitmap of 2-bit entries, indicating availability of bits
2021-04-21 14:09:38 +08:00
Ming-Hung Tsai
3279d8381b [array_walker] Read multiple array blocks at once 2021-04-17 00:10:14 +08:00
Ming-Hung Tsai
c17559791f [bitset] Rename bitset module 2021-04-17 00:10:14 +08:00
Ming-Hung Tsai
1964015d81 [array_walker] Handle the whole array block at once
That gives the visitor more controls over the data processing and locking,
and also improves the performance by 10-15%.
2021-04-17 00:06:09 +08:00
Ming-Hung Tsai
95dee9f66d [cache_check (rust)] Do not remap ArrayErrors to keep the error context 2021-04-16 21:46:30 +08:00
Ming-Hung Tsai
9b4a0607ea [cache_check (rust)] Detect structural errors on arrays
- Define error types for arrays
- Propagate low-level errors to tools
- Rename array_block.rs to array.rs
2021-04-14 16:02:50 +08:00
Ming-Hung Tsai
ace9c1d1e3 [cache_check (rust)] Add more checks
- check version-2 dirty bitset size and consistency
- check discard bitset size
2021-04-11 22:48:10 +08:00
Ming-Hung Tsai
ae630f1fd8 [btree_walker] Fix error returning 2021-04-11 20:18:44 +08:00
Joe Thornber
040e3bfc2d Lot's of work on thin_restore 2021-03-24 14:20:20 +00:00
Joe Thornber
12c1c6e1f5 Merge branch 'main' into 2020-10-09-thin-restore-rewrite 2021-03-23 11:22:03 +00:00
Ming-Hung Tsai
e0eb8fea87 [btree (rust)] Show out-of-order keys 2021-03-12 12:37:07 +08:00
Ming-Hung Tsai
0ff72374f8 [btree_builder (rust)] Fix the max_entries 2021-03-12 00:42:54 +08:00
Ming-Hung Tsai
7d983e3155 [btree_builder (rust)] Fix the max_entries 2021-03-11 18:24:10 +08:00
Joe Thornber
7e869bb8e0 Code review of cache_dump/check
Added support for metadata format2 to cache_dump.  Nothing tested.
2021-03-04 11:13:08 +00:00
Joe Thornber
e6c6275aea Code review of src/pdata/array* 2021-03-03 10:27:57 +00:00
Joe Thornber
fdcc09c27e [cache_dump] Squash some clippy warnings 2021-03-03 09:48:15 +00:00
Joe Thornber
3d9b32e509 Merge branch 'main' of github.com:jthornber/thin-provisioning-tools into main 2021-02-26 15:26:33 +00:00
Joe Thornber
d4299a00d0 Make pack_node() and calc_max_entries() public for dm-unit 2021-02-26 15:25:53 +00:00
Ming-Hung Tsai
a7ecfba2b4 [cache (rust)] Fix merge conflicts 2021-02-24 20:21:10 +08:00
Joe Thornber
a4ba01cacd
Merge pull request #160 from mingnus/rust-cache-tools
First draft of cache_check in Rust
2021-02-24 09:53:51 +00:00
Joe Thornber
c3c6d37aea Fix a lot of clippy warnings 2021-02-08 10:38:21 +00:00
Ming-Hung Tsai
087a4711a5 [array (rust)] Implement array basis 2021-02-03 15:18:41 +08:00
Joe Thornber
04e0eb3a66 [thin_restore (rust)] rewrite the btree_builder
Now copes with adding shared leaves.
2020-12-09 13:22:32 +00:00
Joe Thornber
0e4622f337 [Rust tools] squash lots of warnings 2020-12-01 11:50:32 +00:00
Joe Thornber
1ae62adec6 work in progress 2020-11-18 14:33:56 +00:00