mirror of
https://github.com/ceph/ceph
synced 2024-12-20 02:13:04 +00:00
osdc/ObjectCacher: add ZERO bufferheads from map_read()
When we add a bufferhead with zeros to the Object data map, use the new zero type instead of allocating actual zeros. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
fde7fe6840
commit
94a84d2908
src/osdc
@ -192,10 +192,7 @@ int ObjectCacher::Object::map_read(OSDRead *rd,
|
||||
n->set_length(left);
|
||||
oc->bh_add(this, n);
|
||||
if (complete) {
|
||||
bufferptr bp(left);
|
||||
bp.zero();
|
||||
n->bl.append(bp);
|
||||
oc->mark_clean(n);
|
||||
oc->mark_zero(n);
|
||||
hits[cur] = n;
|
||||
ldout(oc->cct, 20) << "map_read miss+complete+zero " << left << " left, " << *n << dendl;
|
||||
} else {
|
||||
@ -215,7 +212,8 @@ int ObjectCacher::Object::map_read(OSDRead *rd,
|
||||
|
||||
if (e->is_clean() ||
|
||||
e->is_dirty() ||
|
||||
e->is_tx()) {
|
||||
e->is_tx() ||
|
||||
e->is_zero()) {
|
||||
hits[cur] = e; // readable!
|
||||
ldout(oc->cct, 20) << "map_read hit " << *e << dendl;
|
||||
} else if (e->is_rx()) {
|
||||
@ -243,10 +241,7 @@ int ObjectCacher::Object::map_read(OSDRead *rd,
|
||||
n->set_length(len);
|
||||
oc->bh_add(this,n);
|
||||
if (complete) {
|
||||
bufferptr bp(len);
|
||||
bp.zero();
|
||||
n->bl.append(bp);
|
||||
oc->mark_clean(n);
|
||||
oc->mark_zero(n);
|
||||
hits[cur] = n;
|
||||
ldout(oc->cct, 20) << "map_read gap+complete+zero " << *n << dendl;
|
||||
} else {
|
||||
|
@ -84,7 +84,7 @@ class ObjectCacher {
|
||||
// states
|
||||
static const int STATE_MISSING = 0;
|
||||
static const int STATE_CLEAN = 1;
|
||||
static const int STATE_ZERO = 2;
|
||||
static const int STATE_ZERO = 2; // NOTE: these are *clean* zeros
|
||||
static const int STATE_DIRTY = 3;
|
||||
static const int STATE_RX = 4;
|
||||
static const int STATE_TX = 5;
|
||||
|
Loading…
Reference in New Issue
Block a user