Commit Graph

142 Commits

Author SHA1 Message Date
Ming-Hung Tsai
050eacf4cb [all] Remove unreachable code 2021-06-03 18:54:26 +08:00
Ming-Hung Tsai
e8410dec04 [dbg] Add missing commands to cache/era_debug 2021-02-21 19:16:51 +08:00
Ming-Hung Tsai
a81cef4467 [dbg] Pull out common code into dbg-lib
- Modularize common routines
- Extract the block_dumper interface for displaying blocks
- Remove inheritance from show_traits
2021-02-21 01:04:35 +08:00
Ming-Hung Tsai
1bc88bfde8 [cache_debug] Simplify the trait types 2021-02-18 18:20:48 +08:00
Ming-Hung Tsai
e3a646e4d2 [dbg] Improve error resilience of debugging tools
Do not open the metadata. The tool interprets user specified blocks one-by-one.
Thus, there's no need to preload the metadata structures.

Also remove the unused --ignore-metadata-space-map option. It was designed
to control the loading of space maps with the old metadata constructors.
2021-02-18 00:00:55 +08:00
Ming-Hung Tsai
08bd2f47bd [cache_debug] Fork thin_debug into cache_debug 2021-02-04 14:29:18 +08:00
Ming-Hung Tsai
4c17076f09 [cache_writeback] Support offset within the source and destination devices 2021-01-20 12:02:13 +08:00
Ming-Hung Tsai
6a2fa73924 [build] Enable building the dev-tools for functional tests
- Factor out the dev-tools into a stand-alone, no-installed program
- Built the dev-tools if --enable-testing is specified
- Remove the --enable-dev-tools configure option
- Allow suffix on the binary name
- Update symlinks
- Cleanup Makefile
2021-01-12 16:08:51 +08:00
Ming-Hung Tsai
621b466333 [all] Eliminate duplicated sector_t typedefs 2020-06-19 18:07:55 +08: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
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
5e347dddbf [various] remove dead code.
Squashes warnings from clang++
2020-04-08 12:12:59 +01:00
Arusekk
3ed3925370 Fix compilation with uClibc
Closes #12
2020-03-25 15:58:02 +01:00
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
b6ba3a070d [restore_emitter] squash a strncpy warning 2018-06-13 12:50:48 +01:00
Joe Thornber
e3b7d82569 [cache_restore] v2 dirty bitset root wasn't being written to superblock.
Resulting in corrupt restored data.
2017-11-13 14:02:16 +00:00
csonto
5b5aa971a0 Detect XML in *_check tools (#86)
* [*_check] Detect XML in cache_check and era_check

This is based on previous commit b10d8d4440.

* [*_check] Fix typo in check_superblock
2017-10-05 13:47:10 +01:00
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
Joe Thornber
5b92f410ec [*_restore] if things go wrong wipe the superblock.
So we don't leave the metadata device with partially restored metadata.
2017-09-28 14:39:24 +01:00
Joe Thornber
48e7ab89a5 [*_dump] Fix segfault when given a tiny metadata file 2017-09-21 10:22:38 +01:00
Joe Thornber
f7d79339e8 [man pages] Various updates. 2017-09-18 16:10:56 +01:00
Joe Thornber
88b0c2ebae [cache-restore] Fix crash with --override-metadata-version flag.
If the actual metadata version is 1, then the dirty bitset will not be
present.  But the superblock was trying to write it because of the
overridden md version.
2017-08-29 13:17:45 +01:00
Joe Thornber
4da8d19f29 [cache_restore] The metadata version and clean shutdown flags were
swapped.

Reveal by failing --omit-clean-shutdown test
2017-08-29 12:33:32 +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
13323bd52c [cache_check] Don't even open the dev writeable if
--clear-needs-check-flag is not set
2017-03-27 08:58:56 -04:00
Joe Thornber
b0e0432737 [cache] dirty root wasn't being packed properly 2017-03-27 08:57:43 -04:00
Joe Thornber
ba8d5ab5e4 [cache_restore] --debug-override-metadata-version wasn't working 2017-03-01 10:36:34 -05:00
Joe Thornber
d52e934ce2 Merge branch 'v0.7-devel' into 2016-14-08-cache-format2 2017-02-27 09:37:01 -05:00
Joe Thornber
d710cad52b [cache tools] knock out OPEN from the metadata enum 2016-10-07 15:01:16 -04:00
Joe Thornber
05c4b7b400 [cache] a lot of format 2 changes 2016-09-30 11:21:20 -04:00
Thanos Makatos
0c78d8d0c5 fix compilation for gcc 5.4.0 2016-09-07 13:49:36 +00: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
Joe Thornber
8989bb0f32 [caching] cache_writeback 2016-06-14 16:29:37 +01:00
Joe Thornber
a94bfea798 [block-cache] unit tests + debug io_engine and copier 2016-06-07 11:12:27 +01:00
Joe Thornber
c8fec7ec40 [cache_writeback] Coded, needs testing 2016-04-14 08:54:32 +01:00
Joe Thornber
4573ebb218 [cache_writeback] work in progress 2016-03-17 15:15:52 +00:00
Joe Thornber
b8659853bb [cache_writeback] stub cache_writeback 2016-03-08 15:27:22 +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
Joe Thornber
767c39cf71 [build] switch to c++11
Conflicts:
	Makefile.in
	chunker/cache_stream.cc
	chunker/cache_stream.h
	thin-provisioning/thin_archive.cc
	thin-provisioning/thin_show_duplicates.cc
	unit-tests/Makefile.in
2016-02-16 16:45:44 +00:00
Joe Thornber
c93e728ef4 [base] introduce a command type that gets registered with the app 2016-01-08 12:51:52 +00:00
Zdenek Kabelac
271ff67f91 Cache check close RO opened device before reopen.
When check_check is used with --clear-needs-check-flag option,
device needs to be opened in RW exclusive mode, but for this
existing RO exlusive open must be closed.

LVM2 will consider version 0.5.3 as a version without flag support
for cache_check since it cannot successfully pass cache_check.

TODO: when 'RO' parts detects there is nothing to 'clear' it should
completely skip RW open to avoid udev rule processing.
2015-07-28 14:37:44 +01:00
Joe Thornber
6ab0833b2e cache_check: add --clear-needs-check 2015-06-09 14:01:22 +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
150a3c486d Fix these errors:
caching/superblock.cc:306: error: reference to 'validator' is ambiguous
caching/superblock.cc:271: error: candidates are: namespace validator { }
./block-cache/block_cache.h:22: error:                 class bcache::validator

caching/superblock.cc:316: error: reference to 'validator' is ambiguous
caching/superblock.cc:271: error: candidates are: namespace validator { }
./block-cache/block_cache.h:22: error:                 class bcache::validator

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2015-01-16 10:13:36 +00:00
Alexander Holler
691ad88261 [caching/hint_array.cc] Fix ambigious array (C++11)
Template array exist in the namespace persistent_data as well as in std
of C++11. Explicitly use the one from persistent_data.

This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with
gcc 4.8.3 and boost 1.55.
2014-11-15 16:49:08 +01:00