| 154 | |
| 155 | template <typename I> |
| 156 | bool update_object_map(I& image_ctx, uint64_t object_no, uint8_t current_state, |
| 157 | uint8_t new_state) { |
| 158 | CephContext *cct = image_ctx.cct; |
| 159 | uint64_t snap_id = image_ctx.snap_id; |
| 160 | |
| 161 | current_state = (*image_ctx.object_map)[object_no]; |
| 162 | if (current_state == OBJECT_EXISTS && new_state == OBJECT_NONEXISTENT && |
| 163 | snap_id == CEPH_NOSNAP) { |
| 164 | // might be writing object to OSD concurrently |
| 165 | new_state = current_state; |
| 166 | } |
| 167 | |
| 168 | if (new_state != current_state) { |
| 169 | ldout(cct, 15) << image_ctx.get_object_name(object_no) |
| 170 | << " rebuild updating object map " |
| 171 | << static_cast<uint32_t>(current_state) << "->" |
| 172 | << static_cast<uint32_t>(new_state) << dendl; |
| 173 | image_ctx.object_map->set_state(object_no, new_state, current_state); |
| 174 | } |
| 175 | return false; |
| 176 | } |
| 177 | |
| 178 | template <typename I> |
| 179 | void RebuildObjectMapRequest<I>::send_verify_objects() { |
no test coverage detected