Commit Graph

278 Commits

Author SHA1 Message Date
Ming-Hung Tsai
c496e8a4c8 [btree] Remove FIXMEs 2021-03-25 16:42:36 +08:00
Ming-Hung Tsai
8bfe7ee6f3 [btree] Fix rebalancing checks 2021-03-25 15:06:52 +08:00
Ming-Hung Tsai
61f07573e1 [metadata_counter] Count under populated nodes if the option is provided 2020-11-24 18:18:21 +08:00
Ming-Hung Tsai
3c49949796 [space-maps/disk] Support ignoring broken bitmaps on counting index_store 2020-08-17 22:57:26 +08:00
Ming-Hung Tsai
27ca8cc009 [block_counter] Add block_counter::clear() 2020-08-17 15:43:09 +08:00
Ming-Hung Tsai
de843991e3 [transaction_manager] Add transaction_manager::commit()
It should be called by metadata::commit() and reserve_metadata_snap()
(issue #73)
2020-08-17 15:43:04 +08:00
Ming-Hung Tsai
6c90f9483e [metadata_checker] Support in-place metadata space map modification 2020-08-12 16:57:16 +08:00
Ming-Hung Tsai
0349e9c9e2 [space-maps/disk] Show the block address in exception string 2020-08-12 16:57:16 +08:00
Ming-Hung Tsai
12725983db [block_counter] Add the stop-on-error option to prevent silent errors
The stop-on-error option aims to solve the lack of damage_visitor support
in space_map::count_metadata and btree counting_visitor. To prevent
possibly silent errors during space map or btree counting, the option
stops the counting process immediately when a btree or bitmap error
was found.

The bitmap blocks are also validated to avoid potential false-alarm,
if broken bitmap is not counted, and the corresponding ref-count is
also zeroed.
2020-08-12 15:56:26 +08:00
Ming-Hung Tsai
7c3145633b [space-maps/core] Fix the search start position 2020-08-10 20:39:22 +08:00
Ming-Hung Tsai
e62022a200 [base] Move run_set to namespace base 2020-07-29 15:33:25 +08:00
Joe Thornber
fec11289b0 [thin_check/dump] Under populated nodes are now 'non fatal errors'
thin_dump always ignores non-fatal-errors.
2020-07-02 16:03:23 +01:00
Ming-Hung Tsai
cf127f3471 [btree] Fix reference counts of children below a shadow 2020-06-30 17:24:55 +08:00
Ming-Hung Tsai
4f8466c489 [btree] Fix parent key index for the new shadow 2020-06-30 17:22:47 +08:00
Ming-Hung Tsai
5260a87c0b [base] Move math_utils to namespace base 2020-06-19 18:07:55 +08:00
Ming-Hung Tsai
e724a72045 [btree] Implement btree::remove() 2020-06-19 18:07:55 +08:00
Ming-Hung Tsai
f803c44e93 [btree] Implement btree::destroy() to delete the entire tree
Also decrease the reference count of the mapped values.
(e.g., bitmap blocks of btree_index_store)
2020-06-19 18:07:55 +08:00
Joe Thornber
0ab509578f [*_check] Remove the inane "This is not the btree you are looking for." message. 2020-06-11 13:05:03 +01:00
Ming-Hung Tsai
86139cf6bd [sm_recursive] Fix atomicity when applying BOPs
Any BOP should be taken only once. Therefore, we should remove BOPs
that are being processed or had been processed from the uncommitted
list.
2020-05-28 17:30:15 +08:00
Joe Thornber
4cdffafe88 [sm_recursive] Fix bug that allowed the same block to be allocated twice.
See issue 70.  Soln from mingnus.
2020-05-28 17:30:15 +08:00
Joe Thornber
128ecc27f2 [space-maps] remove count_possibly_greater_than_one
This is only ever called with a recursive space map wrapper,
and that causes too many false positives.  False positives trigger
a copy of a metadata page, so this is a false economy.
2020-05-28 07:38:58 +01:00
Joe Thornber
29cfdd8979 [space-maps/core] rewrite the core space map to use less memory. 2020-05-27 12:00:40 +01:00
Joe Thornber
371d1bbd6e [space-maps/recursive] fix bug in flush_ops()
Decrements weren't being passed down properly.
2020-05-26 09:24:15 +01:00
Joe Thornber
50f8e792d3 [space-map] Make the version of inc/dec that take a count the only one. 2020-05-26 09:12:45 +01:00
Joe Thornber
cc806a0daa [space-maps/disk] add implementation for the variant of inc/dec that take a count 2020-05-26 08:57:13 +01:00
Joe Thornber
12b6157c5b [space-maps/recursive] lift a lock, and add a lock 2020-05-26 08:45:35 +01:00
Joe Thornber
0e54de95e1 [space-maps/recursive] Remove some code duplication. 2020-05-26 08:38:05 +01:00
Joe Thornber
65fcda062f [space-maps/recursive] Aggregate the BOPs 2020-05-26 08:30:52 +01:00
Joe Thornber
2ed089a83f [space-map] Add new virtual methods to inc or dec by a specific amount.
Provide default implementation that just loops
2020-05-26 08:29:52 +01:00
Joe Thornber
5e6eec1bb0 [recursive space map] switch to new form 'for' statements 2020-05-26 07:49:26 +01:00
Joe Thornber
4313469475 [all] Switch from boost::shared_ptr -> std::shared_ptr.
Shared_ptr has moved into the standard library since these tools were
first written.
2020-04-30 15:02:43 +01:00
Joe Thornber
e801cc607b [block_manager] Hard code block size to 4k.
We're never going to use anything other than 4k, and by hard coding it we
avoid making block_manager a template.
2020-04-30 14:30:01 +01:00
Joe Thornber
ad79b627a4 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2020-04-08 12:30:26 +01:00
Joe Thornber
ed22bfcdda [space-map-disk] Add virtual destructor to index_store.
Bug. Cleaning up index stores would not be correct.
2020-04-08 12:23:28 +01:00
Joe Thornber
1481ed0f8a [ref_counter] Make ref_counter an abstract base class.
Forces people to override correctly.

Also make no_op_ref_counter final.
2020-04-08 12:22:28 +01:00
Joe Thornber
501299a4ee [cache_*] array ref_counter wasn't overloaded correctly.
Major bug, explains some space map issues I've seen when
restoring cache metadata.
2020-04-08 12:19:55 +01:00
Joe Thornber
0ccee1759e [various] Squash a couple of clang warning wrt friend declarations. 2020-04-08 12:18:24 +01:00
Joe Thornber
5e347dddbf [various] remove dead code.
Squashes warnings from clang++
2020-04-08 12:12:59 +01:00
Ming-Hung Tsai
7a1c6dc4bf [space-map-disk] improve performance of finding a free bitmap entry
* Simply test the raw bitmap entries against zero, to avoid
  time-consumed reference-count value extraction.

* Improve the way of iterating entries inside a bitmap:
  Extract 64-bit of bitmap entries at once, and use bitwise shift
  to iterate through the entries.
2020-02-29 17:39:17 +08:00
Ming-Hung Tsai
cb0a77e2ae [block-manager] remove unused copy-assignment operator
block_cache::block is non-copyable, and so are the containing structures.
2020-02-29 00:29:01 +08:00
Ming-Hung Tsai
955e11bc28 [block-cache] fix potential file descriptor leak
Encapsulate file descriptor into an object, to ensure that an fd will be
closed properly while exception raised, e.g., the block_cache throws
exception during the block_manager's construction.
2020-02-23 15:41:16 +08:00
Ming-Hung Tsai
d6a8c03aa2 [btree_damage_visitor] factor out non-template functions 2020-02-17 11:42:24 +00:00
Joe Thornber
5e5409f48b [space-map/noop] Be explicit about returning an optional
Needed for older version of g++
2019-06-05 11:07:28 +01:00
Joe Thornber
7be9be1494 [space-maps/noop] Add the noops space map
Used when we know we're npt modifying the metadata.
2019-06-04 10:38:58 +01:00
Joe Thornber
aace49cdd6 [thin_repair] work in progress 2019-03-29 12:56:31 +00:00
Ming-Hung Tsai
8abac422b2 [space-map-disk] fix the search range (#117) 2019-01-03 10:46:35 +00:00
Ming-Hung Tsai
788f507e46 [run_set] fix invalid iterator operations (#113) 2018-09-05 11:21:09 +01:00
Ming-Hung Tsai
4b08c7793d [space map] fix accounting of allocatable blocks (#98)
Preserve the input block first to avoid reusing it in subsequent
shadow operations, e.g., shadow another block when releasing
a recursive lock. (issue #97)
2018-06-07 07:45:37 +01:00
Ming-Hung Tsai
582e424560 [space-map-disk] fix the number of free blocks (#93) 2018-04-17 14:00:44 +01:00
csonto
5b5aa971a0 Detect XML in *_check tools (#86)
* [*_check] Detect XML in cache_check and era_check

This is based on previous commit b10d8d4440.

* [*_check] Fix typo in check_superblock
2017-10-05 13:47:10 +01:00