Merge branch 'master' of github.com:jthornber/thin-provisioning-tools

This commit is contained in:
Joe Thornber 2014-09-04 11:36:53 +01:00
commit 626ddd8efb
8 changed files with 35 additions and 16 deletions

View File

@ -15,3 +15,5 @@ v0.4
- Tools rolled into a single executable to save space.
- Fixed some bugs when walking bitsets (possibly effecting cache_dump
and cache_check).

View File

@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
aruba (0.6.0)
aruba (0.6.1)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
@ -21,11 +21,11 @@ GEM
multi_json (~> 1.3)
multi_json (1.10.1)
multi_test (0.1.1)
rspec-expectations (3.0.3)
rspec-expectations (3.0.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-support (3.0.3)
thinp_xml (0.0.18)
rspec-support (3.0.4)
thinp_xml (0.0.19)
ejt_command_line (>= 0.0.2)
PLATFORMS

View File

@ -16,11 +16,13 @@
# with thin-provisioning-tools. If not, see
# <http://www.gnu.org/licenses/>.
.PHONY: all
V=@
all: bin/pdata_tools
PROGRAMS=\
bin/pdata_tools
.PHONY: all
all: $(PROGRAMS)
SOURCE=\
base/application.cc \

View File

@ -1 +1 @@
0.3.2
0.4.0

View File

@ -7,6 +7,7 @@
#include <expat.h>
#include <iosfwd>
#include <map>
#include <stdexcept>
using namespace std;

View File

@ -17,6 +17,15 @@ namespace {
struct flags {
flags()
: max_hint_width(4) {
// Dance around some spurious compiler warnings
device_size = 0;
block_size = 0;
nr_blocks = 0;
device_size.reset();
block_size.reset();
nr_blocks.reset();
}
boost::optional<uint64_t> device_size;

View File

@ -88,9 +88,14 @@ namespace {
walk_writeset_tree(md.tm_, *md.writeset_tree_, v, dv);
}
void mark_blocks_since(metadata const &md, uint32_t threshold, set<uint32_t> &result) {
walk_array(*md.era_array_, md.sb_.nr_blocks, threshold, result);
walk_writesets(md, threshold, result);
void mark_blocks_since(metadata const &md, optional<uint32_t> const &threshold, set<uint32_t> &result) {
if (!threshold)
// Can't get here, just putting in to pacify the compiler
throw std::runtime_error("threshold not set");
else {
walk_array(*md.era_array_, md.sb_.nr_blocks, *threshold, result);
walk_writesets(md, *threshold, result);
}
}
//--------------------------------
@ -155,11 +160,11 @@ namespace {
throw runtime_error("no metadata snapshot taken.");
metadata::ptr md(new metadata(bm, *sb.metadata_snap));
mark_blocks_since(*md, *fs.era_threshold_, blocks);
mark_blocks_since(*md, fs.era_threshold_, blocks);
} else {
metadata::ptr md(new metadata(bm, metadata::OPEN));
mark_blocks_since(*md, *fs.era_threshold_, blocks);
mark_blocks_since(*md, fs.era_threshold_, blocks);
}
if (want_stdout(output))

View File

@ -44,7 +44,7 @@ Feature: cache_dump
Scenario: dump/restore is a noop
Given valid cache metadata
When I cache_dump
And I cache_restore
And I cache_dump
When I cache dump
And I cache restore
And I cache dump
Then cache dumps 1 and 2 should be identical