Commit Graph

1619 Commits

Author SHA1 Message Date
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
Joe Thornber
cc56214eb8 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2018-12-12 10:25:52 +00:00
Joe Thornber
207ef304c3 [era/restore_emitter] remove a noop
Pointless self assignment.  Value in suerpblock does get assigned properly.
2018-12-12 10:23:35 +00:00
kypiching
299a45cc7d Update bcache.c (#115)
including the <stdint.h> twice. delete one.
2018-11-12 08:18:48 +00:00
Joe Thornber
d1a41d01cc [thin-check] print out some info fields.
These are consumed by lvm.
2018-11-09 12:43:21 +00:00
Joe Thornber
5a309dd3bd Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2018-11-09 11:18:27 +00:00
Joe Thornber
de7c9a5781 [thin_journal_check] Checks journal of block manager activity.
You need to apply doc/bm-journal.patch to create the journal.

thin_journal_check confirms that if the machine had crashed at any time
during the test run no metadata corruption would have occured.
2018-09-24 14:51:46 +01:00
Ming-Hung Tsai
788f507e46 [run_set] fix invalid iterator operations (#113) 2018-09-05 11:21:09 +01:00
Joe Thornber
70cdfe12a2 [thin_journal_check] first code drop 2018-08-28 13:12:20 +01:00
Ming-Hung Tsai
9837feaee5 [thin_scan] refactoring and performance improvement (#111) 2018-08-15 07:56:45 +01:00
Joe Thornber
a512b8754b Revert "fix compile failed with libc musl (#103)"
This reverts commit 9311aa6483.
2018-08-02 07:12:22 +01:00
hongxu-jia
9311aa6483 fix compile failed with libc musl (#103)
There is a failure while compiling with libc musl:
[snip]
|./block-cache/io_engine.h:18:17: error: expected
unqualified-id before numeric constant
|  unsigned const PAGE_SIZE = 4096;
[snip]

The musl defeines macro PAGE_SIZE, undef it conditionally
could fix the issue.

http://musl.openwall.narkive.com/tO8vrHdP/why-musl-define-page-size

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2018-08-01 07:10:26 +01:00
Joe Thornber
82ff03e5c1 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2018-06-21 10:11:27 +01:00
Joe Thornber
68284c12a8 Merge branch '2018-04-25-thin-discard-bug' 2018-06-21 10:11:21 +01:00
Joe Thornber
498057d00e ft-lib: add discard() 2018-06-21 10:06:01 +01:00
Joe Thornber
cfe421ab8b Merge commit '570e11b2da6ee55bc755f5211cf80c4f942b4644' 2018-06-13 16:58:07 +01:00
Joe Thornber
570e11b2da [dmtests] Add failing test thin/discard/recover-space
See bz1563697
2018-06-13 16:54:36 +01:00
Joe Thornber
b6ba3a070d [restore_emitter] squash a strncpy warning 2018-06-13 12:50:48 +01:00
Joe Thornber
af785461e9 [build] [CXX] -> [CC] for C files 2018-06-13 12:49:57 +01:00
Joe Thornber
80e046a7df [build] support separate build directories 2018-06-13 09:34:14 +01:00
Joe Thornber
c1e6adc72c [build] support separate build directories 2018-06-13 09:33:25 +01:00
Dennis Schridde
1311447a94 [build] Include boost/optional/optional_io.hpp in thin-provisioning/emitter.h (#102)
This fixes following build failure with Boost 1.67.0:
```
In file included from /usr/include/boost/optional/optional.hpp:33,
                 from /usr/include/boost/optional.hpp:15,
                 from ./thin-provisioning/emitter.h:23,
                 from contrib/thin_sexp_emitter.cc:2:
/usr/include/boost/optional/optional.hpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& boost::operator<<(std::basic_ostream<_CharT, _Traits>&, const boost::optional_detail::optional_tag&) [with CharType = char; CharTrait = std::char_traits<char>]’:
./base/indented_stream.h:31:9:   required from ‘{anonymous}::indented_stream& {anonymous}::indented_stream::operator<<(const T&) [with T = boost::optional<unsigned int>]’
contrib/thin_sexp_emitter.cc:105:29:   required from ‘void {anonymous}::sexp_emitter::kv(const char*, const T&) [with T = boost::optional<unsigned int>]’
contrib/thin_sexp_emitter.cc:29:21:   required from here
/usr/include/boost/optional/optional.hpp:1481:3: error: static assertion failed: If you want to output boost::optional, include header <boost/optional/optional_io.hpp>
   BOOST_STATIC_ASSERT_MSG(sizeof(CharType) == 0, "If you want to output boost::optional, include header <boost/optional/optional_io.hpp>");
   ^~~~~~~~~~~~~~~~~~~~~~~
make: *** [contrib/Makefile:15: contrib/thin_sexp_emitter.o] Error 1
```

boost/optional/optional_io.hpp exists since at least Boost 1.34.0, so it is
 safe to include in older versions, too.
2018-06-13 08:42:30 +01:00
Dennis Schridde
bc7864dae8 [build] Fix static build by including contrib/Makefile early (#100)
Closes: #99
2018-06-13 08:41:53 +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
Jörg Thalheim
6a7351da0d Fix musl build (#96)
a) Fix build if limits.h provides definition for PAGE_SIZE, as musl does w/musl per XSI[1] although it's apparently optional [2].
   This value is only provided when it's known to be a constant, to avoid the need to discover the value dynamically.
b) If not using system-provided (kernel headers, or libc headers, or something) use the POSIX approach of querying the value
   dynamically using sysconf(_SC_PAGE_SIZE) instead of hardcoded value that hopefully is correct.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
[2] http://www.openwall.com/lists/musl/2015/09/11/8

This patch originate from:

  https://raw.githubusercontent.com/voidlinux/void-packages/a0ece13ad7ab2aae760e09e41e0459bd999a3695/srcpkgs/thin-provisioning-tools/patches/musl.patch

and was also applied in NixOS:

  https://github.com/NixOS/nixpkgs/pull/40559/

cc @dtzWill
2018-05-22 14:02:49 +01:00
Joe Thornber
5d3197b8ab [build] quieten build of C files 2018-04-25 14:05:28 +01:00
Joe Thornber
6f936992b8 bump version 2018-04-23 10:41:48 +01:00
Joe Thornber
1172b2f450 [functional-tests] with-temp-file-sized now takes *either* bytes or a disk-size object 2018-04-18 15:12:28 +01:00
Ming-Hung Tsai
582e424560 [space-map-disk] fix the number of free blocks (#93) 2018-04-17 14:00:44 +01:00
Joe Thornber
e619c6edd0 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2018-04-17 13:33:32 +01:00
Joe Thornber
1433d11f59 [thin-provisioning/metadata] Use latest metadata version (2) 2018-04-17 13:32:49 +01:00
Joe Thornber
58048dc178 [file_utils] Use aligned memory in zero_superblock 2018-04-17 11:42:43 +01:00
Joe Thornber
abb32897e2 [thin_dump] human_readable emitter didn't print the metadata_snap. 2018-04-17 10:29:31 +01:00
Todd Gill
6046ebd4c4 Add autoconf step to Building instructions (#92)
The configure script doesn't exist until autoconf is run.

Signed-off-by: Todd Gill <tgill@redhat.com>
2018-04-17 10:09:15 +01:00