Commit Graph

74 Commits

Author SHA1 Message Date
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
Ming-Hung Tsai
5260a87c0b [base] Move math_utils to namespace base 2020-06-19 18:07:55 +08: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
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
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
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
Ming-Hung Tsai
8abac422b2 [space-map-disk] fix the search range (#117) 2019-01-03 10:46:35 +00: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
Ming-Hung Tsai
591f725232 [space map disk] reduce the lock counts to speed up free block searching (#84)
Avoid repetitively acquiring/releasing the bitmap while finding a free block
2017-09-04 18:05:19 +01:00
Joe Thornber
467be1a69e Add some std namespaces to get tests building.
I guess a rogue header had previously been using the std namespace.
2017-07-24 15:40:17 +01:00
Ming-Hung Tsai
b7d418131d Spin-off syscall-related file operations (#78)
* [file_utils] spin-off syscall-related file operations

1. Eliminate the potential circular dependency between
   persistent-data/block.h and persistent-data/file_utils.h,
   if the former one wants to include the latter.
2. Avoid namespace pollution by removing the "using namespace std"
   declaration in block.tcc.
3. Correct the header hierarchy: base/xml_utils.h now no longer
   depends on the higher-level persistent-data/file_utils.h

* [file_utils] support block files in get_file_length()
2017-04-29 18:51:52 +01:00
Joe Thornber
8f25e1b234 [space-map-disk] optimise updating a ref count 2017-04-11 11:59:49 +01:00
Joe Thornber
db44b5b928 [space-map-disk] Keep track of the allocated prefix so we can start searching in a better place. 2017-04-11 09:40:08 +01:00
Ming-Hung Tsai
7eac48793c [space map disk] tidy up: add const qualifier 2016-06-20 00:40:10 +08:00
Joe Thornber
8b2ec7a3aa Merge branch 'master' into v0.7-devel
Conflicts:
	VERSION
	persistent-data/space-maps/disk.cc
	persistent-data/space-maps/disk.h
2016-03-22 12:04:51 +00:00
Joe Thornber
a21f97e405 [space map disk] Add get_nr_blocks_in_data_sm()
which just uses the root
2016-03-21 17:16:41 +00:00
Joe Thornber
286f70ceac Merge remote-tracking branch 'remotes/github-m-h-tsai/v0.6.2-repairtool' into 2016-02-29-mingus-merge
Conflicts:
	Makefile.in
	VERSION
	thin-provisioning/commands.cc
	thin-provisioning/commands.h
	thin-provisioning/thin_delta.cc
2016-02-29 10:29:28 +00:00
Ming-Hung Tsai
778c153c1e [block-cache] Add check_raw() to bcache::validator 2016-02-27 15:21:13 +08:00
Ming-Hung Tsai
45e9916428 Expose validator creation interface 2016-02-27 15:21:05 +08:00
Joe Thornber
0349956015 Merge branch 'low_level_examine_metadata' into merge-show-blocks
Conflicts:
	.gitignore
	Makefile.in
	persistent-data/space-maps/disk.cc
2016-02-24 15:24:43 +00:00
Joe Thornber
c6844dc7e6 [metadata space map] Restrict space map size
Previously it would crash with v. large metadata areas.
2015-06-24 16:32:17 +01:00
Joe Thornber
34df640d8d [metadata space map] index bitmap root wasn't being counted in count_metadata() 2015-04-08 12:32:00 +01:00
Joe Thornber
ee200ba85b Merge branch 'master' into space-map-checking 2015-04-07 12:18:23 +01:00
Joe Thornber
f25e0ca6d3 g++-4.2 and older doesn't accept binary constants.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2015-01-16 10:15:55 +00:00
Joe Thornber
a7c96c0e1e [everything] Fix circular shared pointer references.
We had a cycle from transaction_manager <-> space_map, and also from
the ref_counters back up to the tm.

This prevented objects being destroyed when various programs exited.

From now on we'll try and only use a shared ptr if ownership is
implied.  Otherwise a reference will be used (eg, for up pointers).
2014-08-26 11:14:49 +01:00
Joe Thornber
5c82d50204 remove some debug 2014-07-28 14:32:20 +01:00
Joe Thornber
7e870ea5a6 start removing block_manager<>::block 2014-07-25 14:46:51 +01:00
Joe Thornber
b32908d5c2 work in progress 2014-07-25 10:35:04 +01:00
Joe Thornber
d517684c95 Initial code drop for merging block_cache 2014-07-22 16:41:39 +01:00
Joe Thornber
9f6546f621 put space map checking back in 2014-02-19 16:08:05 +00:00
Joe Thornber
38f8195a99 thin_show_blocks 2014-02-19 15:01:07 +00:00