Commit Graph

278 Commits

Author SHA1 Message Date
Joe Thornber
3c761e6822 [all tools] Factor out open_bm() and open_tm.
Many duplicates of this code.
2017-10-05 11:53:40 +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
Joe Thornber
209af19a02 [block manager] Don't allow the cache to be bigger than the block dev. 2017-07-24 15:28:23 +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
Joe Thornber
f2448b17ad [checksum] Switch to a faster implementation of crc32 2017-03-21 12:03:11 -04:00
Joe Thornber
73ae456175 [persistent-data/block] ::exit() if write_ref drops below zero
We were throwing before, which obviously isn't allowed in a destructor.
2017-03-13 13:18:44 +00:00
Ming-Hung Tsai
6863db6f86 [thin] fix duplicated counting of mapped blocks in restore emitter 2016-08-10 23:40:48 +08:00
Joe Thornber
52de2dd38e Merge branch 'v0.7-devel' of github.com:jthornber/thin-provisioning-tools into v0.7-devel 2016-07-11 15:51:58 +01:00
Joe Thornber
c2fdbad322 Merge branch '2016-07-07-improve-thin-repair-error-message' into v0.7-devel
Conflicts:
	Makefile.in
	VERSION
	configure.ac
	persistent-data/file_utils.cc
2016-07-11 15:51:30 +01:00
Joe Thornber
4779fb9b80 [various] Improve documentation
Output file must be preallocated.
2016-07-11 14:53:03 +01:00
Ming-Hung Tsai
7eac48793c [space map disk] tidy up: add const qualifier 2016-06-20 00:40:10 +08:00
Ming-Hung Tsai
60eb608825 [counting_visitor] fix the path for ValueCounter 2016-06-20 00:30:25 +08:00
Joe Thornber
a3eac8d5d8 Merge branch 'v0.7-devel' of github.com:jthornber/thin-provisioning-tools into v0.7-devel 2016-06-14 16:33:00 +01:00
Joe Thornber
642740e1b6 Merge branch '2016-03-08-cache-writeback' into v0.7-devel 2016-06-14 16:30:16 +01:00
Joe Thornber
b77ba14a2a [block] Use the definition of SECTOR_SHIFT from block-cache 2016-06-14 16:28:14 +01:00
Ming-Hung Tsai
2203e2b513 [btree_node_checker] tidy up the code
1. Add const qualifiers
2. Add virtual destructor
2016-05-20 00:53:35 +08:00
Joe Thornber
3c02151a4f Merge branch 'master' into v0.7-devel
Conflicts:
	persistent-data/file_utils.cc
	persistent-data/file_utils.h
2016-04-05 13:13:10 +01:00
Thanos Makatos
ab958ee752 improve error message when failing to stat block device 2016-04-06 15:56:08 +03:00
Ming-Hung Tsai
810e86e675 [counting_visitor] cleanup: remove redundant statements 2016-04-05 17:05:28 +08:00
Ming-Hung Tsai
9322fc9f14 [btree_damage_visitor] cleanup: remove redundant statements 2016-04-05 16:18:46 +08:00
Ming-Hung Tsai
1dce79bd55 [btree_damage_visitor] cleanup: use btree_node_checker 2016-04-05 16:09:58 +08:00
Ming-Hung Tsai
6dc9a90fec [counting_visitor] fix unnecessary value visiting
1. Do not inherit btree_damage_visitor to avoid unnecessary
   value visiting.
   (reverts commit b22495997a)
2. Use btree_node_checker to do node checking
2016-04-05 16:09:58 +08:00
Ming-Hung Tsai
4a4dc1a5e0 [btree_node_checker] first draft
Spin-off from btree_damage_visitor
2016-04-03 00:43:43 +08:00
Joe Thornber
2288fc4565 Merge branch 'master' into 2016-02-03-fix-thin-trim 2016-03-31 16:39:54 +01: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
8676198e76 [file_utils] rename get_nr_blocks() -> get_nr_metadata_blocks() and introduce get_nr_blocks() 2016-03-04 10:43:58 +00:00
Joe Thornber
3f6cae4ebc [persistent-data] persistent-data/data-structures/btree_key_value_extractor.h doesn't appear to be used
So remove
2016-02-29 11:12:50 +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
d068ec8082 Add utility class binary_block_counter 2016-02-27 15:22:09 +08:00
Ming-Hung Tsai
b22495997a Allow counting_visitor to work with damaged btrees 2016-02-27 15:22:00 +08:00
Ming-Hung Tsai
ad03114bf7 Add utility class btree_detail::key_value_extractor 2016-02-27 15:21:44 +08:00
Ming-Hung Tsai
c571a08f6c Add utility class btree_detail::noop_value_visitor 2016-02-27 15:21:32 +08:00
Ming-Hung Tsai
a48227188e Add utility class btree_detail::noop_damage_visitor 2016-02-27 15:21:23 +08: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
Ming-Hung Tsai
d2260dee34 Show the block address in exception string 2016-02-27 15:04:08 +08:00
Ming-Hung Tsai
b1d4b9f7c8 Show the block address of error nodes 2016-02-27 15:04:08 +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
a5a53648c9 Merge branch '2015-08-19-thin-show-duplicates' into merge-thin-ls
Conflicts:
	Makefile.in
	block-cache/block_cache.h
	main.cc
	thin-provisioning/commands.h
2016-02-24 14:31:51 +00:00
Joe Thornber
20398f4209 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2016-02-04 13:25:13 +00:00
Ming-Hung Tsai
febe80f4bb [damage_visitor] update path_tracker in error_accessing_node() 2015-11-27 23:31:12 +08:00
Joe Thornber
25f4f23e42 [file_utils] fix bug in get_nr_blocks.
Introduced in previous patch
2015-08-19 12:44:07 +01:00
Joe Thornber
59a622670c [thin_show_duplicates] wip 2015-08-19 12:32:57 +01:00
Joe Thornber
71aea2efcc add btree_disk_structures.h 2015-08-13 14:28:07 +01:00
Joe Thornber
8fab56680c [all tools] Improve the error message if opening the metadata fails.
Remind the admin that you shouldn't run the tools on live data.
2015-08-13 12:57:07 +01:00
Joe Thornber
c32aaab028 [validators] Move the btree node validator into a separate file. 2015-08-11 11:58:07 +01:00
Joe Thornber
b67cc29609 [btree] bad checksum exceptions now mention the block location 2015-08-04 15:12:41 +01:00
Joe Thornber
642ae6e7c2 Tools now open the metadata device in O_EXCL mode.
An attempt to stop people running the tools on active metadata.
2015-07-07 13:47:00 +01: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
c8d8af488f [btree] When using lower_bound() assign to an int rather than unsigned
Patch from Ming-Hung Tsai
2015-05-26 14:24:55 +01:00
Joe Thornber
cf903cfea6 [btree] lower bound search should return an empty optional if every entry in the node is higher.
Patch from Ming-Hung Tsai
2015-05-26 14:09:29 +01:00
Joe Thornber
880785a9bf [damage_tracker] Reset the tracker in the end() method so we can reuse it.
The *_check tools already reuse trackers.

Patch from Ming-Hung Tsai.
2015-05-26 12:49:27 +01:00
Joe Thornber
85d1701ba1 [btree_damage_visitor] Check the value_size agrees.
Patch from Ming-Hung Tsai
2015-05-26 12:06:34 +01:00
Joe Thornber
9de2b26c25 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2015-04-13 16:57:14 +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
25b4b526f4 Introduce error_string() as a portable replacement for strerror_r() 2015-01-16 12:54:09 +00: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
bd2c0df226 Fix this error:
persistent-data/data-structures/bloom_filter.cc:10: error: integer constant is too large for 'unsigned long' type

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2015-01-16 10:15:01 +00:00
Alexander Holler
92345b4b64 [persistent-data/space_map.h] Make destructor for space_map_detail::damage public
The compiler is unable to create a default desctructor for the derived
class missing_counts if the virtual destructor for the class damage is
private.

This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with
gcc 4.8.3 and boost 1.55.
2014-11-15 16:48:53 +01:00
Joe Thornber
5fe9039d38 squash another compiler warning 2014-09-08 11:07:46 +01:00
Joe Thornber
93468190bd [bitset] When reopening a bitset some bits could be lost at the far end.
The number of words necessary to store the bits was being miscalculated.
2014-09-01 14:17:44 +01:00
Joe Thornber
14cfcf2dfd [bitset] Don't visit bits in the tail end of the final word if they're beyond the nr bits in the bitset.
Also shift 1ULL in the test.
2014-09-01 14:16:03 +01: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
930cc9d412 [block-manager] Superblocks weren't being marked as DIRTY
Gulp
2014-08-21 14:25:02 +01:00
Joe Thornber
0d3942cae8 [block-manager] ensure the superblock cannot be taken concurrently with any other lock. 2014-08-21 12:18:05 +01:00
Joe Thornber
feb8a03d5f [btree_damage_tracker] Initialise all path_tracker objects with a null path.
This fixes an insidious bug that took me ages to track down.  Without
it the non-existent front() of a list was sometimes being accessed.
2014-08-21 11:25:07 +01:00
Joe Thornber
6f804cab24 [block_manager] Track the number of superblocks, throw an exception if someone tries to open two a once. 2014-08-21 11:17:20 +01:00
Joe Thornber
74de9a1a94 [btree_damage_visitor] some tweaks to stop constructing so many btree_paths. 2014-07-30 12:21:34 +01:00
Joe Thornber
f06a2673c5 wip 2014-07-29 11:34:26 +01:00
Joe Thornber
5c82d50204 remove some debug 2014-07-28 14:32:20 +01:00
Joe Thornber
840be1b6c9 wip 2014-07-28 14:13:28 +01:00
Joe Thornber
ab6d31f136 fluff 2014-07-25 17:53:37 +01:00
Joe Thornber
ecb6bee2b2 prefetch btree nodes when walking a tree 2014-07-25 16:32:59 +01:00
Joe Thornber
11469a2fda Beginning to work 2014-07-25 16:14:24 +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
9470937b10 [btree] When creating a new multilayer btree the initial node should
have block_traits, rather than the ValueTraits.
2014-07-02 15:02:32 +01:00
Joe Thornber
e77e8715b0 Remove ambiguity between boost::uint64_t and ::uint64_t.
This has been causing people problems on uclibc builds.
2014-07-02 08:19:20 +00:00
Joe Thornber
d3687db3a8 [bloom filter] remove an unused data member 2014-06-26 15:26:39 +01:00
root
cb6edde141 add comment 2014-06-16 13:41:45 +01:00
Joe Thornber
ae21670fd1 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2014-06-06 15:06:33 +01:00
Joe Thornber
256cd16ab3 node_ref now checks the value_type sizes match, and the data fits within a single block. 2014-06-06 15:05:41 +01:00
Joe Thornber
82359c4835 remove a typename that rhel 6.6 objects to 2014-04-11 14:52:06 +01:00
Joe Thornber
47ec37a9fd [thin tools] fix ambiguous reference to 'bitset' 2014-04-01 16:39:45 +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
Joe Thornber
8531a2befa [era] switch from bloom filters to writesets 2014-01-29 21:37:25 +00:00
Joe Thornber
9e0540e1b6 era_check, era_dump 2014-01-23 00:46:03 +00:00
Joe Thornber
be5fa59f90 Merge branch 'era' of github.com:jthornber/thin-provisioning-tools into era 2014-01-08 10:50:26 +00:00
Joe Thornber
1b1df2fe65 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2014-01-08 10:43:20 +00:00
Joe Thornber
8049d369a9 stuff 2013-12-11 17:28:14 +00:00
Joe Thornber
927f611aad remove btree_checker, and add btree_counter 2013-12-11 17:00:57 +00:00
Joe Thornber
7224639d14 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2013-12-09 12:47:26 +00:00
Joe Thornber
7a2c41022f Remove some 'typename's since older versions of g++ don't like. 2013-12-09 12:46:46 +00:00