Skip to content

Commit

Permalink
cls/rbd: object map update now utilizes constant-time bit vector oper…
Browse files Browse the repository at this point in the history
…ations

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Oct 15, 2017
1 parent daa29f7 commit fc99603
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/cls/rbd/cls_rbd.cc
Expand Up @@ -2460,7 +2460,7 @@ int object_map_update(cls_method_context_t hctx, bufferlist *in, bufferlist *out
CLS_ERR("object map footer read failed");
return r;
}

try {
bufferlist::iterator it = footer_bl.begin();
object_map.decode_footer(it);
Expand Down Expand Up @@ -2496,13 +2496,14 @@ int object_map_update(cls_method_context_t hctx, bufferlist *in, bufferlist *out
}

bool updated = false;
for (uint64_t object_no = start_object_no; object_no < end_object_no;
++object_no) {
uint8_t state = object_map[object_no];
auto it = object_map.begin() + start_object_no;
auto end_it = object_map.begin() + end_object_no;
for (; it != end_it; ++it) {
uint8_t state = *it;
if ((!current_object_state || state == *current_object_state ||
(*current_object_state == OBJECT_EXISTS &&
state == OBJECT_EXISTS_CLEAN)) && state != new_object_state) {
object_map[object_no] = new_object_state;
*it = new_object_state;
updated = true;
}
}
Expand Down

0 comments on commit fc99603

Please sign in to comment.