mirror of
https://github.com/ceph/ceph
synced 2025-01-28 22:14:02 +00:00
Merge pull request #4691 from varadakari/wip-kvs-objheader
KeyValueStore: optimize the object header writes Reviewed-by: Haomai Wang <haomaiwang@gmail.com>
This commit is contained in:
commit
8ec7303b95
@ -98,6 +98,7 @@ int StripObjectMap::save_strip_header(StripObjectHeaderRef strip_header,
|
||||
::encode(*strip_header, strip_header->header->data);
|
||||
|
||||
set_header(strip_header->cid, strip_header->oid, *(strip_header->header), t);
|
||||
strip_header->updated = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -462,11 +463,13 @@ int KeyValueStore::BufferTransaction::submit_transaction()
|
||||
if (header->deleted)
|
||||
continue;
|
||||
|
||||
r = store->backend->save_strip_header(header, t);
|
||||
if (header->updated) {
|
||||
r = store->backend->save_strip_header(header, t);
|
||||
|
||||
if (r < 0) {
|
||||
dout(10) << __func__ << " save strip header failed " << dendl;
|
||||
goto out;
|
||||
if (r < 0) {
|
||||
dout(10) << __func__ << " save strip header failed " << dendl;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1873,6 +1876,7 @@ int KeyValueStore::_generic_write(StripObjectMap::StripObjectHeaderRef header,
|
||||
if (len + offset > header->max_size) {
|
||||
header->max_size = len + offset;
|
||||
header->bits.resize(header->max_size/header->strip_size+1);
|
||||
header->updated = true;
|
||||
}
|
||||
|
||||
vector<StripObjectMap::StripExtent> extents;
|
||||
@ -1933,13 +1937,13 @@ int KeyValueStore::_generic_write(StripObjectMap::StripObjectHeaderRef header,
|
||||
value.append_zero(header->strip_size-value.length());
|
||||
|
||||
header->bits[iter->no] = 1;
|
||||
header->updated = true;
|
||||
}
|
||||
assert(value.length() == header->strip_size);
|
||||
values[key].swap(value);
|
||||
}
|
||||
assert(bl_offset == len);
|
||||
|
||||
header->updated = true;
|
||||
t.set_buffer_keys(header, OBJECT_STRIP_PREFIX, values);
|
||||
dout(10) << __func__ << " " << header->cid << "/" << header->oid << " "
|
||||
<< offset << "~" << len << " = " << r << dendl;
|
||||
|
Loading…
Reference in New Issue
Block a user