Commit Graph

279 Commits

Author SHA1 Message Date
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
Joe Thornber
9a65e7707c Merge branch 'master' of github.com:jthornber/thin-provisioning-tools into era 2013-12-09 10:42:28 +00:00
Joe Thornber
7a2d43268d [array] damage reported if the array is smaller than claimed in the ctr 2013-12-03 15:04:16 +00:00
Joe Thornber
983a5e84e6 Move endian_utils to base/ 2013-11-19 10:23:35 +00:00
Joe Thornber
180f7e6187 persistent-data/data-structures/bloom_filter 2013-11-18 13:08:07 +00:00
Joe Thornber
9402f09408 [bitset] tweak an exception message 2013-11-18 13:07:21 +00:00
Joe Thornber
b32a3b9fb9 [bitset] get_nr_bits() method 2013-11-18 13:07:08 +00:00
Joe Thornber
fd061fab15 [bitset] change the name of the #include guard 2013-11-18 13:06:35 +00:00
Denys Duchier
3a4c06b772 use persistent-data::bitset to avoid ambiguity 2013-11-16 21:42:23 +01:00
Heinz Mauelshagen
d2b30b0eac Fix bz#960284: thin_dump and other persistent-data tools may perform IO to misaligned buffers (on 4K hard sectored evices) 2013-10-30 14:12:41 +01:00
Joe Thornber
dd65089b68 sort out some #includes 2013-10-23 11:39:31 +01:00
Joe Thornber
0fe7dddd8a whitespace 2013-10-15 10:51:35 +01:00
Joe Thornber
ea15a329d7 [cache_check] Now checks discard bitset 2013-10-11 10:22:02 +01:00
Joe Thornber
9b5bf559ec [persistent-data/data-structures] add method to visit values and damage in a bitset 2013-10-10 12:55:10 +01:00
Joe Thornber
347de67e2d [persistent-data/data-structures/bitset] Use pimpl idiom to hide implementation. 2013-10-10 12:17:34 +01:00
Joe Thornber
e7816d2f43 [block] Open block files with O_DIRECT | O_SYNC.
Putting this back in.  Dumping metadata snapshots fails without.  So
there's more caching in the kernel than I expected.
2013-10-07 09:58:17 +01:00
Joe Thornber
ce8e19fa75 remove old fixme 2013-10-02 11:08:09 +01:00
Joe Thornber
3bc798c1f8 [array] wire up the correct validator 2013-10-02 11:07:33 +01:00
Joe Thornber
326134a7aa [array] add visit method for values and damage 2013-10-02 10:44:57 +01:00
Joe Thornber
17f7c982f2 [caching] hint support 2013-09-24 12:00:09 +01:00
Joe Thornber
c476de1756 [cache_restore] more wip 2013-09-18 13:00:26 +01:00
Joe Thornber
14122d6875 Move check_file_exists() to file_utils.{h,cc} 2013-09-16 13:42:39 +01:00
Joe Thornber
6615b25e4b WIP on cache tools 2013-09-11 11:40:46 +01:00
Joe Thornber
500e508c6d fix up some coverity issues 2013-08-15 16:26:17 +01:00
Joe Thornber
77286e0bc7 Take out some 'typename's to support older versions of gcc (Heinz). 2013-08-15 10:35:07 +01:00
Joe Thornber
c6ec0c9c9c Older versions of boost don't have BOOST_STATIC_ASSERT_MSG 2013-08-08 15:08:51 +01:00
Joe Thornber
0029962f20 Give up with --std=c++11
There are too many distros that use old versions of g++ that don't support it adequately.
2013-08-08 10:49:59 +01:00
Joe Thornber
4deb1751a6 stop using O_DIRECT until the cach does async io 2013-07-09 16:52:31 +01:00
Joe Thornber
8b1a284ad4 remove old FIXME 2013-07-09 14:40:16 +01:00
Joe Thornber
fa657beff6 [run_set] use lower_bound to skip preceeding entries more quickly. 2013-07-09 13:55:21 +01:00
Joe Thornber
311034f771 [subtracting_span_iterator] recode using run_set 2013-07-09 11:25:09 +01:00
Joe Thornber
8523314a7f [run_set] improve run merging 2013-07-09 10:36:30 +01:00
Joe Thornber
31686fbb17 run_set.negate() 2013-07-08 23:21:48 +01:00
Joe Thornber
3be8376256 run_set 2013-07-08 21:44:09 +01:00
Joe Thornber
730f3b9f9a Get unit-tests building with g++ 4.8.1 2013-06-25 14:18:38 +01:00
Joe Thornber
eb8d4c6f0b Get tools building with g++ 4.8.1 2013-06-25 13:48:02 +01:00
Joe Thornber
83a09e1a2a [btree] use a block_ref_counter for internal nodes 2013-06-20 14:29:48 +01:00
Joe Thornber
e89d81e318 [btree] fix bug in earlier patch. inc_children was always begin called. 2013-06-20 14:26:17 +01:00
Joe Thornber
16c9efc85c [btree] Avoid an extra shadow op in split_sibling 2013-06-20 12:17:59 +01:00
Joe Thornber
c8a5d0753d [btree] factor out inc_children 2013-06-20 12:17:16 +01:00
Joe Thornber
a2e51062e3 [btree] call inc_children when shadowning a btree node. 2013-06-19 17:20:12 +01:00
Joe Thornber
ec99e6fd93 [btree] update the root_ after an insert
!!!
2013-06-19 17:19:24 +01:00
Joe Thornber
a8585f1d68 Use full paths in some includes 2013-06-19 17:18:39 +01:00
Joe Thornber
df016f07a7 [space map disk] Add a bounds check when accessing block data.
This means we get a more helpful message in the exception.
2013-06-14 15:36:01 +01:00
Joe Thornber
480e94d4eb Remove some more global using namespaces 2013-05-28 13:53:23 +01:00
Joe Thornber
6706493304 Remove some global 'using namespace's 2013-05-28 13:48:10 +01:00
Joe Thornber
ac73593c15 [btree_damage_visitor] tweak a typedef 2013-05-28 13:00:30 +01:00
Joe Thornber
8253930cdd [run] define some more constructors 2013-05-28 12:59:17 +01:00
Joe Thornber
e64dda95f6 rename range<> -> run<> 2013-05-28 12:20:05 +01:00
Joe Thornber
83d6b609eb [range.h] rename to run.h 2013-05-28 11:51:44 +01:00
Joe Thornber
bde2b2b40d [range.h] Make ctr explicit 2013-05-28 11:48:12 +01:00
Joe Thornber
12d6b8a2a7 [btree_damage_visitor] Make sure the path for a value includes it's key. 2013-05-23 14:37:24 +01:00
Joe Thornber
553f73b826 superblock_checker.* -> superblock.*, remove metadata_disk_structures.* and rearrange namespaces a bit. 2013-05-21 12:46:07 +01:00
Joe Thornber
49587a7577 Forgot to commit btree_damage_checker.cc 2013-05-21 11:45:10 +01:00
Joe Thornber
fcb617f858 device_tree 2013-05-20 16:09:13 +01:00
Joe Thornber
1ee8afd814 [btree_damage_visitor] fluff 2013-05-20 13:15:51 +01:00
Joe Thornber
d7c1eabfc0 [btree_damage_tracker] track the paths 2013-05-20 12:31:47 +01:00
Joe Thornber
d3fa4102c2 [btree_damage_visitor] pass the btree_path to both the damage and value visitors. 2013-05-17 12:05:13 +01:00
Joe Thornber
38dcde0c37 [btree_damage_visitor] Introduce a DamagedKeys matcher in the tests. 2013-05-17 11:42:55 +01:00
Joe Thornber
08b2749191 Remove level from btree_details::damage 2013-05-17 11:35:46 +01:00
Joe Thornber
f016161e9a [btree_damage_visitor] Hide this behind a utility function btree_visit_values(). 2013-05-17 11:29:34 +01:00
Joe Thornber
7f3a269757 [range] contains method. 2013-05-17 11:14:12 +01:00
Joe Thornber
b98dac8978 [btree] introduce a btree_path typedef 2013-05-17 10:58:34 +01:00
Joe Thornber
49da293be9 [test-utils] Make a template for outputting any optional. 2013-05-17 10:54:45 +01:00
Joe Thornber
b0d1fa0851 Sanitise btree_detail::node_location 2013-05-15 13:37:30 +01:00
Joe Thornber
224ef1f429 switch to -std=c++11 2013-05-14 15:37:57 +01:00
Joe Thornber
88c63f620f Lots of work on the btree_damage_visitor 2013-05-13 12:36:57 +01:00
Joe Thornber
0dba0abe88 Bump up the nr of blocks in the cache from 64 to 1024. 2013-05-13 12:34:52 +01:00
Joe Thornber
08c5fde04f btree_damage_tracker 2013-05-13 11:27:38 +01:00
Joe Thornber
42a4221499 A little optimisation for the core space map. 2013-05-09 14:09:47 +01:00
Joe Thornber
8ecf2f27ed btree_damage_visitor stuff. 2013-05-09 13:31:04 +01:00
Joe Thornber
ab66e9f8e3 Some more work on btree_damage_visitor 2013-05-08 16:38:38 +01:00
Joe Thornber
a7adefbae8 Move range.h to persistent-data 2013-05-08 16:38:04 +01:00
Joe Thornber
23ef3b387d Start btree_damage_visitor. 2013-05-08 12:00:24 +01:00
Joe Thornber
bac19b3c94 [btree_checker] no longer need to check the checksum, since the block validator has already done this. 2013-05-07 15:47:43 +01:00
Joe Thornber
44d0b1903f [btree] allow visitors to trap node access failures such as checksum error. 2013-05-07 15:22:13 +01:00
Joe Thornber
8e0271b3bf [btree] When walking a btree use a validator when taking the locks.
We really can't rely on anything in the block if the checksum is
wrong.
2013-05-07 14:54:20 +01:00
Joe Thornber
a828cde96d [btree] visitor now passed as a reference rather than shared_ptr 2013-05-02 12:31:33 +01:00
Joe Thornber
e1c5d485eb Tidy up a typedef 2013-05-01 16:29:44 +01:00
Joe Thornber
5d0b23beea Some btree visitor tidying.
Introduce node_location to replace the long list of parameters.  Also
add a depth field to keep track of the depth from root.
2013-05-01 16:16:23 +01:00
Joe Thornber
a7c0b0c39b [block, lock_checker] add an is_locked() method for use in unit tests. 2013-04-29 12:31:30 +01:00
Joe Thornber
b1e0ca2207 [block] make sure we can change validators 2013-04-26 15:54:15 +01:00
Joe Thornber
5367631c8c [various data structures] Reuse validators rather than always creating a new one. 2013-04-26 14:15:20 +01:00
Joe Thornber
53ac7b8119 [block_manager] Allow people to change the validator for a block 2013-04-26 14:14:28 +01:00
Joe Thornber
0b4c359a63 [block manager] The dirty flag for blocks was never being cleared, causes redundant writes. 2013-04-26 13:18:24 +01:00
Joe Thornber
d8a208cbc8 A stack of space map tweaks.
new_block() is now a concrete method implemented using the virtual
find_free() and inc() methods.

recursive space map is better at giving correct reference counts.
2013-04-23 10:57:47 +01:00
Joe Thornber
4cb19a06ba Pull subtracting_span_iterator out into separate file + test. 2013-04-22 13:41:34 +01:00
Joe Thornber
0a70c17268 Convert bitset_t to gmock 2013-03-22 14:36:31 +00:00
Joe Thornber
f9bf18adf6 Move array_t to gmock 2013-03-22 13:42:20 +00:00
Joe Thornber
c044c2c729 Convert buffer_t to gmock. 2013-03-22 12:04:38 +00:00
Joe Thornber
12dff31358 bitset 2013-03-14 13:13:18 +00:00
Joe Thornber
add23c1709 Array data structure 2013-03-13 13:28:03 +00:00
Joe Thornber
3c54e2b23a Updates to array_block 2013-03-13 12:59:11 +00:00
Joe Thornber
11a41c4cf4 Pull ref_counter out of btree.h 2013-03-13 12:58:05 +00:00
Joe Thornber
7d18b08b91 rename NoOpRefCounter -> no_op_ref_counter 2013-02-01 14:49:26 +00:00
Joe Thornber
4eadd9438e add fixme 2013-02-01 12:01:23 +00:00
Joe Thornber
5aaa710b53 [data-structures] array_block 2013-02-01 12:00:49 +00:00
Joe Thornber
92d70ad9c2 [block] read and write refs defined BLOCK_SIZE 2013-02-01 11:55:46 +00:00
Joe Thornber
0f3a9cc567 Merge remote-tracking branch 'github-heinz/Work' into heinz
Conflicts:
	unit-tests/buffer_t.cc
2013-01-29 11:40:56 +00:00
Joe Thornber
7a6d09866a [array] add array_t 2013-01-29 11:35:37 +00:00