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

This commit is contained in:
Joe Thornber 2021-04-08 10:47:18 +01:00
commit 0119b51a9c
3 changed files with 3 additions and 4 deletions

View File

@ -145,11 +145,11 @@ namespace persistent_data {
{ {
internal_node n = spine.get_node<block_traits>(); internal_node n = spine.get_node<block_traits>();
// compact the path if there's only one child
if (n.get_nr_entries() == 1) { if (n.get_nr_entries() == 1) {
block_address b = n.value_at(0); block_address b = n.value_at(0);
read_ref child = tm_.read_lock(b, validator_); read_ref child = tm_.read_lock(b, validator_);
// FIXME: is it safe?
::memcpy(n.raw(), child.data(), read_ref::BLOCK_SIZE); ::memcpy(n.raw(), child.data(), read_ref::BLOCK_SIZE);
tm_.get_sm()->dec(child.get_location()); tm_.get_sm()->dec(child.get_location());
@ -341,7 +341,6 @@ namespace persistent_data {
if (nr_left < nr_right) { if (nr_left < nr_right) {
int s = nr_left - target_left; int s = nr_left - target_left;
// FIXME: signed & unsigned comparison
if (s < 0 && nr_center < static_cast<unsigned>(-s)) { if (s < 0 && nr_center < static_cast<unsigned>(-s)) {
// not enough in central node // not enough in central node
left.move_entries(center, -nr_center); left.move_entries(center, -nr_center);

View File

@ -338,7 +338,7 @@ namespace persistent_data {
unsigned nr_right = rhs.get_nr_entries(); unsigned nr_right = rhs.get_nr_entries();
unsigned max_entries = get_max_entries(); unsigned max_entries = get_max_entries();
if (nr_left - count > max_entries || nr_right - count > max_entries) if (nr_left - count > max_entries || nr_right + count > max_entries)
throw runtime_error("too many entries"); throw runtime_error("too many entries");
if (count > 0) { if (count > 0) {

View File

@ -558,7 +558,7 @@ pub fn unpack_node<V: Unpack>(
for k in &keys { for k in &keys {
if let Some(l) = last { if let Some(l) = last {
if k <= l { if k <= l {
return Err(node_err(&path, "keys out of order")); return Err(node_err(&path, &format!("keys out of order: {} <= {}", k, l)));
} }
} }