import device-mapper-persistent-data-0.9.0-1.el8
This commit is contained in:
parent
05a27085c9
commit
dd6ca8614d
@ -1 +1,2 @@
|
|||||||
250ac419422b2eb36a3de4af44d8d0a99aad8e69 SOURCES/v0.8.5.tar.gz
|
68f0c40b4efaff002a77bb087a808b987803c79c SOURCES/dmpd090-vendor2.tar.gz
|
||||||
|
2015701a5767bae5960c8611673088fa9dcf3b60 SOURCES/v0.9.0.tar.gz
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
SOURCES/v0.8.5.tar.gz
|
SOURCES/dmpd090-vendor2.tar.gz
|
||||||
|
SOURCES/v0.9.0.tar.gz
|
||||||
|
25
SOURCES/0001-Update-dependencies.patch
Normal file
25
SOURCES/0001-Update-dependencies.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 4a45e1d7eafb83ec9c76f0b3278f4bc7efbdde9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marian Csontos <mcsontos@redhat.com>
|
||||||
|
Date: Tue, 1 Sep 2020 14:55:48 +0200
|
||||||
|
Subject: [PATCH] Update dependencies
|
||||||
|
|
||||||
|
---
|
||||||
|
Cargo.toml | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Cargo.toml b/Cargo.toml
|
||||||
|
index 892ea4c..93fc807 100644
|
||||||
|
--- a/Cargo.toml
|
||||||
|
+++ b/Cargo.toml
|
||||||
|
@@ -9,7 +9,7 @@ license = "GPL3"
|
||||||
|
anyhow = "1.0"
|
||||||
|
byteorder = "1.3"
|
||||||
|
clap = "2.33"
|
||||||
|
-crc32c = "0.4"
|
||||||
|
+crc32c = "0.5"
|
||||||
|
flate2 = "1.0"
|
||||||
|
fixedbitset = "0.3"
|
||||||
|
libc = "0.2.71"
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
42
SOURCES/0001-all-Fix-resource-leaks.patch
Normal file
42
SOURCES/0001-all-Fix-resource-leaks.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From 48676b9f1aac63f8a30ed8061b6e719929b82c98 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 28 Apr 2021 10:34:16 +0800
|
||||||
|
Subject: [PATCH 01/10] [all] Fix resource leaks
|
||||||
|
|
||||||
|
---
|
||||||
|
base/file_utils.cc | 4 +++-
|
||||||
|
thin-provisioning/cache_stream.cc | 2 +-
|
||||||
|
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/base/file_utils.cc b/base/file_utils.cc
|
||||||
|
index e4f3722..8253660 100644
|
||||||
|
--- a/base/file_utils.cc
|
||||||
|
+++ b/base/file_utils.cc
|
||||||
|
@@ -155,8 +155,10 @@ file_utils::zero_superblock(std::string const &path)
|
||||||
|
throw runtime_error("out of memory");
|
||||||
|
|
||||||
|
memset(buffer, 0, SUPERBLOCK_SIZE);
|
||||||
|
- if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE)
|
||||||
|
+ if (::write(fd.fd_, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE) {
|
||||||
|
+ free(buffer);
|
||||||
|
throw runtime_error("couldn't zero superblock");
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
diff --git a/thin-provisioning/cache_stream.cc b/thin-provisioning/cache_stream.cc
|
||||||
|
index 002b6ba..73b01b4 100644
|
||||||
|
--- a/thin-provisioning/cache_stream.cc
|
||||||
|
+++ b/thin-provisioning/cache_stream.cc
|
||||||
|
@@ -62,7 +62,7 @@ chunk const &
|
||||||
|
cache_stream::get()
|
||||||
|
{
|
||||||
|
chunk_wrapper *w = new chunk_wrapper(*this);
|
||||||
|
- return w->c_;
|
||||||
|
+ return w->c_; // wrapper will get freed by the put method
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 691a0237809b5364117446a8a9b0cceeb0a747c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Tue, 1 Jun 2021 11:24:11 +0800
|
||||||
|
Subject: [PATCH 02/10] [thin_show_metadata] Fix out-of-bounds access
|
||||||
|
|
||||||
|
---
|
||||||
|
thin-provisioning/thin_show_metadata.cc | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/thin_show_metadata.cc b/thin-provisioning/thin_show_metadata.cc
|
||||||
|
index bdbab3f..dbc7a80 100644
|
||||||
|
--- a/thin-provisioning/thin_show_metadata.cc
|
||||||
|
+++ b/thin-provisioning/thin_show_metadata.cc
|
||||||
|
@@ -206,7 +206,8 @@ namespace {
|
||||||
|
|
||||||
|
void run() {
|
||||||
|
auto line_length = 80;
|
||||||
|
- for (block_address b = 0; b < 2000; b++) {
|
||||||
|
+ block_address nr_blocks = std::min<block_address>(2000, bm_.get_nr_blocks());
|
||||||
|
+ for (block_address b = 0; b < nr_blocks; b++) {
|
||||||
|
block_manager::read_ref rr = bm_.read_lock(b);
|
||||||
|
|
||||||
|
if (!(b % line_length)) {
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
25
SOURCES/0003-build-Fix-customized-emitter-linkage.patch
Normal file
25
SOURCES/0003-build-Fix-customized-emitter-linkage.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 65369d88610069ba7bbd011b00af19523638b0fb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Tue, 1 Jun 2021 13:32:26 +0800
|
||||||
|
Subject: [PATCH 03/10] [build] Fix customized emitter linkage
|
||||||
|
|
||||||
|
---
|
||||||
|
contrib/Makefile.in | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/contrib/Makefile.in b/contrib/Makefile.in
|
||||||
|
index 038c41c..7192258 100644
|
||||||
|
--- a/contrib/Makefile.in
|
||||||
|
+++ b/contrib/Makefile.in
|
||||||
|
@@ -18,7 +18,7 @@ contrib/%.a: contrib/%.o
|
||||||
|
$(V)echo " [AR] $@"
|
||||||
|
$(V)$(AR) rcs $@ $^
|
||||||
|
|
||||||
|
-contrib/%.so: contrib/%.a
|
||||||
|
+contrib/%.so: contrib/%.o
|
||||||
|
$(V)echo " [LD] $@"
|
||||||
|
$(V)$(CC) -shared -Wl,-soname,$@ -o $@ $<
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
139
SOURCES/0004-thin_dump-Fix-leaked-shared-object-handle.patch
Normal file
139
SOURCES/0004-thin_dump-Fix-leaked-shared-object-handle.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
From 7fbd79cab2e548eb388bc782dd39f1cde027173b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Tue, 1 Jun 2021 23:37:36 +0800
|
||||||
|
Subject: [PATCH 04/10] [thin_dump] Fix leaked shared object handle
|
||||||
|
|
||||||
|
---
|
||||||
|
thin-provisioning/shared_library_emitter.cc | 113 ++++++++++++++++++++++++----
|
||||||
|
1 file changed, 100 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/shared_library_emitter.cc b/thin-provisioning/shared_library_emitter.cc
|
||||||
|
index 58f12d2..2e845f3 100644
|
||||||
|
--- a/thin-provisioning/shared_library_emitter.cc
|
||||||
|
+++ b/thin-provisioning/shared_library_emitter.cc
|
||||||
|
@@ -8,22 +8,109 @@ using namespace thin_provisioning;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
-emitter::ptr
|
||||||
|
-thin_provisioning::create_custom_emitter(string const &shared_lib, ostream &out)
|
||||||
|
-{
|
||||||
|
- emitter::ptr (*create_fn)(ostream &out);
|
||||||
|
- void *handle = dlopen(shared_lib.c_str(), RTLD_LAZY);
|
||||||
|
- if (!handle)
|
||||||
|
- throw runtime_error(dlerror());
|
||||||
|
+struct shared_object {
|
||||||
|
+public:
|
||||||
|
+ shared_object(const char *shared_lib) {
|
||||||
|
+ handle_ = dlopen(shared_lib, RTLD_LAZY);
|
||||||
|
+ if (!handle_)
|
||||||
|
+ throw runtime_error(dlerror());
|
||||||
|
+
|
||||||
|
+ dlerror(); // Clear any existing error
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ virtual ~shared_object() {
|
||||||
|
+ dlclose(handle_);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void *get_symbol(const char *symbol) {
|
||||||
|
+ void *sym = dlsym(handle_, symbol);
|
||||||
|
+
|
||||||
|
+ char *error = dlerror();
|
||||||
|
+ if (error)
|
||||||
|
+ throw runtime_error(error);
|
||||||
|
+
|
||||||
|
+ return sym;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void *handle_;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+class shared_emitter : public emitter {
|
||||||
|
+public:
|
||||||
|
+ shared_emitter(const char *shared_lib, ostream &out): sobj_(shared_lib) {
|
||||||
|
+ emitter::ptr (*create_fn)(ostream &out);
|
||||||
|
+ create_fn = reinterpret_cast<emitter::ptr (*)(ostream &)>(
|
||||||
|
+ sobj_.get_symbol("create_emitter"));
|
||||||
|
+ inner_ = create_fn(out);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ virtual ~shared_emitter() {
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void begin_superblock(std::string const &uuid,
|
||||||
|
+ uint64_t time,
|
||||||
|
+ uint64_t trans_id,
|
||||||
|
+ boost::optional<uint32_t> flags,
|
||||||
|
+ boost::optional<uint32_t> version,
|
||||||
|
+ uint32_t data_block_size,
|
||||||
|
+ uint64_t nr_data_blocks,
|
||||||
|
+ boost::optional<uint64_t> metadata_snap) {
|
||||||
|
+ inner_->begin_superblock(uuid,
|
||||||
|
+ time,
|
||||||
|
+ trans_id,
|
||||||
|
+ flags,
|
||||||
|
+ version,
|
||||||
|
+ data_block_size,
|
||||||
|
+ nr_data_blocks,
|
||||||
|
+ metadata_snap);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- dlerror(); // Clear any existing error
|
||||||
|
- create_fn = reinterpret_cast<emitter::ptr (*)(ostream &)>(dlsym(handle, "create_emitter"));
|
||||||
|
+ void end_superblock() {
|
||||||
|
+ inner_->end_superblock();
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- char *error = dlerror();
|
||||||
|
- if (error)
|
||||||
|
- throw runtime_error(error);
|
||||||
|
+ void begin_device(uint32_t dev_id,
|
||||||
|
+ uint64_t mapped_blocks,
|
||||||
|
+ uint64_t trans_id,
|
||||||
|
+ uint64_t creation_time,
|
||||||
|
+ uint64_t snap_time) {
|
||||||
|
+ inner_->begin_device(dev_id, mapped_blocks, trans_id, creation_time, snap_time);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- return create_fn(out);
|
||||||
|
+ void end_device() {
|
||||||
|
+ inner_->end_device();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void begin_named_mapping(std::string const &name) {
|
||||||
|
+ inner_->begin_named_mapping(name);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void end_named_mapping() {
|
||||||
|
+ inner_->end_named_mapping();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void identifier(std::string const &name) {
|
||||||
|
+ inner_->identifier(name);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void range_map(uint64_t origin_begin, uint64_t data_begin, uint32_t time, uint64_t len) {
|
||||||
|
+ inner_->range_map(origin_begin, data_begin, time, len);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void single_map(uint64_t origin_block, uint64_t data_block, uint32_t time) {
|
||||||
|
+ inner_->single_map(origin_block, data_block, time);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ shared_object sobj_;
|
||||||
|
+ emitter::ptr inner_;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+//----------------------------------------------------------------
|
||||||
|
+
|
||||||
|
+emitter::ptr
|
||||||
|
+thin_provisioning::create_custom_emitter(string const &shared_lib, ostream &out)
|
||||||
|
+{
|
||||||
|
+ return emitter::ptr(new shared_emitter(shared_lib.c_str(), out));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
52
SOURCES/0005-thin_show_duplicates-Fix-potential-errors.patch
Normal file
52
SOURCES/0005-thin_show_duplicates-Fix-potential-errors.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From 32de33be68f3892698d492b9ab8f21f9186b3f4c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 01:23:13 +0800
|
||||||
|
Subject: [PATCH 05/10] [thin_show_duplicates] Fix potential errors
|
||||||
|
|
||||||
|
- Fix error if no --block-sector provided
|
||||||
|
- Fix errors on pools without mappings, or zero-length file
|
||||||
|
---
|
||||||
|
thin-provisioning/thin_show_duplicates.cc | 8 ++++++--
|
||||||
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/thin_show_duplicates.cc b/thin-provisioning/thin_show_duplicates.cc
|
||||||
|
index b1eebb7..f7354eb 100644
|
||||||
|
--- a/thin-provisioning/thin_show_duplicates.cc
|
||||||
|
+++ b/thin-provisioning/thin_show_duplicates.cc
|
||||||
|
@@ -56,7 +56,7 @@ using namespace thin_provisioning;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
bool factor_of(block_address f, block_address n) {
|
||||||
|
- return (n % f) == 0;
|
||||||
|
+ return f && (n % f) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t parse_int(string const &str, string const &desc) {
|
||||||
|
@@ -132,11 +132,15 @@ namespace {
|
||||||
|
class duplicate_detector {
|
||||||
|
public:
|
||||||
|
void scan_with_variable_sized_chunks(chunk_stream &stream) {
|
||||||
|
+ if (!stream.size())
|
||||||
|
+ return;
|
||||||
|
variable_chunk_stream vstream(stream, 4096);
|
||||||
|
scan(vstream);
|
||||||
|
}
|
||||||
|
|
||||||
|
void scan_with_fixed_sized_chunks(chunk_stream &stream, block_address chunk_size) {
|
||||||
|
+ if (!stream.size())
|
||||||
|
+ return;
|
||||||
|
fixed_chunk_stream fstream(stream, chunk_size);
|
||||||
|
scan(fstream);
|
||||||
|
}
|
||||||
|
@@ -222,7 +226,7 @@ namespace {
|
||||||
|
if (fs.content_based_chunks)
|
||||||
|
detector.scan_with_variable_sized_chunks(pstream);
|
||||||
|
else {
|
||||||
|
- if (*fs.block_size) {
|
||||||
|
+ if (!!fs.block_size) {
|
||||||
|
if (factor_of(*fs.block_size, block_size))
|
||||||
|
block_size = *fs.block_size;
|
||||||
|
else
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 35e96e07c956a501cb8a12f5b873db173bb09179 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 11:39:01 +0800
|
||||||
|
Subject: [PATCH 06/10] [thin_metadata_size] Fix potential string overflow
|
||||||
|
|
||||||
|
---
|
||||||
|
thin-provisioning/thin_metadata_size.cc | 10 +++++++---
|
||||||
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/thin_metadata_size.cc b/thin-provisioning/thin_metadata_size.cc
|
||||||
|
index b6a5718..f14696c 100644
|
||||||
|
--- a/thin-provisioning/thin_metadata_size.cc
|
||||||
|
+++ b/thin-provisioning/thin_metadata_size.cc
|
||||||
|
@@ -192,9 +192,13 @@ static void printf_aligned(struct global *g, char const *a, char const *b, char
|
||||||
|
{
|
||||||
|
char buf[80];
|
||||||
|
|
||||||
|
- strcpy(buf, b);
|
||||||
|
- if (units)
|
||||||
|
- strcat(buf, mandatory ? "{" :"["), strcat(buf, g->unit.chars), strcat(buf, mandatory ? "}" : "]");
|
||||||
|
+ if (units) {
|
||||||
|
+ char left_bracket = mandatory ? '{' : '[';
|
||||||
|
+ char right_bracket = mandatory ? '}' : ']';
|
||||||
|
+ snprintf(buf, 80, "%s%c%s%c", b, left_bracket, g->unit.chars, right_bracket);
|
||||||
|
+ } else {
|
||||||
|
+ snprintf(buf, 80, "%s", b);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
printf("\t%-4s%-44s%s\n", a, buf, c);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
83
SOURCES/0007-all-Fix-uninitialized-class-members.patch
Normal file
83
SOURCES/0007-all-Fix-uninitialized-class-members.patch
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
From f1e404c33ad14f6784aa1926ae75fa49e614748e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 12:14:34 +0800
|
||||||
|
Subject: [PATCH 07/10] [all] Fix uninitialized class members
|
||||||
|
|
||||||
|
---
|
||||||
|
era/restore_emitter.cc | 1 +
|
||||||
|
thin-provisioning/metadata_dumper.cc | 10 +++++++---
|
||||||
|
thin-provisioning/thin_delta.cc | 4 +++-
|
||||||
|
3 files changed, 11 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/era/restore_emitter.cc b/era/restore_emitter.cc
|
||||||
|
index c09fa66..7fbac7d 100644
|
||||||
|
--- a/era/restore_emitter.cc
|
||||||
|
+++ b/era/restore_emitter.cc
|
||||||
|
@@ -14,6 +14,7 @@ namespace {
|
||||||
|
: md_(md),
|
||||||
|
in_superblock_(false),
|
||||||
|
in_writeset_(false),
|
||||||
|
+ era_(0),
|
||||||
|
in_era_array_(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc
|
||||||
|
index 4feb40f..665c762 100644
|
||||||
|
--- a/thin-provisioning/metadata_dumper.cc
|
||||||
|
+++ b/thin-provisioning/metadata_dumper.cc
|
||||||
|
@@ -180,7 +180,7 @@ namespace {
|
||||||
|
// This is about classifying and summarising btree nodes. The use of a btree
|
||||||
|
// node may not be obvious when inspecting it in isolation. But more information
|
||||||
|
// may be gleaned by examining child and sibling nodes.
|
||||||
|
-//
|
||||||
|
+//
|
||||||
|
// So the process is:
|
||||||
|
// - scan every metadata block, summarising it's potential uses.
|
||||||
|
// - repeatedly iterate those summaries until we can glean no more useful information.
|
||||||
|
@@ -474,7 +474,7 @@ namespace {
|
||||||
|
node_info get_internal_info(block_manager::read_ref &rr) {
|
||||||
|
node_info info;
|
||||||
|
info.b = rr.get_location();
|
||||||
|
-
|
||||||
|
+
|
||||||
|
// values refer to blocks, so we should have infos for them.
|
||||||
|
auto n = to_node<block_traits>(rr);
|
||||||
|
::uint64_t key_low = 0;
|
||||||
|
@@ -524,7 +524,7 @@ namespace {
|
||||||
|
node_info info;
|
||||||
|
info.b = rr.get_location();
|
||||||
|
|
||||||
|
- auto vsize = to_cpu<uint32_t>(hdr.value_size);
|
||||||
|
+ auto vsize = to_cpu<uint32_t>(hdr.value_size);
|
||||||
|
info.values = to_cpu<uint32_t>(hdr.nr_entries);
|
||||||
|
|
||||||
|
if (vsize == sizeof(device_details_traits::disk_type)) {
|
||||||
|
@@ -645,6 +645,10 @@ namespace {
|
||||||
|
public:
|
||||||
|
mapping_emit_visitor(emitter::ptr e)
|
||||||
|
: e_(e),
|
||||||
|
+ origin_start_(0),
|
||||||
|
+ dest_start_(0),
|
||||||
|
+ time_(0),
|
||||||
|
+ len_(0),
|
||||||
|
in_range_(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc
|
||||||
|
index 5b31608..ee48dea 100644
|
||||||
|
--- a/thin-provisioning/thin_delta.cc
|
||||||
|
+++ b/thin-provisioning/thin_delta.cc
|
||||||
|
@@ -259,7 +259,9 @@ namespace local {
|
||||||
|
class simple_emitter : public diff_emitter {
|
||||||
|
public:
|
||||||
|
simple_emitter(indented_stream &out)
|
||||||
|
- : diff_emitter(out) {
|
||||||
|
+ : diff_emitter(out),
|
||||||
|
+ vbegin_(0),
|
||||||
|
+ vend_(0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void left_only(uint64_t vbegin, uint64_t dbegin, uint64_t len) {
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,88 @@
|
|||||||
|
From 5d79a5c944d05f71425d3156597a2a61c5f2ab9a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 13:08:47 +0800
|
||||||
|
Subject: [PATCH 08/10] [thin_dump] Fix warnings on potential NULL pointer
|
||||||
|
|
||||||
|
---
|
||||||
|
base/application.cc | 8 +++++++-
|
||||||
|
base/application.h | 2 +-
|
||||||
|
thin-provisioning/thin_dump.cc | 16 ++--------------
|
||||||
|
3 files changed, 10 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/base/application.cc b/base/application.cc
|
||||||
|
index 61338ff..dbd55a5 100644
|
||||||
|
--- a/base/application.cc
|
||||||
|
+++ b/base/application.cc
|
||||||
|
@@ -25,8 +25,14 @@ command::die(string const &msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
::uint64_t
|
||||||
|
-command::parse_uint64(string const &str, string const &desc)
|
||||||
|
+command::parse_uint64(char const *str, char const *desc)
|
||||||
|
{
|
||||||
|
+ if (!str) {
|
||||||
|
+ ostringstream out;
|
||||||
|
+ out << "Couldn't parse " << desc << ": NULL";
|
||||||
|
+ die(out.str());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
try {
|
||||||
|
// FIXME: check trailing garbage is handled
|
||||||
|
return lexical_cast<::uint64_t>(str);
|
||||||
|
diff --git a/base/application.h b/base/application.h
|
||||||
|
index b799eaf..f071533 100644
|
||||||
|
--- a/base/application.h
|
||||||
|
+++ b/base/application.h
|
||||||
|
@@ -19,7 +19,7 @@ namespace base {
|
||||||
|
virtual ~command() {}
|
||||||
|
|
||||||
|
void die(std::string const &msg);
|
||||||
|
- uint64_t parse_uint64(std::string const &str, std::string const &desc);
|
||||||
|
+ uint64_t parse_uint64(char const *str, char const *desc);
|
||||||
|
|
||||||
|
|
||||||
|
virtual void usage(std::ostream &out) const = 0;
|
||||||
|
diff --git a/thin-provisioning/thin_dump.cc b/thin-provisioning/thin_dump.cc
|
||||||
|
index 74cfa91..c0e73e6 100644
|
||||||
|
--- a/thin-provisioning/thin_dump.cc
|
||||||
|
+++ b/thin-provisioning/thin_dump.cc
|
||||||
|
@@ -143,7 +143,6 @@ thin_dump_cmd::run(int argc, char **argv)
|
||||||
|
int c;
|
||||||
|
char const *output = NULL;
|
||||||
|
const char shortopts[] = "hm::o:f:rV";
|
||||||
|
- char *end_ptr;
|
||||||
|
block_address metadata_snap = 0;
|
||||||
|
::uint64_t dev_id;
|
||||||
|
struct flags flags;
|
||||||
|
@@ -181,13 +180,7 @@ thin_dump_cmd::run(int argc, char **argv)
|
||||||
|
flags.use_metadata_snap = true;
|
||||||
|
if (optarg) {
|
||||||
|
// FIXME: deprecate this option
|
||||||
|
- metadata_snap = strtoull(optarg, &end_ptr, 10);
|
||||||
|
- if (end_ptr == optarg) {
|
||||||
|
- cerr << "couldn't parse <metadata-snap>" << endl;
|
||||||
|
- usage(cerr);
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
+ metadata_snap = parse_uint64(optarg, "metadata-snap");
|
||||||
|
flags.snap_location = metadata_snap;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
@@ -197,12 +190,7 @@ thin_dump_cmd::run(int argc, char **argv)
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
- dev_id = strtoull(optarg, &end_ptr, 10);
|
||||||
|
- if (end_ptr == optarg) {
|
||||||
|
- cerr << "couldn't parse <dev-id>\n";
|
||||||
|
- usage(cerr);
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
+ dev_id = parse_uint64(optarg, "dev-id");
|
||||||
|
flags.opts.select_dev(dev_id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
From 1c50c406ddda77f4c0b20e7bf3cc985e84526f51 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 13:14:30 +0800
|
||||||
|
Subject: [PATCH 09/10] [build] Remove unused sources from the regular build
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile.in | 9 ++++-----
|
||||||
|
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index b1fd4aa..9b13001 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -96,10 +96,7 @@ SOURCE=\
|
||||||
|
persistent-data/transaction_manager.cc \
|
||||||
|
persistent-data/validators.cc \
|
||||||
|
thin-provisioning/commands.cc \
|
||||||
|
- thin-provisioning/cache_stream.cc \
|
||||||
|
- thin-provisioning/chunk_stream.cc \
|
||||||
|
thin-provisioning/device_tree.cc \
|
||||||
|
- thin-provisioning/fixed_chunk_stream.cc \
|
||||||
|
thin-provisioning/human_readable_format.cc \
|
||||||
|
thin-provisioning/mapping_tree.cc \
|
||||||
|
thin-provisioning/metadata.cc \
|
||||||
|
@@ -107,7 +104,6 @@ SOURCE=\
|
||||||
|
thin-provisioning/metadata_counter.cc \
|
||||||
|
thin-provisioning/metadata_dumper.cc \
|
||||||
|
thin-provisioning/override_emitter.cc \
|
||||||
|
- thin-provisioning/pool_stream.cc \
|
||||||
|
thin-provisioning/restore_emitter.cc \
|
||||||
|
thin-provisioning/rmap_visitor.cc \
|
||||||
|
thin-provisioning/superblock.cc \
|
||||||
|
@@ -124,7 +120,11 @@ SOURCE=\
|
||||||
|
thin-provisioning/xml_format.cc
|
||||||
|
|
||||||
|
DEVTOOLS_SOURCE=\
|
||||||
|
+ thin-provisioning/cache_stream.cc \
|
||||||
|
+ thin-provisioning/chunk_stream.cc \
|
||||||
|
thin-provisioning/damage_generator.cc \
|
||||||
|
+ thin-provisioning/fixed_chunk_stream.cc \
|
||||||
|
+ thin-provisioning/pool_stream.cc \
|
||||||
|
thin-provisioning/thin_journal.cc \
|
||||||
|
thin-provisioning/thin_journal_check.cc \
|
||||||
|
thin-provisioning/thin_ll_dump.cc \
|
||||||
|
@@ -374,4 +374,3 @@ test: functional-test unit-test
|
||||||
|
endif
|
||||||
|
|
||||||
|
-include $(DEPEND_FILES)
|
||||||
|
-
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
51
SOURCES/0010-all-Remove-unreachable-code.patch
Normal file
51
SOURCES/0010-all-Remove-unreachable-code.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From 9e94a4349186f7353e0d7b536b46bfa4df2483d0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Wed, 2 Jun 2021 14:59:29 +0800
|
||||||
|
Subject: [PATCH 10/10] [all] Remove unreachable code
|
||||||
|
|
||||||
|
---
|
||||||
|
block-cache/io_engine.cc | 3 ---
|
||||||
|
caching/hint_array.cc | 6 ------
|
||||||
|
2 files changed, 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block-cache/io_engine.cc b/block-cache/io_engine.cc
|
||||||
|
index 2fe4082..0158723 100644
|
||||||
|
--- a/block-cache/io_engine.cc
|
||||||
|
+++ b/block-cache/io_engine.cc
|
||||||
|
@@ -174,9 +174,6 @@ aio_engine::wait_(timespec *ts)
|
||||||
|
cbs_.free(cb);
|
||||||
|
return optional<wait_result>(make_pair(false, context));
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- // shouldn't get here
|
||||||
|
- return optional<wait_result>(make_pair(false, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
struct timespec
|
||||||
|
diff --git a/caching/hint_array.cc b/caching/hint_array.cc
|
||||||
|
index 6514968..e133c5c 100644
|
||||||
|
--- a/caching/hint_array.cc
|
||||||
|
+++ b/caching/hint_array.cc
|
||||||
|
@@ -56,9 +56,6 @@ namespace {
|
||||||
|
default:
|
||||||
|
throw runtime_error("invalid hint width");
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- // never get here
|
||||||
|
- return std::shared_ptr<array_base>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------
|
||||||
|
@@ -93,9 +90,6 @@ namespace {
|
||||||
|
default:
|
||||||
|
throw runtime_error("invalid hint width");
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- // never get here
|
||||||
|
- return std::shared_ptr<array_base>();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
24
SOURCES/0011-file_utils-Fix-resource-leak.patch
Normal file
24
SOURCES/0011-file_utils-Fix-resource-leak.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
From 677fa789e4136dbdd589c1e65efc7cdaad7506ac Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Fri, 4 Jun 2021 21:37:02 +0800
|
||||||
|
Subject: [PATCH 1/2] [file_utils] Fix resource leak
|
||||||
|
|
||||||
|
---
|
||||||
|
base/file_utils.cc | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/base/file_utils.cc b/base/file_utils.cc
|
||||||
|
index 8253660..e6095f7 100644
|
||||||
|
--- a/base/file_utils.cc
|
||||||
|
+++ b/base/file_utils.cc
|
||||||
|
@@ -159,6 +159,7 @@ file_utils::zero_superblock(std::string const &path)
|
||||||
|
free(buffer);
|
||||||
|
throw runtime_error("couldn't zero superblock");
|
||||||
|
}
|
||||||
|
+ free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
224
SOURCES/0012-thin_delta-Clean-up-duplicated-code.patch
Normal file
224
SOURCES/0012-thin_delta-Clean-up-duplicated-code.patch
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
From 2e755c67064c0157e646acfa57fbcc738905f7d4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ming-Hung Tsai <mtsai@redhat.com>
|
||||||
|
Date: Tue, 20 Oct 2020 15:18:06 +0800
|
||||||
|
Subject: [PATCH 2/2] [thin_delta] Clean up duplicated code
|
||||||
|
|
||||||
|
---
|
||||||
|
thin-provisioning/thin_delta.cc | 105 ++++++++++++----------------------------
|
||||||
|
1 file changed, 31 insertions(+), 74 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/thin-provisioning/thin_delta.cc b/thin-provisioning/thin_delta.cc
|
||||||
|
index ee48dea..2ff3e69 100644
|
||||||
|
--- a/thin-provisioning/thin_delta.cc
|
||||||
|
+++ b/thin-provisioning/thin_delta.cc
|
||||||
|
@@ -22,47 +22,7 @@ using namespace thin_provisioning;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
-namespace local {
|
||||||
|
- class application {
|
||||||
|
- public:
|
||||||
|
- application(string const &cmd)
|
||||||
|
- : cmd_(cmd) {
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- void usage(ostream &out) {
|
||||||
|
- out << "Usage: " << cmd_ << " [options] <device or file>\n"
|
||||||
|
- << "Options:\n"
|
||||||
|
- << " {--thin1, --snap1}\n"
|
||||||
|
- << " {--thin2, --snap2}\n"
|
||||||
|
- << " {-m, --metadata-snap} [block#]\n"
|
||||||
|
- << " {--verbose}\n"
|
||||||
|
- << " {-h|--help}\n"
|
||||||
|
- << " {-V|--version}" << endl;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- void die(string const &msg) {
|
||||||
|
- cerr << msg << endl;
|
||||||
|
- usage(cerr);
|
||||||
|
- exit(1);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- uint64_t parse_int(string const &str, string const &desc) {
|
||||||
|
- try {
|
||||||
|
- return boost::lexical_cast<uint64_t>(str);
|
||||||
|
-
|
||||||
|
- } catch (...) {
|
||||||
|
- ostringstream out;
|
||||||
|
- out << "Couldn't parse " << desc << ": '" << str << "'";
|
||||||
|
- die(out.str());
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return 0; // never get here
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- private:
|
||||||
|
- string cmd_;
|
||||||
|
- };
|
||||||
|
-
|
||||||
|
+namespace {
|
||||||
|
struct flags {
|
||||||
|
flags()
|
||||||
|
: verbose(false),
|
||||||
|
@@ -96,13 +56,6 @@ namespace local {
|
||||||
|
uint64_t vbegin_, dbegin_, len_;
|
||||||
|
};
|
||||||
|
|
||||||
|
- ostream &operator <<(ostream &out, mapping const &m) {
|
||||||
|
- out << "mapping[vbegin = " << m.vbegin_
|
||||||
|
- << ", dbegin = " << m.dbegin_
|
||||||
|
- << ", len = " << m.len_ << "]";
|
||||||
|
- return out;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
//--------------------------------
|
||||||
|
|
||||||
|
template <typename Container>
|
||||||
|
@@ -542,7 +495,7 @@ namespace local {
|
||||||
|
out << "</diff>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
- void delta_(application &app, flags const &fs) {
|
||||||
|
+ void delta_(flags const &fs) {
|
||||||
|
mapping_recorder mr1;
|
||||||
|
mapping_recorder mr2;
|
||||||
|
damage_visitor damage_v;
|
||||||
|
@@ -560,7 +513,7 @@ namespace local {
|
||||||
|
if (!snap1_root) {
|
||||||
|
ostringstream out;
|
||||||
|
out << "Unable to find mapping tree for snap1 (" << *fs.snap1 << ")";
|
||||||
|
- app.die(out.str());
|
||||||
|
+ throw std::runtime_error(out.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
single_mapping_tree snap1(*md->tm_, *snap1_root,
|
||||||
|
@@ -572,7 +525,7 @@ namespace local {
|
||||||
|
if (!snap2_root) {
|
||||||
|
ostringstream out;
|
||||||
|
out << "Unable to find mapping tree for snap2 (" << *fs.snap2 << ")";
|
||||||
|
- app.die(out.str());
|
||||||
|
+ throw std::runtime_error(out.str());
|
||||||
|
}
|
||||||
|
|
||||||
|
single_mapping_tree snap2(*md->tm_, *snap2_root,
|
||||||
|
@@ -609,12 +562,12 @@ namespace local {
|
||||||
|
end_superblock(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
- int delta(application &app, flags const &fs) {
|
||||||
|
+ int delta(flags const &fs) {
|
||||||
|
try {
|
||||||
|
- delta_(app, fs);
|
||||||
|
+ delta_(fs);
|
||||||
|
} catch (exception const &e) {
|
||||||
|
- app.die(e.what());
|
||||||
|
- return 1; // never get here
|
||||||
|
+ cerr << e.what() << endl;
|
||||||
|
+ return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -633,27 +586,31 @@ thin_delta_cmd::thin_delta_cmd()
|
||||||
|
void
|
||||||
|
thin_delta_cmd::usage(std::ostream &out) const
|
||||||
|
{
|
||||||
|
- // FIXME: finish
|
||||||
|
+ out << "Usage: " << get_name() << " [options] <device or file>\n"
|
||||||
|
+ << "Options:\n"
|
||||||
|
+ << " {--thin1, --snap1}\n"
|
||||||
|
+ << " {--thin2, --snap2}\n"
|
||||||
|
+ << " {-m, --metadata-snap} [block#]\n"
|
||||||
|
+ << " {--verbose}\n"
|
||||||
|
+ << " {-h|--help}\n"
|
||||||
|
+ << " {-V|--version}" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
thin_delta_cmd::run(int argc, char **argv)
|
||||||
|
{
|
||||||
|
- using namespace local;
|
||||||
|
-
|
||||||
|
int c;
|
||||||
|
flags fs;
|
||||||
|
- local::application app(basename(argv[0]));
|
||||||
|
|
||||||
|
char const shortopts[] = "hVm::";
|
||||||
|
option const longopts[] = {
|
||||||
|
{ "help", no_argument, NULL, 'h' },
|
||||||
|
+ { "metadata-snap", optional_argument, NULL, 'm' },
|
||||||
|
{ "version", no_argument, NULL, 'V' },
|
||||||
|
{ "thin1", required_argument, NULL, 1 },
|
||||||
|
{ "snap1", required_argument, NULL, 1 },
|
||||||
|
{ "thin2", required_argument, NULL, 2 },
|
||||||
|
{ "snap2", required_argument, NULL, 2 },
|
||||||
|
- { "metadata-snap", optional_argument, NULL, 'm' },
|
||||||
|
{ "verbose", no_argument, NULL, 4 },
|
||||||
|
{ NULL, no_argument, NULL, 0 }
|
||||||
|
};
|
||||||
|
@@ -661,25 +618,25 @@ thin_delta_cmd::run(int argc, char **argv)
|
||||||
|
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'h':
|
||||||
|
- app.usage(cout);
|
||||||
|
+ usage(cout);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
+ case 'm':
|
||||||
|
+ fs.use_metadata_snap = true;
|
||||||
|
+ if (optarg)
|
||||||
|
+ fs.metadata_snap = parse_uint64(optarg, "metadata snapshot block");
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
case 'V':
|
||||||
|
cout << THIN_PROVISIONING_TOOLS_VERSION << endl;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
- fs.snap1 = app.parse_int(optarg, "thin id 1");
|
||||||
|
+ fs.snap1 = parse_uint64(optarg, "thin id 1");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
- fs.snap2 = app.parse_int(optarg, "thin id 2");
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- case 'm':
|
||||||
|
- fs.use_metadata_snap = true;
|
||||||
|
- if (optarg)
|
||||||
|
- fs.metadata_snap = app.parse_int(optarg, "metadata snapshot block");
|
||||||
|
+ fs.snap2 = parse_uint64(optarg, "thin id 2");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
@@ -687,23 +644,23 @@ thin_delta_cmd::run(int argc, char **argv)
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
- app.usage(cerr);
|
||||||
|
+ usage(cerr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc == optind)
|
||||||
|
- app.die("No input device provided.");
|
||||||
|
+ die("No input device provided.");
|
||||||
|
else
|
||||||
|
fs.dev = argv[optind];
|
||||||
|
|
||||||
|
if (!fs.snap1)
|
||||||
|
- app.die("--snap1 not specified.");
|
||||||
|
+ die("--snap1 not specified.");
|
||||||
|
|
||||||
|
if (!fs.snap2)
|
||||||
|
- app.die("--snap2 not specified.");
|
||||||
|
+ die("--snap2 not specified.");
|
||||||
|
|
||||||
|
- return delta(app, fs);
|
||||||
|
+ return delta(fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
@ -1,356 +0,0 @@
|
|||||||
.../data-structures/btree_damage_visitor.h | 22 +++++++++++-----
|
|
||||||
thin-provisioning/device_tree.cc | 11 +++++---
|
|
||||||
thin-provisioning/device_tree.h | 6 +++--
|
|
||||||
thin-provisioning/mapping_tree.cc | 30 +++++++++++++---------
|
|
||||||
thin-provisioning/mapping_tree.h | 25 ++++++++++++------
|
|
||||||
thin-provisioning/metadata_dumper.cc | 16 ++++++------
|
|
||||||
thin-provisioning/thin_check.cc | 6 ++---
|
|
||||||
7 files changed, 73 insertions(+), 43 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/persistent-data/data-structures/btree_damage_visitor.h b/persistent-data/data-structures/btree_damage_visitor.h
|
|
||||||
index 1ff16a8..60e25d9 100644
|
|
||||||
--- a/persistent-data/data-structures/btree_damage_visitor.h
|
|
||||||
+++ b/persistent-data/data-structures/btree_damage_visitor.h
|
|
||||||
@@ -159,10 +159,12 @@ namespace persistent_data {
|
|
||||||
typedef boost::optional<run64> maybe_run64;
|
|
||||||
|
|
||||||
btree_damage_visitor(ValueVisitor &value_visitor,
|
|
||||||
- DamageVisitor &damage_visitor)
|
|
||||||
+ DamageVisitor &damage_visitor,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
: avoid_repeated_visits_(true),
|
|
||||||
value_visitor_(value_visitor),
|
|
||||||
- damage_visitor_(damage_visitor) {
|
|
||||||
+ damage_visitor_(damage_visitor),
|
|
||||||
+ ignore_non_fatal_(ignore_non_fatal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool visit_internal(node_location const &loc,
|
|
||||||
@@ -231,7 +233,7 @@ namespace persistent_data {
|
|
||||||
else if (!checker_.check_block_nr(n) ||
|
|
||||||
!checker_.check_value_size(n) ||
|
|
||||||
!checker_.check_max_entries(n) ||
|
|
||||||
- !checker_.check_nr_entries(n, loc.is_sub_root()) ||
|
|
||||||
+ !check_nr_entries(loc, n) ||
|
|
||||||
!checker_.check_ordered_keys(n) ||
|
|
||||||
!checker_.check_parent_key(n, loc.is_sub_root() ? boost::optional<uint64_t>() : loc.key)) {
|
|
||||||
report_damage(checker_.get_last_error_string());
|
|
||||||
@@ -255,7 +257,7 @@ namespace persistent_data {
|
|
||||||
else if (!checker_.check_block_nr(n) ||
|
|
||||||
!checker_.check_value_size(n) ||
|
|
||||||
!checker_.check_max_entries(n) ||
|
|
||||||
- !checker_.check_nr_entries(n, loc.is_sub_root()) ||
|
|
||||||
+ !check_nr_entries(loc, n) ||
|
|
||||||
!checker_.check_ordered_keys(n) ||
|
|
||||||
!checker_.check_parent_key(n, loc.is_sub_root() ? boost::optional<uint64_t>() : loc.key) ||
|
|
||||||
!checker_.check_leaf_key(n, last_leaf_key_[loc.level()])) {
|
|
||||||
@@ -353,6 +355,12 @@ namespace persistent_data {
|
|
||||||
maybe_issue_damage(*old_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ template <typename ValueTraits2>
|
|
||||||
+ bool check_nr_entries(node_location const &loc,
|
|
||||||
+ btree_detail::node_ref<ValueTraits2> const &n) {
|
|
||||||
+ return ignore_non_fatal_ || checker_.check_nr_entries(n, loc.is_sub_root());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
//--------------------------------
|
|
||||||
|
|
||||||
bool avoid_repeated_visits_;
|
|
||||||
@@ -367,15 +375,17 @@ namespace persistent_data {
|
|
||||||
path_tracker path_tracker_;
|
|
||||||
damage_tracker dt_;
|
|
||||||
std::list<std::string> damage_reasons_;
|
|
||||||
+ bool ignore_non_fatal_;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template <unsigned Levels, typename ValueTraits, typename ValueVisitor, typename DamageVisitor>
|
|
||||||
void btree_visit_values(btree<Levels, ValueTraits> const &tree,
|
|
||||||
ValueVisitor &value_visitor,
|
|
||||||
- DamageVisitor &damage_visitor) {
|
|
||||||
+ DamageVisitor &damage_visitor,
|
|
||||||
+ bool ignore_non_fatal = false) {
|
|
||||||
btree_detail::btree_damage_visitor<ValueVisitor, DamageVisitor, Levels, ValueTraits>
|
|
||||||
- v(value_visitor, damage_visitor);
|
|
||||||
+ v(value_visitor, damage_visitor, ignore_non_fatal);
|
|
||||||
tree.visit_depth_first(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/thin-provisioning/device_tree.cc b/thin-provisioning/device_tree.cc
|
|
||||||
index 4837cb7..8ae16f7 100644
|
|
||||||
--- a/thin-provisioning/device_tree.cc
|
|
||||||
+++ b/thin-provisioning/device_tree.cc
|
|
||||||
@@ -89,18 +89,21 @@ namespace thin_provisioning {
|
|
||||||
void
|
|
||||||
thin_provisioning::walk_device_tree(device_tree const &tree,
|
|
||||||
device_tree_detail::device_visitor &vv,
|
|
||||||
- device_tree_detail::damage_visitor &dv)
|
|
||||||
+ device_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
visitor_adapter av(vv);
|
|
||||||
ll_damage_visitor ll_dv(dv);
|
|
||||||
- btree_visit_values(tree, av, ll_dv);
|
|
||||||
+ btree_visit_values(tree, av, ll_dv, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
-thin_provisioning::check_device_tree(device_tree const &tree, damage_visitor &visitor)
|
|
||||||
+thin_provisioning::check_device_tree(device_tree const &tree,
|
|
||||||
+ damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
noop_visitor vv;
|
|
||||||
- walk_device_tree(tree, vv, visitor);
|
|
||||||
+ walk_device_tree(tree, vv, visitor, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
diff --git a/thin-provisioning/device_tree.h b/thin-provisioning/device_tree.h
|
|
||||||
index ec0f9f2..980f1a9 100644
|
|
||||||
--- a/thin-provisioning/device_tree.h
|
|
||||||
+++ b/thin-provisioning/device_tree.h
|
|
||||||
@@ -74,9 +74,11 @@ namespace thin_provisioning {
|
|
||||||
|
|
||||||
void walk_device_tree(device_tree const &tree,
|
|
||||||
device_tree_detail::device_visitor &dev_v,
|
|
||||||
- device_tree_detail::damage_visitor &dv);
|
|
||||||
+ device_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
void check_device_tree(device_tree const &tree,
|
|
||||||
- device_tree_detail::damage_visitor &visitor);
|
|
||||||
+ device_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
diff --git a/thin-provisioning/mapping_tree.cc b/thin-provisioning/mapping_tree.cc
|
|
||||||
index 5b69fe9..6c82095 100644
|
|
||||||
--- a/thin-provisioning/mapping_tree.cc
|
|
||||||
+++ b/thin-provisioning/mapping_tree.cc
|
|
||||||
@@ -220,54 +220,60 @@ namespace {
|
|
||||||
void
|
|
||||||
thin_provisioning::walk_mapping_tree(dev_tree const &tree,
|
|
||||||
mapping_tree_detail::device_visitor &dev_v,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv)
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
dev_tree_damage_visitor ll_dv(dv);
|
|
||||||
- btree_visit_values(tree, dev_v, ll_dv);
|
|
||||||
+ btree_visit_values(tree, dev_v, ll_dv, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
thin_provisioning::check_mapping_tree(dev_tree const &tree,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor)
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
noop_block_visitor dev_v;
|
|
||||||
- walk_mapping_tree(tree, dev_v, visitor);
|
|
||||||
+ walk_mapping_tree(tree, dev_v, visitor, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
thin_provisioning::walk_mapping_tree(mapping_tree const &tree,
|
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv)
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
mapping_tree_damage_visitor ll_dv(dv);
|
|
||||||
- btree_visit_values(tree, mv, ll_dv);
|
|
||||||
+ btree_visit_values(tree, mv, ll_dv, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
thin_provisioning::check_mapping_tree(mapping_tree const &tree,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor)
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
noop_block_time_visitor mv;
|
|
||||||
- walk_mapping_tree(tree, mv, visitor);
|
|
||||||
+ walk_mapping_tree(tree, mv, visitor, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
thin_provisioning::walk_mapping_tree(single_mapping_tree const &tree,
|
|
||||||
uint64_t dev_id,
|
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv)
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
single_mapping_tree_damage_visitor ll_dv(dv, dev_id);
|
|
||||||
- btree_visit_values(tree, mv, ll_dv);
|
|
||||||
+ btree_visit_values(tree, mv, ll_dv, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
thin_provisioning::check_mapping_tree(single_mapping_tree const &tree,
|
|
||||||
uint64_t dev_id,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor)
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal)
|
|
||||||
{
|
|
||||||
noop_block_time_visitor mv;
|
|
||||||
- walk_mapping_tree(tree, dev_id, mv, visitor);
|
|
||||||
+ walk_mapping_tree(tree, dev_id, mv, visitor, ignore_non_fatal);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
diff --git a/thin-provisioning/mapping_tree.h b/thin-provisioning/mapping_tree.h
|
|
||||||
index ce88ba2..68b5c4b 100644
|
|
||||||
--- a/thin-provisioning/mapping_tree.h
|
|
||||||
+++ b/thin-provisioning/mapping_tree.h
|
|
||||||
@@ -128,23 +128,32 @@ namespace thin_provisioning {
|
|
||||||
|
|
||||||
void walk_mapping_tree(dev_tree const &tree,
|
|
||||||
mapping_tree_detail::device_visitor &dev_v,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv);
|
|
||||||
- void check_mapping_tree(dev_tree const &tree,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor);
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
|
|
||||||
void walk_mapping_tree(mapping_tree const &tree,
|
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv);
|
|
||||||
- void check_mapping_tree(mapping_tree const &tree,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor);
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
|
|
||||||
void walk_mapping_tree(single_mapping_tree const &tree,
|
|
||||||
uint64_t dev_id,
|
|
||||||
mapping_tree_detail::mapping_visitor &mv,
|
|
||||||
- mapping_tree_detail::damage_visitor &dv);
|
|
||||||
+ mapping_tree_detail::damage_visitor &dv,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
+
|
|
||||||
void check_mapping_tree(single_mapping_tree const &tree,
|
|
||||||
uint64_t dev_id,
|
|
||||||
- mapping_tree_detail::damage_visitor &visitor);
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
+
|
|
||||||
+ void check_mapping_tree(dev_tree const &tree,
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
+
|
|
||||||
+ void check_mapping_tree(mapping_tree const &tree,
|
|
||||||
+ mapping_tree_detail::damage_visitor &visitor,
|
|
||||||
+ bool ignore_non_fatal = false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc
|
|
||||||
index ce28d2e..9ebc8d8 100644
|
|
||||||
--- a/thin-provisioning/metadata_dumper.cc
|
|
||||||
+++ b/thin-provisioning/metadata_dumper.cc
|
|
||||||
@@ -131,7 +131,7 @@ namespace {
|
|
||||||
auto tree = device_tree(tm, root, device_tree_detail::device_details_traits::ref_counter());
|
|
||||||
|
|
||||||
try {
|
|
||||||
- walk_device_tree(tree, de, dv);
|
|
||||||
+ walk_device_tree(tree, de, dv, true);
|
|
||||||
} catch (...) {
|
|
||||||
return optional<set<uint32_t>>();
|
|
||||||
}
|
|
||||||
@@ -156,7 +156,7 @@ namespace {
|
|
||||||
auto tree = dev_tree(tm, root, mapping_tree_detail::mtree_traits::ref_counter(tm));
|
|
||||||
|
|
||||||
try {
|
|
||||||
- walk_mapping_tree(tree, me, mv);
|
|
||||||
+ walk_mapping_tree(tree, me, mv, true);
|
|
||||||
} catch (...) {
|
|
||||||
return optional<set<uint32_t>>();
|
|
||||||
}
|
|
||||||
@@ -722,7 +722,7 @@ namespace {
|
|
||||||
// Since we're not mutating the btrees we don't need a real space map
|
|
||||||
noop_map::ptr sm(new noop_map);
|
|
||||||
single_mapping_tree tree(tm_, subtree_root, mapping_tree_detail::block_time_ref_counter(sm));
|
|
||||||
- walk_mapping_tree(tree, dev_id, static_cast<mapping_tree_detail::mapping_visitor &>(me), *damage_policy_);
|
|
||||||
+ walk_mapping_tree(tree, dev_id, static_cast<mapping_tree_detail::mapping_visitor &>(me), *damage_policy_, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_options const &opts_;
|
|
||||||
@@ -752,7 +752,7 @@ namespace {
|
|
||||||
dump_options opts;
|
|
||||||
details_extractor de(opts);
|
|
||||||
device_tree_detail::damage_visitor::ptr dd_policy(details_damage_policy(true));
|
|
||||||
- walk_device_tree(*md.details_, de, *dd_policy);
|
|
||||||
+ walk_device_tree(*md.details_, de, *dd_policy, true);
|
|
||||||
|
|
||||||
e->begin_superblock("", sb.time_,
|
|
||||||
sb.trans_id_,
|
|
||||||
@@ -765,7 +765,7 @@ namespace {
|
|
||||||
{
|
|
||||||
mapping_tree_detail::damage_visitor::ptr md_policy(mapping_damage_policy(true));
|
|
||||||
mapping_tree_emit_visitor mte(opts, *md.tm_, e, de.get_details(), mapping_damage_policy(true));
|
|
||||||
- walk_mapping_tree(*md.mappings_top_level_, mte, *md_policy);
|
|
||||||
+ walk_mapping_tree(*md.mappings_top_level_, mte, *md_policy, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
e->end_superblock();
|
|
||||||
@@ -801,7 +801,7 @@ thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, dump_options
|
|
||||||
{
|
|
||||||
details_extractor de(opts);
|
|
||||||
device_tree_detail::damage_visitor::ptr dd_policy(details_damage_policy(false));
|
|
||||||
- walk_device_tree(*md->details_, de, *dd_policy);
|
|
||||||
+ walk_device_tree(*md->details_, de, *dd_policy, true);
|
|
||||||
|
|
||||||
e->begin_superblock("", md->sb_.time_,
|
|
||||||
md->sb_.trans_id_,
|
|
||||||
@@ -814,7 +814,7 @@ thin_provisioning::metadata_dump(metadata::ptr md, emitter::ptr e, dump_options
|
|
||||||
{
|
|
||||||
mapping_tree_detail::damage_visitor::ptr md_policy(mapping_damage_policy(false));
|
|
||||||
mapping_tree_emit_visitor mte(opts, *md->tm_, e, de.get_details(), mapping_damage_policy(false));
|
|
||||||
- walk_mapping_tree(*md->mappings_top_level_, mte, *md_policy);
|
|
||||||
+ walk_mapping_tree(*md->mappings_top_level_, mte, *md_policy, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
e->end_superblock();
|
|
||||||
@@ -844,7 +844,7 @@ thin_provisioning::metadata_dump_subtree(metadata::ptr md, emitter::ptr e, bool
|
|
||||||
mapping_tree_detail::block_time_ref_counter(md->data_sm_));
|
|
||||||
// FIXME: pass the current device id instead of zero
|
|
||||||
walk_mapping_tree(tree, 0, static_cast<mapping_tree_detail::mapping_visitor &>(me),
|
|
||||||
- *mapping_damage_policy(repair));
|
|
||||||
+ *mapping_damage_policy(repair), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
|
||||||
diff --git a/thin-provisioning/thin_check.cc b/thin-provisioning/thin_check.cc
|
|
||||||
index 6373603..c2612b5 100644
|
|
||||||
--- a/thin-provisioning/thin_check.cc
|
|
||||||
+++ b/thin-provisioning/thin_check.cc
|
|
||||||
@@ -244,7 +244,7 @@ namespace {
|
|
||||||
nested_output::nest _ = out.push();
|
|
||||||
device_tree dtree(*tm, sb.device_details_root_,
|
|
||||||
device_tree_detail::device_details_traits::ref_counter());
|
|
||||||
- check_device_tree(dtree, dev_rep);
|
|
||||||
+ check_device_tree(dtree, dev_rep, fs.ignore_non_fatal_errors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ namespace {
|
|
||||||
nested_output::nest _ = out.push();
|
|
||||||
dev_tree dtree(*tm, mapping_root(sb, fs),
|
|
||||||
mapping_tree_detail::mtree_traits::ref_counter(*tm));
|
|
||||||
- check_mapping_tree(dtree, mapping_rep);
|
|
||||||
+ check_mapping_tree(dtree, mapping_rep, fs.ignore_non_fatal_errors);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (fs.check_mapping_tree_level2) {
|
|
||||||
@@ -263,7 +263,7 @@ namespace {
|
|
||||||
nested_output::nest _ = out.push();
|
|
||||||
mapping_tree mtree(*tm, mapping_root(sb, fs),
|
|
||||||
mapping_tree_detail::block_traits::ref_counter(tm->get_sm()));
|
|
||||||
- check_mapping_tree(mtree, mapping_rep);
|
|
||||||
+ check_mapping_tree(mtree, mapping_rep, fs.ignore_non_fatal_errors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
man8/thin_trim.txt | 3 ---
|
|
||||||
1 file changed, 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man8/thin_trim.txt b/man8/thin_trim.txt
|
|
||||||
index 1d24a06..e19d8bd 100644
|
|
||||||
--- a/man8/thin_trim.txt
|
|
||||||
+++ b/man8/thin_trim.txt
|
|
||||||
@@ -12,9 +12,6 @@ DESCRIPTION
|
|
||||||
OPTIONS
|
|
||||||
-h, --help Print help and exit.
|
|
||||||
-V, --version Print version information and exit.
|
|
||||||
- --pool-inactive Indicates you are aware the pool should be inactive.
|
|
||||||
-
|
|
||||||
- Suppresses a warning message and prompt.
|
|
||||||
|
|
||||||
SEE ALSO
|
|
||||||
thin_dump(8), thin_repair(8), thin_restore(8), thin_rmap(8), thin_metadata_size(8)
|
|
@ -1,77 +0,0 @@
|
|||||||
ft-lib/bcache.c | 16 ++++++++--------
|
|
||||||
1 file changed, 8 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ft-lib/bcache.c b/ft-lib/bcache.c
|
|
||||||
index 0dca503..ee5b6c5 100644
|
|
||||||
--- a/ft-lib/bcache.c
|
|
||||||
+++ b/ft-lib/bcache.c
|
|
||||||
@@ -31,7 +31,7 @@ static void warn(const char *fmt, ...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: raise a condition somehow?
|
|
||||||
-static void raise(const char *fmt, ...)
|
|
||||||
+static void raise_(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ static inline struct list_head *list_pop(struct list_head *head)
|
|
||||||
struct list_head *l;
|
|
||||||
|
|
||||||
if (head->next == head)
|
|
||||||
- raise("list is empty\n");
|
|
||||||
+ raise_("list is empty\n");
|
|
||||||
|
|
||||||
l = head->next;
|
|
||||||
list_del(l);
|
|
||||||
@@ -98,7 +98,7 @@ static struct cb_set *cb_set_create(unsigned nr)
|
|
||||||
static void cb_set_destroy(struct cb_set *cbs)
|
|
||||||
{
|
|
||||||
if (!list_empty(&cbs->allocated))
|
|
||||||
- raise("async io still in flight");
|
|
||||||
+ raise_("async io still in flight");
|
|
||||||
|
|
||||||
free(cbs->vec);
|
|
||||||
free(cbs);
|
|
||||||
@@ -713,13 +713,13 @@ struct bcache *bcache_simple(const char *path, unsigned nr_cache_blocks)
|
|
||||||
uint64_t s;
|
|
||||||
|
|
||||||
if (fd < 0) {
|
|
||||||
- raise("couldn't open cache file");
|
|
||||||
+ raise_("couldn't open cache file");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = fstat(fd, &info);
|
|
||||||
if (r < 0) {
|
|
||||||
- raise("couldn't stat cache file");
|
|
||||||
+ raise_("couldn't stat cache file");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -751,7 +751,7 @@ void bcache_destroy(struct bcache *cache)
|
|
||||||
static void check_index(struct bcache *cache, block_address index)
|
|
||||||
{
|
|
||||||
if (index >= cache->nr_data_blocks)
|
|
||||||
- raise("block out of bounds (%llu >= %llu)",
|
|
||||||
+ raise_("block out of bounds (%llu >= %llu)",
|
|
||||||
(unsigned long long) index,
|
|
||||||
(unsigned long long) cache->nr_data_blocks);
|
|
||||||
}
|
|
||||||
@@ -802,7 +802,7 @@ static struct block *lookup_or_read_block(struct bcache *cache,
|
|
||||||
// FIXME: this is insufficient. We need to also catch a read
|
|
||||||
// lock of a write locked block. Ref count needs to distinguish.
|
|
||||||
if (b->ref_count && (flags & (GF_DIRTY | GF_ZERO)))
|
|
||||||
- raise("concurrent write lock attempt");
|
|
||||||
+ raise_("concurrent write lock attempt");
|
|
||||||
|
|
||||||
if (test_flags(b, BF_IO_PENDING)) {
|
|
||||||
miss(cache, flags);
|
|
||||||
@@ -858,7 +858,7 @@ struct block *get_block(struct bcache *cache, block_address index, unsigned flag
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
- raise("couldn't get block");
|
|
||||||
+ raise_("couldn't get block");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
@ -1,298 +0,0 @@
|
|||||||
base/file_utils.cc | 4 ++--
|
|
||||||
base/file_utils.h | 2 +-
|
|
||||||
caching/cache_repair.cc | 8 +++++++-
|
|
||||||
functional-tests/cache-functional-tests.scm | 32 ++++++++++++++++++++++++++---
|
|
||||||
functional-tests/era-functional-tests.scm | 4 ++--
|
|
||||||
functional-tests/functional-tests.scm | 4 ++--
|
|
||||||
functional-tests/thin-functional-tests.scm | 27 ++++++++++++++++++++++--
|
|
||||||
thin-provisioning/thin_repair.cc | 8 +++++++-
|
|
||||||
8 files changed, 75 insertions(+), 14 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/base/file_utils.cc b/base/file_utils.cc
|
|
||||||
index ba8957c..7883cfe 100644
|
|
||||||
--- a/base/file_utils.cc
|
|
||||||
+++ b/base/file_utils.cc
|
|
||||||
@@ -66,13 +66,13 @@ file_utils::file_exists(string const &path) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
-file_utils::check_file_exists(string const &file) {
|
|
||||||
+file_utils::check_file_exists(string const &file, bool must_be_regular_file) {
|
|
||||||
struct stat info;
|
|
||||||
int r = ::stat(file.c_str(), &info);
|
|
||||||
if (r)
|
|
||||||
throw runtime_error("Couldn't stat file");
|
|
||||||
|
|
||||||
- if (!S_ISREG(info.st_mode))
|
|
||||||
+ if (must_be_regular_file && !S_ISREG(info.st_mode))
|
|
||||||
throw runtime_error("Not a regular file");
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/base/file_utils.h b/base/file_utils.h
|
|
||||||
index 2ee20ab..3edcc9e 100644
|
|
||||||
--- a/base/file_utils.h
|
|
||||||
+++ b/base/file_utils.h
|
|
||||||
@@ -10,7 +10,7 @@
|
|
||||||
namespace file_utils {
|
|
||||||
int open_file(std::string const &path, int flags);
|
|
||||||
bool file_exists(std::string const &path);
|
|
||||||
- void check_file_exists(std::string const &file);
|
|
||||||
+ void check_file_exists(std::string const &file, bool must_be_regular_file = true);
|
|
||||||
int create_block_file(std::string const &path, off_t file_size);
|
|
||||||
int open_block_file(std::string const &path, off_t min_size, bool writeable, bool excl = true);
|
|
||||||
uint64_t get_file_length(std::string const &file);
|
|
||||||
diff --git a/caching/cache_repair.cc b/caching/cache_repair.cc
|
|
||||||
index 9587d5f..8a837a8 100644
|
|
||||||
--- a/caching/cache_repair.cc
|
|
||||||
+++ b/caching/cache_repair.cc
|
|
||||||
@@ -2,6 +2,7 @@
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <libgen.h>
|
|
||||||
|
|
||||||
+#include "base/file_utils.h"
|
|
||||||
#include "base/output_file_requirements.h"
|
|
||||||
#include "caching/commands.h"
|
|
||||||
#include "caching/metadata.h"
|
|
||||||
@@ -29,12 +30,17 @@ namespace {
|
|
||||||
}
|
|
||||||
|
|
||||||
int repair(string const &old_path, string const &new_path) {
|
|
||||||
+ bool metadata_touched = false;
|
|
||||||
try {
|
|
||||||
+ file_utils::check_file_exists(new_path, false);
|
|
||||||
+ metadata_touched = true;
|
|
||||||
metadata_dump(open_metadata_for_read(old_path),
|
|
||||||
output_emitter(new_path),
|
|
||||||
true);
|
|
||||||
|
|
||||||
} catch (std::exception &e) {
|
|
||||||
+ if (metadata_touched)
|
|
||||||
+ file_utils::zero_superblock(new_path);
|
|
||||||
cerr << e.what() << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -110,7 +116,7 @@ cache_repair_cmd::run(int argc, char **argv)
|
|
||||||
check_output_file_requirements(*output_path);
|
|
||||||
|
|
||||||
else {
|
|
||||||
- cerr << "no output file provided" << endl;
|
|
||||||
+ cerr << "No output file provided." << endl;
|
|
||||||
usage(cerr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
diff --git a/functional-tests/cache-functional-tests.scm b/functional-tests/cache-functional-tests.scm
|
|
||||||
index 0e70b94..9b3a203 100644
|
|
||||||
--- a/functional-tests/cache-functional-tests.scm
|
|
||||||
+++ b/functional-tests/cache-functional-tests.scm
|
|
||||||
@@ -15,6 +15,7 @@
|
|
||||||
(define-tool cache-dump)
|
|
||||||
(define-tool cache-restore)
|
|
||||||
(define-tool cache-metadata-size)
|
|
||||||
+ (define-tool cache-repair)
|
|
||||||
|
|
||||||
(define-syntax with-cache-xml
|
|
||||||
(syntax-rules ()
|
|
||||||
@@ -35,7 +36,8 @@
|
|
||||||
(syntax-rules ()
|
|
||||||
((_ (md) b1 b2 ...)
|
|
||||||
(with-temp-file-sized ((md "cache.bin" (to-bytes (meg 4))))
|
|
||||||
- b1 b2 ...))))
|
|
||||||
+ (system (fmt #f "dd if=/usr/bin/ls of=" md " bs=4096 > /dev/null 2>&1"))
|
|
||||||
+ b1 b2 ...))))
|
|
||||||
|
|
||||||
(define-syntax with-empty-metadata
|
|
||||||
(syntax-rules ()
|
|
||||||
@@ -180,7 +182,7 @@
|
|
||||||
"the input file can't be found"
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(run-fail-rcv (_ stderr) (cache-restore "-i no-such-file -o" md)
|
|
||||||
- (assert-superblock-untouched md)
|
|
||||||
+ (assert-superblock-all-zeroes md)
|
|
||||||
(assert-starts-with "Couldn't stat file" stderr))))
|
|
||||||
|
|
||||||
(define-scenario (cache-restore garbage-input-file)
|
|
||||||
@@ -188,7 +190,7 @@
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(with-temp-file-sized ((xml "cache.xml" 4096))
|
|
||||||
(run-fail-rcv (_ stderr) (cache-restore "-i" xml "-o" md)
|
|
||||||
- (assert-superblock-untouched md)))))
|
|
||||||
+ (assert-superblock-all-zeroes md)))))
|
|
||||||
|
|
||||||
(define-scenario (cache-restore missing-output-file)
|
|
||||||
"the output file can't be found"
|
|
||||||
@@ -354,4 +356,28 @@
|
|
||||||
(run-ok-rcv (stdout stderr) (cache-metadata-size "--nr-blocks 67108864")
|
|
||||||
(assert-equal "3678208 sectors" stdout)
|
|
||||||
(assert-eof stderr)))
|
|
||||||
+
|
|
||||||
+ ;;;-----------------------------------------------------------
|
|
||||||
+ ;;; cache_repair scenarios
|
|
||||||
+ ;;;-----------------------------------------------------------
|
|
||||||
+ (define-scenario (cache-repair missing-input-file)
|
|
||||||
+ "the input file can't be found"
|
|
||||||
+ (with-empty-metadata (md)
|
|
||||||
+ (run-fail-rcv (_ stderr) (cache-repair "-i no-such-file -o" md)
|
|
||||||
+ (assert-superblock-all-zeroes md)
|
|
||||||
+ (assert-starts-with "Couldn't stat path" stderr))))
|
|
||||||
+
|
|
||||||
+ (define-scenario (cache-repair garbage-input-file)
|
|
||||||
+ "the input file is just zeroes"
|
|
||||||
+ (with-empty-metadata (md1)
|
|
||||||
+ (with-corrupt-metadata (md2)
|
|
||||||
+ (run-fail-rcv (_ stderr) (cache-repair "-i" md1 "-o" md2)
|
|
||||||
+ (assert-superblock-all-zeroes md2)))))
|
|
||||||
+
|
|
||||||
+ (define-scenario (cache-repair missing-output-file)
|
|
||||||
+ "the output file can't be found"
|
|
||||||
+ (with-cache-xml (xml)
|
|
||||||
+ (run-fail-rcv (_ stderr) (cache-repair "-i" xml)
|
|
||||||
+ (assert-starts-with "No output file provided." stderr))))
|
|
||||||
+
|
|
||||||
)
|
|
||||||
diff --git a/functional-tests/era-functional-tests.scm b/functional-tests/era-functional-tests.scm
|
|
||||||
index 373fe34..890f0ff 100644
|
|
||||||
--- a/functional-tests/era-functional-tests.scm
|
|
||||||
+++ b/functional-tests/era-functional-tests.scm
|
|
||||||
@@ -153,7 +153,7 @@
|
|
||||||
"the input file can't be found"
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(run-fail-rcv (_ stderr) (era-restore "-i no-such-file -o" md)
|
|
||||||
- (assert-superblock-untouched md)
|
|
||||||
+ (assert-superblock-all-zeroes md)
|
|
||||||
(assert-starts-with "Couldn't stat file" stderr))))
|
|
||||||
|
|
||||||
(define-scenario (era-restore garbage-input-file)
|
|
||||||
@@ -161,7 +161,7 @@
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(with-temp-file-sized ((xml "era.xml" 4096))
|
|
||||||
(run-fail-rcv (_ stderr) (era-restore "-i " xml "-o" md)
|
|
||||||
- (assert-superblock-untouched md)))))
|
|
||||||
+ (assert-superblock-all-zeroes md)))))
|
|
||||||
|
|
||||||
(define-scenario (era-restore output-unspecified)
|
|
||||||
"Fails if no metadata dev specified"
|
|
||||||
diff --git a/functional-tests/functional-tests.scm b/functional-tests/functional-tests.scm
|
|
||||||
index aa5b95c..758498e 100644
|
|
||||||
--- a/functional-tests/functional-tests.scm
|
|
||||||
+++ b/functional-tests/functional-tests.scm
|
|
||||||
@@ -21,7 +21,7 @@
|
|
||||||
assert-eof
|
|
||||||
assert-starts-with
|
|
||||||
assert-matches
|
|
||||||
- assert-superblock-untouched
|
|
||||||
+ assert-superblock-all-zeroes
|
|
||||||
assert-member?
|
|
||||||
assert-raises-thunk
|
|
||||||
assert-raises
|
|
||||||
@@ -259,7 +259,7 @@
|
|
||||||
(loop (+ i 1))
|
|
||||||
#f)))))
|
|
||||||
|
|
||||||
- (define (assert-superblock-untouched md)
|
|
||||||
+ (define (assert-superblock-all-zeroes md)
|
|
||||||
(with-bcache (cache md 1)
|
|
||||||
(with-block (b cache 0 (get-flags))
|
|
||||||
(unless (all-zeroes? (block-data b) 4096)
|
|
||||||
diff --git a/functional-tests/thin-functional-tests.scm b/functional-tests/thin-functional-tests.scm
|
|
||||||
index d096b78..6bb7d24 100644
|
|
||||||
--- a/functional-tests/thin-functional-tests.scm
|
|
||||||
+++ b/functional-tests/thin-functional-tests.scm
|
|
||||||
@@ -37,10 +37,12 @@
|
|
||||||
b1 b2 ...)))))
|
|
||||||
|
|
||||||
;;; It would be nice if the metadata was at least similar to valid data.
|
|
||||||
+ ;;; Here I'm just using the start of the ls binary as 'random' data.
|
|
||||||
(define-syntax with-corrupt-metadata
|
|
||||||
(syntax-rules ()
|
|
||||||
((_ (md) b1 b2 ...)
|
|
||||||
(with-temp-file-sized ((md "thin.bin" (meg 4)))
|
|
||||||
+ (system (fmt #f "dd if=/usr/bin/ls of=" md " bs=4096 > /dev/null 2>&1"))
|
|
||||||
b1 b2 ...))))
|
|
||||||
|
|
||||||
(define-syntax with-empty-metadata
|
|
||||||
@@ -167,7 +169,7 @@
|
|
||||||
"the input file can't be found"
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(run-fail-rcv (_ stderr) (thin-restore "-i no-such-file -o" md)
|
|
||||||
- (assert-superblock-untouched md)
|
|
||||||
+ (assert-superblock-all-zeroes md)
|
|
||||||
(assert-starts-with "Couldn't stat file" stderr))))
|
|
||||||
|
|
||||||
(define-scenario (thin-restore garbage-input-file)
|
|
||||||
@@ -175,7 +177,7 @@
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(with-temp-file-sized ((xml "thin.xml" 4096))
|
|
||||||
(run-fail-rcv (_ stderr) (thin-restore "-i " xml "-o" md)
|
|
||||||
- (assert-superblock-untouched md)))))
|
|
||||||
+ (assert-superblock-all-zeroes md)))))
|
|
||||||
|
|
||||||
(define-scenario (thin-restore missing-output-file)
|
|
||||||
"the output file can't be found"
|
|
||||||
@@ -333,4 +335,25 @@
|
|
||||||
(with-empty-metadata (md)
|
|
||||||
(run-fail-rcv (_ stderr) (thin-repair "-i" xml "-o" md)
|
|
||||||
#t))))
|
|
||||||
+
|
|
||||||
+ (define-scenario (thin-repair missing-input-file)
|
|
||||||
+ "the input file can't be found"
|
|
||||||
+ (with-empty-metadata (md)
|
|
||||||
+ (run-fail-rcv (_ stderr) (thin-repair "-i no-such-file -o" md)
|
|
||||||
+ (assert-superblock-all-zeroes md)
|
|
||||||
+ (assert-starts-with "Couldn't stat file" stderr))))
|
|
||||||
+
|
|
||||||
+ (define-scenario (thin-repair garbage-input-file)
|
|
||||||
+ "the input file is just zeroes"
|
|
||||||
+ (with-empty-metadata (md1)
|
|
||||||
+ (with-corrupt-metadata (md2)
|
|
||||||
+ (run-fail-rcv (_ stderr) (thin-repair "-i " md1 "-o" md2)
|
|
||||||
+ (assert-superblock-all-zeroes md2)))))
|
|
||||||
+
|
|
||||||
+ (define-scenario (thin-repair missing-output-file)
|
|
||||||
+ "the output file can't be found"
|
|
||||||
+ (with-thin-xml (xml)
|
|
||||||
+ (run-fail-rcv (_ stderr) (thin-repair "-i " xml)
|
|
||||||
+ (assert-starts-with "No output file provided." stderr))))
|
|
||||||
+
|
|
||||||
)
|
|
||||||
diff --git a/thin-provisioning/thin_repair.cc b/thin-provisioning/thin_repair.cc
|
|
||||||
index e22b193..0673753 100644
|
|
||||||
--- a/thin-provisioning/thin_repair.cc
|
|
||||||
+++ b/thin-provisioning/thin_repair.cc
|
|
||||||
@@ -2,6 +2,7 @@
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <libgen.h>
|
|
||||||
|
|
||||||
+#include "base/file_utils.h"
|
|
||||||
#include "base/output_file_requirements.h"
|
|
||||||
#include "persistent-data/file_utils.h"
|
|
||||||
#include "thin-provisioning/commands.h"
|
|
||||||
@@ -17,15 +18,20 @@ using namespace thin_provisioning;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
int repair(string const &old_path, string const &new_path) {
|
|
||||||
+ bool metadata_touched = false;
|
|
||||||
try {
|
|
||||||
// block size gets updated by the restorer
|
|
||||||
block_manager<>::ptr new_bm = open_bm(new_path, block_manager<>::READ_WRITE);
|
|
||||||
+ file_utils::check_file_exists(old_path, false);
|
|
||||||
+ metadata_touched = true;
|
|
||||||
metadata::ptr new_md(new metadata(new_bm, metadata::CREATE, 128, 0));
|
|
||||||
emitter::ptr e = create_restore_emitter(new_md);
|
|
||||||
block_manager<>::ptr old_bm = open_bm(old_path, block_manager<>::READ_ONLY);
|
|
||||||
metadata_repair(old_bm, e);
|
|
||||||
|
|
||||||
} catch (std::exception &e) {
|
|
||||||
+ if (metadata_touched)
|
|
||||||
+ file_utils::zero_superblock(new_path);
|
|
||||||
cerr << e.what() << endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@@ -101,7 +107,7 @@ thin_repair_cmd::run(int argc, char **argv)
|
|
||||||
check_output_file_requirements(*output_path);
|
|
||||||
|
|
||||||
else {
|
|
||||||
- cerr << "no output file provided" << endl;
|
|
||||||
+ cerr << "No output file provided." << endl;
|
|
||||||
usage(cerr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
@ -2,24 +2,43 @@
|
|||||||
# Copyright (C) 2011-2017 Red Hat, Inc
|
# Copyright (C) 2011-2017 Red Hat, Inc
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# The suffix for tarball and directory:
|
||||||
|
#%%global version_suffix -rc2
|
||||||
|
# The release suffix for RPMs:
|
||||||
|
#%%global release_suffix .test3
|
||||||
|
|
||||||
Summary: Device-mapper Persistent Data Tools
|
Summary: Device-mapper Persistent Data Tools
|
||||||
Name: device-mapper-persistent-data
|
Name: device-mapper-persistent-data
|
||||||
Version: 0.8.5
|
Version: 0.9.0
|
||||||
Release: 4%{?dist}
|
Release: 1%{?dist}%{?release_suffix}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
|
||||||
URL: https://github.com/jthornber/thin-provisioning-tools
|
URL: https://github.com/jthornber/thin-provisioning-tools
|
||||||
#Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provisioning-tools-% {version}.tar.gz
|
#Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provisioning-tools-%%{version}.tar.gz
|
||||||
Source0: https://github.com/jthornber/thin-provisioning-tools/archive/v%{version}.tar.gz
|
Source0: https://github.com/jthornber/thin-provisioning-tools/archive/v%{version}%{?version_suffix}.tar.gz
|
||||||
|
Source1: dmpd090-vendor2.tar.gz
|
||||||
Patch0: device-mapper-persistent-data-avoid-strip.patch
|
Patch0: device-mapper-persistent-data-avoid-strip.patch
|
||||||
Patch1: dmpd-remove-pool-inactive-from-thin_trim-man-page.patch
|
Patch1: 0001-Update-dependencies.patch
|
||||||
Patch2: dmpd-thin_repair-cache_repair-Check-input-file-exists-earlier.patch
|
Patch2: 0001-all-Fix-resource-leaks.patch
|
||||||
Patch3: dmpd-tests-lib-bcache-rename-raise-raise_.patch
|
Patch3: 0002-thin_show_metadata-Fix-out-of-bounds-access.patch
|
||||||
# BZ 1868235:
|
Patch4: 0003-build-Fix-customized-emitter-linkage.patch
|
||||||
Patch4: dmpd-0_9_0-thin_check-dump-Under-populated-nodes-are-now-non-fatal.patch
|
Patch5: 0004-thin_dump-Fix-leaked-shared-object-handle.patch
|
||||||
|
Patch6: 0005-thin_show_duplicates-Fix-potential-errors.patch
|
||||||
|
Patch7: 0006-thin_metadata_size-Fix-potential-string-overflow.patch
|
||||||
|
Patch8: 0007-all-Fix-uninitialized-class-members.patch
|
||||||
|
Patch9: 0008-thin_dump-Fix-warnings-on-potential-NULL-pointer.patch
|
||||||
|
Patch10: 0009-build-Remove-unused-sources-from-the-regular-build.patch
|
||||||
|
Patch11: 0010-all-Remove-unreachable-code.patch
|
||||||
|
Patch12: 0011-file_utils-Fix-resource-leak.patch
|
||||||
|
Patch13: 0012-thin_delta-Clean-up-duplicated-code.patch
|
||||||
|
|
||||||
BuildRequires: autoconf, expat-devel, libaio-devel, libstdc++-devel, boost-devel, gcc-c++
|
BuildRequires: autoconf, expat-devel, libaio-devel, libstdc++-devel, boost-devel, gcc-c++
|
||||||
Requires: expat
|
Requires: expat
|
||||||
|
%ifarch %{rust_arches}
|
||||||
|
BuildRequires: rust-toolset
|
||||||
|
BuildRequires: rust >= 1.35
|
||||||
|
BuildRequires: cargo
|
||||||
|
%endif
|
||||||
|
BuildRequires: make
|
||||||
|
|
||||||
%description
|
%description
|
||||||
thin-provisioning-tools contains check,dump,restore,repair,rmap
|
thin-provisioning-tools contains check,dump,restore,repair,rmap
|
||||||
@ -30,23 +49,52 @@ are included and era check, dump, restore and invalidate to manage
|
|||||||
snapshot eras
|
snapshot eras
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n thin-provisioning-tools-%{version}
|
%setup -q -n thin-provisioning-tools-%{version}%{?version_suffix}
|
||||||
|
%ifarch %{rust_arches}
|
||||||
|
%patch1 -p1 -b .toml_update
|
||||||
|
#%%cargo_prep
|
||||||
|
#%%cargo_generate_buildrequires
|
||||||
|
tar xf %{SOURCE1}
|
||||||
|
mkdir -p .cargo
|
||||||
|
cat > .cargo/config <<END
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "vendor"
|
||||||
|
|
||||||
|
END
|
||||||
|
%endif
|
||||||
%patch0 -p1 -b .avoid_strip
|
%patch0 -p1 -b .avoid_strip
|
||||||
%patch1 -p1 -b .remove_pool_inactive_option
|
%patch2 -p1 -b .backup2
|
||||||
%patch2 -p1 -b .check_input_file_erlier
|
|
||||||
%patch3 -p1 -b .backup3
|
%patch3 -p1 -b .backup3
|
||||||
%patch4 -p1 -b .underful_btree
|
%patch4 -p1 -b .backup4
|
||||||
|
%patch5 -p1 -b .backup5
|
||||||
|
%patch6 -p1 -b .backup6
|
||||||
|
%patch7 -p1 -b .backup7
|
||||||
|
%patch8 -p1 -b .backup8
|
||||||
|
%patch9 -p1 -b .backup9
|
||||||
|
%patch10 -p1 -b .backup10
|
||||||
|
%patch11 -p1 -b .backup11
|
||||||
|
%patch12 -p1 -b .backup12
|
||||||
|
%patch13 -p1 -b .backup13
|
||||||
echo %{version}-%{release} > VERSION
|
echo %{version}-%{release} > VERSION
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoconf
|
autoconf
|
||||||
%configure --with-optimisation=
|
%configure --with-optimisation=
|
||||||
make %{?_smp_mflags} V=
|
make %{?_smp_mflags} V=
|
||||||
|
%ifarch %{rust_arches}
|
||||||
|
%cargo_build
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
|
make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
|
||||||
|
%ifarch %{rust_arches}
|
||||||
%clean
|
make DESTDIR=%{buildroot} MANDIR=%{_mandir} install-rust-tools
|
||||||
|
# cargo_install installs into /usr/bin
|
||||||
|
#%%cargo_install
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc COPYING README.md
|
%doc COPYING README.md
|
||||||
@ -69,6 +117,10 @@ make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
|
|||||||
%{_mandir}/man8/thin_restore.8.gz
|
%{_mandir}/man8/thin_restore.8.gz
|
||||||
%{_mandir}/man8/thin_rmap.8.gz
|
%{_mandir}/man8/thin_rmap.8.gz
|
||||||
%{_mandir}/man8/thin_trim.8.gz
|
%{_mandir}/man8/thin_trim.8.gz
|
||||||
|
%ifarch %{rust_arches}
|
||||||
|
%{_mandir}/man8/thin_metadata_pack.8.gz
|
||||||
|
%{_mandir}/man8/thin_metadata_unpack.8.gz
|
||||||
|
%endif
|
||||||
%{_sbindir}/pdata_tools
|
%{_sbindir}/pdata_tools
|
||||||
%{_sbindir}/cache_check
|
%{_sbindir}/cache_check
|
||||||
%{_sbindir}/cache_dump
|
%{_sbindir}/cache_dump
|
||||||
@ -89,9 +141,19 @@ make DESTDIR=%{buildroot} MANDIR=%{_mandir} install
|
|||||||
%{_sbindir}/thin_restore
|
%{_sbindir}/thin_restore
|
||||||
%{_sbindir}/thin_rmap
|
%{_sbindir}/thin_rmap
|
||||||
%{_sbindir}/thin_trim
|
%{_sbindir}/thin_trim
|
||||||
|
%ifarch %{rust_arches}
|
||||||
|
%{_sbindir}/thin_metadata_pack
|
||||||
|
%{_sbindir}/thin_metadata_unpack
|
||||||
|
%endif
|
||||||
#% {_sbindir}/thin_show_duplicates
|
#% {_sbindir}/thin_show_duplicates
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 14 2021 Marian Csontos <mcsontos@redhat.com> - 0.9.0-1
|
||||||
|
- Update to upstream version 0.9.0.
|
||||||
|
- Fix important issues found by static analysis.
|
||||||
|
- Update crc32c to version 0.5 supporting non x86 architectures.
|
||||||
|
- New tools thin_metadata_pack and thin_metadata_unpack.
|
||||||
|
|
||||||
* Fri Aug 21 2020 Marian Csontos <mcsontos@redhat.com> - 0.8.5-4
|
* Fri Aug 21 2020 Marian Csontos <mcsontos@redhat.com> - 0.8.5-4
|
||||||
- Under-populated btree nodes are non fatal to thin_check.
|
- Under-populated btree nodes are non fatal to thin_check.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user