| 85 | |
| 86 | template <typename I> |
| 87 | bool ObjectMap<I>::object_may_exist(uint64_t object_no) const |
| 88 | { |
| 89 | ceph_assert(ceph_mutex_is_locked(m_image_ctx.image_lock)); |
| 90 | |
| 91 | // Fall back to default logic if object map is disabled or invalid |
| 92 | if (!m_image_ctx.test_features(RBD_FEATURE_OBJECT_MAP, |
| 93 | m_image_ctx.image_lock)) { |
| 94 | return true; |
| 95 | } |
| 96 | |
| 97 | bool flags_set; |
| 98 | int r = m_image_ctx.test_flags(m_image_ctx.snap_id, |
| 99 | RBD_FLAG_OBJECT_MAP_INVALID, |
| 100 | m_image_ctx.image_lock, &flags_set); |
| 101 | if (r < 0 || flags_set) { |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | uint8_t state = (*this)[object_no]; |
| 106 | bool exists = (state != OBJECT_NONEXISTENT); |
| 107 | ldout(m_image_ctx.cct, 20) << "object_no=" << object_no << " r=" << exists |
| 108 | << dendl; |
| 109 | return exists; |
| 110 | } |
| 111 | |
| 112 | template <typename I> |
| 113 | bool ObjectMap<I>::update_required(const ceph::BitVector<2>::Iterator& it, |