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>
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 {
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()) {
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 {
// 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;