Commit Graph

73 Commits

Author SHA1 Message Date
Ming-Hung Tsai
6cecf0f673 [file_utils] Check the file type to prevent unexpected writes by thin_repair 2021-07-09 01:22:22 +08:00
Ming-Hung Tsai
6660fde3c4 [tests] Refine the test naming and error messages
- Make the naming of test cases less ambiguous, e.g., rename
  "missing_input_file" to "missing_input_arg" or "input_file_not_found"
- Unify the error messages on input/output options
2021-07-08 01:05:15 +08:00
Ming-Hung Tsai
429e7f01d7 [file_utils] Fix resource leak 2021-06-04 21:37:02 +08:00
Ming-Hung Tsai
25ed2dfc9a [thin_dump] Fix warnings on potential NULL pointer 2021-06-03 18:54:26 +08:00
Ming-Hung Tsai
f7e4a8faa9 [all] Fix resource leaks 2021-06-02 00:51:39 +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
a05ac553b6 [dbg] Hide implementations of shared components 2021-02-04 14:28:17 +08:00
Ming-Hung Tsai
b9b04dc872 [thin_debug] Factor out reusable componments 2021-02-04 14:19:28 +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
3f19818c56 [thin] Adopt stateful random number generators 2020-08-05 22:14:01 +08:00
Ming-Hung Tsai
0c3c5f6c1e [sequence_generator] Fix parameters and span boundary checking 2020-07-29 16:26:14 +08:00
Ming-Hung Tsai
661b4de5de [run_set] Add lower_bound and upper_bound functions 2020-07-29 16:18:23 +08:00
Ming-Hung Tsai
105b8ec1cf [base] Factor out sequence_generator 2020-07-29 15:33:25 +08:00
Ming-Hung Tsai
e62022a200 [base] Move run_set to namespace base 2020-07-29 15:33:25 +08:00
Ming-Hung Tsai
061d966e7a [io_generator] Support mixed sequential and random io pattern 2020-07-25 17:46:59 +08:00
Ming-Hung Tsai
7ed013fcab [io_generator] Rename offset_generator classes, and fix bugs
- Rename the classes for general-purpose usage
- Fix duplicated sequential number generation while wrap around
- Enable unaligned random number generation
2020-07-25 17:20:59 +08:00
Ming-Hung Tsai
aabc3a9dbc [io_generator] Add random map to avoid generating repeated addresses 2020-07-25 16:53:44 +08:00
Ming-Hung Tsai
ce8945e829 [io_generator] Fix address boundary for doing IO
Limit the addresses to be within the specified range
2020-06-30 17:12:42 +08:00
Ming-Hung Tsai
084ac4b950 [io_generator] Simplify the class interface 2020-06-24 12:26:09 +08:00
Ming-Hung Tsai
a345b894d3 [math_utils] Add is_power_of_two() 2020-06-19 18:07:55 +08:00
Ming-Hung Tsai
5260a87c0b [base] Move math_utils to namespace base 2020-06-19 18:07:55 +08:00
Ming-Hung Tsai
12d7178199 [base] Introduce io_generator 2020-06-19 18:07:55 +08: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
ad79b627a4 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2020-04-08 12:30:26 +01:00
Joe Thornber
8db3800e2c [base/application] One of the run methods wasn't overriding 2020-04-08 12:19:06 +01:00
Arusekk
3ed3925370 Fix compilation with uClibc
Closes #12
2020-03-25 15:58:02 +01: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
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
58048dc178 [file_utils] Use aligned memory in zero_superblock 2018-04-17 11:42:43 +01:00
csonto
39809c17b2 [*_restore] Fix leaking file descriptor (#89) 2017-11-14 15:09:11 +00: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
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
4493d6d39d [disk-units] remove some dead code. 2017-03-13 13:16:56 +00:00
Joe Thornber
702a38f438 [many tools] fix bug in previous patch 2016-08-10 23:39:48 +08: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
c8fec7ec40 [cache_writeback] Coded, needs testing 2016-04-14 08:54:32 +01: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
d28e64aff0 [xml_parser] Allow element handlers to stop parsing 2016-02-27 15:20:45 +08:00
Joe Thornber
6637a30618 [base] Move container_of to own file 2016-02-24 14:42:37 +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
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
1e0d2a16cc [disk_units] add missing header 2016-01-20 18:11:48 +00:00
Joe Thornber
d858a43f07 [grid_layout] avoid extra newline at end of grid 2016-01-20 10:40:48 +00:00
Joe Thornber
d19164a177 [disk_units] tweak rounding 2016-01-20 09:50:47 +00:00
Joe Thornber
e15b11edb1 [thin_ls, base] Factor out grid_layout 2016-01-20 06:58:59 +00:00
Joe Thornber
070b7e6fe1 [disk_units] Don't put a space between numerator and unit 2016-01-19 14:44:06 +00:00
Joe Thornber
7ce4e451ff [base, thin_ls] factor out disk_units code 2016-01-19 11:40:00 +00:00
Joe Thornber
c93e728ef4 [base] introduce a command type that gets registered with the app 2016-01-08 12:51:52 +00:00
Joe Thornber
216e5acb6c [thin_show_dups] remove variable number of mems per chunks.
Too slow and not used.
2015-09-04 13:48:02 +01:00