Commit Graph

1652 Commits

Author SHA1 Message Date
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 3e5de399a7 [functional tests] Remove dependency on the ThunderChez library.
I've just moved the relevant code into the functional-tests dir.
2020-04-30 12:07:42 +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 0098803345 [thinp_*] Make mtree_ref_counter derive from ref_counter.
Slight performance hit, but I'd rather everything was derived
from ref_counter.

Also implement it!  Not sure why this wasn't done before.
2020-04-08 12:24:37 +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 8db3800e2c [base/application] One of the run methods wasn't overriding 2020-04-08 12:19:06 +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
Joe Thornber ed44a1128f
Merge pull request #134 from Arusekk/issue-12
Fix compilation with uClibc
2020-03-25 15:00:28 +00:00
Arusekk 3ed3925370 Fix compilation with uClibc
Closes #12
2020-03-25 15:58:02 +01:00
Joe Thornber 47da81b6b7
Merge pull request #133 from mingnus/master
Improve performance, and remove unused code
2020-03-02 11:22:49 +00: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
Joe Thornber 70f11e0866
Merge pull request #132 from mingnus/master
Fix potential file descriptor leak and compile flags
2020-02-25 16:08:36 +00:00
Ming-Hung Tsai 57cae67ff1 [unit-tests] fix googletest compile flags
googletest now requires c++11 compiler
2020-02-23 15:41:20 +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 c85ea5ef76 [thin_check] factor out metadata_checker 2020-02-17 11:42:24 +00:00
Ming-Hung Tsai d6a8c03aa2 [btree_damage_visitor] factor out non-template functions 2020-02-17 11:42:24 +00:00
Ming-Hung Tsai e6a4ba53f0 [build] add options for gprof 2020-02-17 11:42:24 +00:00
Joe Thornber 5f2c3bed69 Add some ftests, and fixup whitespace from Nikhil's work 2019-10-28 11:52:21 +00:00
Nikhil Kshirsagar cb055c90e5 Man page changes for corrupt superblock repair 2019-10-25 15:57:51 +05:30
Nikhil Kshirsagar 91b4714e38 Corrupt superblock repair 2019-10-25 15:02:56 +05:30
Joe Thornber 0fc7529c01 [cache_repair, thin_repair] fix bug introduced in recent patch
I hadn't realised that check_file_exists() also checked that it was
a regular file, which we don't want for the couple of uses I recently
added.

This patch adds an optional arg must_be_regular_file, and defaults
it to true, preserving the original behaviour.  The recent additions
have this set to false.
2019-10-14 09:21:38 +01:00
Joe Thornber 1dd7b454bb [thin_repair, cache_repair] Check input file exists earlier
and zero superblock if we fail part way through a repair.

bz1499781
2019-10-08 14:34:24 +01:00
Joe Thornber a3b8e9db78 [thin_trim] remove all mention of --pool-inactive from man page.
This option is obsolete now that we open O_EXCL.  If used a warning message
will be output.
2019-10-07 13:32:52 +01:00
Joe Thornber 6332962ee8 [ft-lib/bcache] rename raise() -> raise_()
Name clash with signal.h on Debian and Gentoo.
2019-06-05 15:02:05 +01: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 f5acd0426d bump version 2019-06-04 10:39:59 +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 c19a05f28f bump version 2019-06-03 14:11:37 +01:00
Joe Thornber 733c7df798 [thin_repair/thin_dump] Fix some more spurious error messages when doing repair.
Repair was falling back to non-repair behaviour if it thought the roots
were ok.  Now if --repair is specified the same dumping code is always
executed.
2019-06-03 14:03:24 +01:00
Joe Thornber e45a211902 [thin/metadata_dumper] Change a couple of confusing class names.
metadata_emitter is actually a visitor that passes on it's data
to an encapsulated emitter object.

metadata_emitter -> metadata_emit_visitor
metadata_tree_emitter -> metadata_tree_emit_visitor
2019-06-03 11:07:32 +01:00
Joe Thornber a13178ffd1 Bump version 2019-05-28 09:24:22 +01:00
Joe Thornber 0624ded67f [thin_repair, thin_dump] Don't look for better roots if the ones in the sb are ok.
Calculating the most recent trees is inexact, so trees other than the ones
in the superblock, which presumably are the most recent, could be chosen.
2019-05-27 16:43:32 +01:00
Joe Thornber 5e6ddbf2da [thin_dump, thin_repair] Fix bad metadata_damage exception
The first pass of the repair process scans all metadata working out the
largest orphan btrees.  This scan doesn't use as much validation as
the btree_walk function which subsequently gets called.

This patch catches any exceptions thrown by the btree walk function
and removes that btree from consideration.
2019-05-27 16:06:59 +01:00
Joe Thornber d299cc66d1 [functional-tests/thin_dump] check no error msg with clean metadata 2019-05-27 15:38:45 +01:00
Joe Thornber acf2e6e625 [unit-tests] squash some warnings
ASSERT_THAT(), defined in google-test needs to be wrapped in braces if
it's the only statement in an if block (dangling else).
2019-05-27 09:19:14 +01:00
Joe Thornber 65264911c1 [thin_repair, thin_dump] --repair falg wasn't being passed through properly.
Recent regression.
2019-05-27 09:04:55 +01:00
Joe Thornber 9e87ad8298 bump version to 0.8.1 2019-05-03 15:19:06 +01:00
Joe Thornber 595ddfc50f [thin_repair/thin_dump] repair flag wasn't being set internally.
Introduced by recent changes
2019-05-03 15:15:01 +01:00
Joe Thornber 4bca324c9f Bump version to 0.8.0 2019-04-17 12:55:15 +01:00
Joe Thornber 9e20465fd1 [thin-repair, thin_dump] When repairing we now hunt for the best btree roots.
We've had a trickle of users who accidentally activate the same pool on a
VM and host at the same time.  Typically the host doesn't do any IO, but
the kernel will still rewrite the superblock on shutdown.  This leaves
the superblock pointing to very out of date btree roots and so we get
massive metadata loss.

This patch changes thin_repair, and thin_dump --repair.  They now hunt
for the most recent, undamaged and consistent roots of the device and
mapping trees, and use that as the starting point of the repair.
2019-04-17 12:17:13 +01:00
Joe Thornber b027a1039f [thin-provisioning] Add a new constructor for the metadata class
This one takes a superblock.  Used when repairing.
2019-04-17 12:15:46 +01:00
Joe Thornber b777a77023 [thin-provisioning] pass the tm by reference to the metadata object 2019-04-04 15:06:41 +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
Joe Thornber 95ae4fef6a [functional tests] Use dd to create zeroed files
Previously I was using fallocate, which has issues on some filesystems.
2018-12-12 13:14:09 +00:00
Joe Thornber e03b878df3 [functional tests] Move test output from /tmp to .
tmpfs has trouble with O_DIRECT.
2018-12-12 13:13:11 +00:00