Skip to content

Commit

Permalink
Merge pull request #11807 from xiexingguo/xxg-wip-bs-1107
Browse files Browse the repository at this point in the history
os/bluestore: speed up omap-key generation for same onode

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Nov 8, 2016
2 parents 27efa84 + db769dc commit 4bc6bad
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -8498,14 +8498,17 @@ int BlueStore::_omap_setkeys(TransContext *txc,
o->onode.omap_head = o->onode.nid;
txc->write_onode(o);
}
string final_key;
_key_encode_u64(o->onode.omap_head, &final_key);
final_key.push_back('.');
::decode(num, p);
while (num--) {
string key;
bufferlist value;
::decode(key, p);
::decode(value, p);
string final_key;
get_omap_key(o->onode.omap_head, key, &final_key);
final_key.resize(9); // keep prefix
final_key += key;
dout(30) << __func__ << " " << pretty_binary_string(final_key)
<< " <- " << key << dendl;
txc->t->set(PREFIX_OMAP, final_key, value);
Expand Down Expand Up @@ -8543,16 +8546,19 @@ int BlueStore::_omap_rmkeys(TransContext *txc,
int r = 0;
bufferlist::iterator p = bl.begin();
__u32 num;
string final_key;

if (!o->onode.omap_head) {
goto out;
}
_key_encode_u64(o->onode.omap_head, &final_key);
final_key.push_back('.');
::decode(num, p);
while (num--) {
string key;
::decode(key, p);
string final_key;
get_omap_key(o->onode.omap_head, key, &final_key);
final_key.resize(9); // keep prefix
final_key += key;
dout(30) << __func__ << " rm " << pretty_binary_string(final_key)
<< " <- " << key << dendl;
txc->t->rmkey(PREFIX_OMAP, final_key);
Expand Down

0 comments on commit 4bc6bad

Please sign in to comment.