uint64_t read_len,
snapid_t snapid)
{
- m_ictx->image_lock.lock_shared();
- librados::snap_t snap_id = m_ictx->snap_id;
- uint64_t overlap = 0;
- m_ictx->get_parent_overlap(snap_id, &overlap);
- m_ictx->image_lock.unlock_shared();
-
- uint64_t object_no = oid_to_object_no(oid.name, m_ictx->object_prefix);
-
- // reverse map this object extent onto the parent
- vector<pair<uint64_t,uint64_t> > objectx;
- io::util::extent_to_file(
- m_ictx, object_no, 0, m_ictx->layout.object_size, objectx);
- uint64_t object_overlap = m_ictx->prune_parent_extents(objectx, overlap);
+ std::shared_lock image_locker(m_ictx->image_lock);
+ uint64_t raw_overlap = 0;
+ uint64_t object_overlap = 0;
+ m_ictx->get_parent_overlap(m_ictx->snap_id, &raw_overlap);
+ if (raw_overlap > 0) {
+ uint64_t object_no = oid_to_object_no(oid.name, m_ictx->object_prefix);
+ auto [parent_extents, area] = io::util::object_to_area_extents(
+ m_ictx, object_no, {{0, m_ictx->layout.object_size}});
+ object_overlap = m_ictx->prune_parent_extents(parent_extents, area,
+ raw_overlap, false);
+ }
bool may = object_overlap > 0;
ldout(m_ictx->cct, 10) << "may_copy_on_write " << oid << " " << read_off
<< "~" << read_len << " = " << may << dendl;
uint64_t len,
ceph_tid_t original_journal_tid,
ceph_tid_t new_journal_tid) {
- typedef std::vector<std::pair<uint64_t,uint64_t> > Extents;
-
ldout(m_ictx->cct, 20) << __func__ << ": " << oid << " "
<< off << "~" << len << " "
<< "journal_tid=" << original_journal_tid << ", "
// all IO operations are flushed prior to closing the journal
ceph_assert(original_journal_tid != 0 && m_ictx->journal != NULL);
- Extents file_extents;
- io::util::extent_to_file(m_ictx, object_no, off, len, file_extents);
- for (Extents::iterator it = file_extents.begin();
- it != file_extents.end(); ++it) {
+ auto [image_extents, _] = io::util::object_to_area_extents(m_ictx, object_no,
+ {{off, len}});
+ for (auto it = image_extents.begin(); it != image_extents.end(); ++it) {
if (new_journal_tid != 0) {
// ensure new journal event is safely committed to disk before
// committing old event