Suppose: bluestore_overlay_max_length=bluestore_min_alloc_size;
bluestore_overlay_max = 2;
For the following ops:
write(off=0, len=4096) --->write into overlay
write(off=4096, len=4096)-->write into overlay
write(off=0, len=bluestore_min_alloc_size)-->because overlay_map.size()
>=2, it allocate a extent.
It should trim overlay data(0,4096) &(4096, 4096),and then write(0,
bluestore_min_alloc_size).
But the original code don't trim overlay data.
This make the later read data is orignal data rather that new data.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
uint64_t x_off = offset - bp->first;
dout(20) << __func__ << " write " << offset << "~" << length
<< " 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_UNWRITTEN);
bp->second.clear_flag(bluestore_extent_t::FLAG_COW_HEAD);