Skip to content

Commit 46f6940

Browse files
authored
Merge pull request ceph#55305 from Matan-B/wip-matanb-crimson-do_delete_work
crimson/osd/pg: do_delete_work use claim_and_reset Reviewed-by: Samuel Just <[email protected]> Reviewed-by: Xuehan Xu <[email protected]>
2 parents 60a15fc + 28afcff commit 46f6940

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/crimson/osd/pg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ PG::do_delete_work(ceph::os::Transaction &t, ghobject_t _next)
434434
t.remove(coll_ref->get_cid(), pgmeta_oid);
435435
t.remove_collection(coll_ref->get_cid());
436436
(void) shard_services.get_store().do_transaction(
437-
coll_ref, std::move(t)).then([this] {
437+
coll_ref, t.claim_and_reset()).then([this] {
438438
return shard_services.remove_pg(pgid);
439439
});
440440
return {next, false};

src/crimson/osd/pg_map.cc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ seastar::future<core_id_t> PGShardMapping::get_or_create_pg_mapping(
4747
DEBUG("mapping pg {} to core: {} with num_pgs of: {}",
4848
pgid, insert_iter->second, core_iter->second);
4949
return primary_mapping.container().invoke_on_others(
50-
[pgid = insert_iter->first, core = insert_iter->second]
50+
[pgid = insert_iter->first, core = insert_iter->second, FNAME]
5151
(auto &other_mapping) {
5252
ceph_assert_always(core != NULL_CORE);
5353
auto [insert_iter, inserted] = other_mapping.pg_to_core.emplace(pgid, core);
5454
ceph_assert_always(inserted);
55+
DEBUG("mapping pg {} to core: {}", pgid, core);
5556
});
56-
}).then([this, pgid] {
57+
}).then([this, pgid, FNAME] {
5758
auto find_iter = pg_to_core.find(pgid);
59+
ceph_assert_always(find_iter != pg_to_core.end());
60+
DEBUG("returning pg {} mapping to core {}", pgid, find_iter->second);
5861
return seastar::make_ready_future<core_id_t>(find_iter->second);
5962
});
6063
}
@@ -63,7 +66,7 @@ seastar::future<core_id_t> PGShardMapping::get_or_create_pg_mapping(
6366
seastar::future<> PGShardMapping::remove_pg_mapping(spg_t pgid) {
6467
LOG_PREFIX(PGShardMapping::remove_pg_mapping);
6568
DEBUG("{}", pgid);
66-
return container().invoke_on(0, [pgid](auto &primary_mapping) {
69+
return container().invoke_on(0, [pgid, FNAME](auto &primary_mapping) {
6770
auto iter = primary_mapping.pg_to_core.find(pgid);
6871
ceph_assert_always(iter != primary_mapping.pg_to_core.end());
6972
ceph_assert_always(iter->second != NULL_CORE);
@@ -72,12 +75,14 @@ seastar::future<> PGShardMapping::remove_pg_mapping(spg_t pgid) {
7275
ceph_assert_always(count_iter->second > 0);
7376
--(count_iter->second);
7477
primary_mapping.pg_to_core.erase(iter);
78+
DEBUG("pg {} mapping erased", pgid);
7579
return primary_mapping.container().invoke_on_others(
76-
[pgid](auto &other_mapping) {
80+
[pgid, FNAME](auto &other_mapping) {
7781
auto iter = other_mapping.pg_to_core.find(pgid);
7882
ceph_assert_always(iter != other_mapping.pg_to_core.end());
7983
ceph_assert_always(iter->second != NULL_CORE);
8084
other_mapping.pg_to_core.erase(iter);
85+
DEBUG("pg {} mapping erased", pgid);
8186
});
8287
});
8388
}

src/crimson/osd/shard_services.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,7 @@ seastar::future<> ShardServices::dispatch_context_transaction(
764764
DEBUG("do_transaction ...");
765765
auto ret = get_store().do_transaction(
766766
col,
767-
std::move(ctx.transaction));
768-
ctx.reset_transaction();
767+
ctx.transaction.claim_and_reset());
769768
return ret;
770769
}
771770

0 commit comments

Comments
 (0)