| 322 | } |
| 323 | |
| 324 | int SnapClient::dump_cache(Formatter *f) const |
| 325 | { |
| 326 | if (!is_synced()) { |
| 327 | dout(5) << "dump_cache: not synced" << dendl; |
| 328 | return -EINVAL; |
| 329 | } |
| 330 | |
| 331 | map<snapid_t, const SnapInfo*> snaps; |
| 332 | for (auto& p : cached_snaps) |
| 333 | snaps[p.first] = &p.second; |
| 334 | |
| 335 | for (auto tid : committing_tids) { |
| 336 | auto q = cached_pending_update.find(tid); |
| 337 | if (q != cached_pending_update.end()) |
| 338 | snaps[q->second.snapid] = &q->second; |
| 339 | |
| 340 | auto r = cached_pending_destroy.find(tid); |
| 341 | if (r != cached_pending_destroy.end()) |
| 342 | snaps.erase(r->second.first); |
| 343 | } |
| 344 | |
| 345 | f->open_object_section("snapclient"); |
| 346 | |
| 347 | f->dump_int("last_created", get_last_created()); |
| 348 | f->dump_int("last_destroyed", get_last_destroyed()); |
| 349 | |
| 350 | f->open_array_section("snaps"); |
| 351 | for (auto p : snaps) { |
| 352 | f->open_object_section("snap"); |
| 353 | p.second->dump(f); |
| 354 | f->close_section(); |
| 355 | } |
| 356 | f->close_section(); |
| 357 | |
| 358 | f->close_section(); |
| 359 | |
| 360 | return 0; |
| 361 | } |
nothing calls this directly
no test coverage detected