<< cow_head_op->extent << dendl;
}
if (e.length == length && cow_tail_op) {
- // we set the COW flag to indicate that all or part of this new extent
- // will be copied from the previous allocation.
- e.flags |= bluestore_extent_t::FLAG_COW_TAIL;
+ // we set cow_tail_extent to indicate that all or part of this
+ // new extent will be copied from the previous allocation.
+ *cow_tail_extent = e.offset;
// extent.offset is the logical object offset
assert(cow_tail_op->extent.offset >= offset);
assert(cow_tail_op->extent.end() <= offset + length);
uint64_t end = ROUND_UP_TO(offset + length, block_size);
if (end < bp->first + bp->second.length &&
end <= o->onode.size &&
- !bp->second.has_flag(bluestore_extent_t::FLAG_COW_TAIL)) {
+ cow_tail_extent != bp->second.offset) {
uint64_t z_len = bp->first + bp->second.length - end;
uint64_t x_off = end - bp->first;
dout(20) << __func__ << " zero " << end << "~" << z_len
<< " x_off " << x_off << dendl;
_do_overlay_trim(txc, o, offset, length);
bdev->aio_write(bp->second.offset + x_off, bl, &txc->ioc, buffered);
- bp->second.clear_flag(bluestore_extent_t::FLAG_COW_TAIL);
++bp;
continue;
}
dout(20) << __func__ << " past eof, padding out tail block" << dendl;
_pad_zeros_tail(txc, o, &bl, offset, &length, block_size);
}
- bp->second.clear_flag(bluestore_extent_t::FLAG_COW_TAIL);
op->extent.offset = bp->second.offset + offset - bp->first;
op->extent.length = length;
op->data = bl;
o->onode.size = orig_offset + orig_length;
}
- // make sure we didn't leave unwritten extents behind
- for (map<uint64_t,bluestore_extent_t>::iterator p = o->onode.block_map.begin();
- p != o->onode.block_map.end();
- ++p) {
- if (p->second.has_flag(bluestore_extent_t::FLAG_COW_TAIL)) {
- derr << __func__ << " left behind a COW extent, out of sync with "
- << "_do_allocate" << dendl;
- _dump_onode(o, 0);
- assert(0 == "leaked cow extent");
- }
- }
-
out:
return r;
}
dout(10) << __func__ << " wal zero tail partial block "
<< x_off << "~" << x_len << " at " << op->extent
<< dendl;
- assert(!pp->second.has_flag(bluestore_extent_t::FLAG_COW_TAIL));
}
if (offset > end_block) {
// end was block-aligned. zero the rest of the extent now.