Skip to content

Commit 6bd7cd4

Browse files
authored
Merge pull request ceph#51147 from liu-chunmei/multicore-osd
Crimson/osd: support multicore osd Reviewed-by: Samuel Just <[email protected]>
2 parents 1f1800b + 00a5eae commit 6bd7cd4

File tree

11 files changed

+610
-398
lines changed

11 files changed

+610
-398
lines changed

src/crimson/common/operation.h

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ class PipelineExitBarrierI {
476476
using Ref = std::unique_ptr<PipelineExitBarrierI>;
477477

478478
/// Waits for exit barrier
479-
virtual seastar::future<> wait() = 0;
479+
virtual std::optional<seastar::future<>> wait() = 0;
480480

481481
/// Releases pipeline stage, can only be called after wait
482482
virtual void exit() = 0;
@@ -503,8 +503,8 @@ class PipelineStageIT : public BlockerT<T> {
503503
class PipelineHandle {
504504
PipelineExitBarrierI::Ref barrier;
505505

506-
auto wait_barrier() {
507-
return barrier ? barrier->wait() : seastar::now();
506+
std::optional<seastar::future<>> wait_barrier() {
507+
return barrier ? barrier->wait() : std::nullopt;
508508
}
509509

510510
public:
@@ -525,15 +525,26 @@ class PipelineHandle {
525525
seastar::future<>
526526
enter(T &stage, typename T::BlockingEvent::template Trigger<OpT>&& t) {
527527
ceph_assert(stage.get_core() == seastar::this_shard_id());
528-
return wait_barrier().then([this, &stage, t=std::move(t)] () mutable {
529-
auto fut = t.maybe_record_blocking(stage.enter(t), stage);
530-
exit();
531-
return std::move(fut).then(
532-
[this, t=std::move(t)](auto &&barrier_ref) mutable {
533-
barrier = std::move(barrier_ref);
534-
return seastar::now();
528+
auto wait_fut = wait_barrier();
529+
if (wait_fut.has_value()) {
530+
return wait_fut.value().then([this, &stage, t=std::move(t)] () mutable {
531+
auto fut = t.maybe_record_blocking(stage.enter(t), stage);
532+
exit();
533+
return std::move(fut).then(
534+
[this, t=std::move(t)](auto &&barrier_ref) mutable {
535+
barrier = std::move(barrier_ref);
536+
return seastar::now();
537+
});
535538
});
536-
});
539+
} else {
540+
auto fut = t.maybe_record_blocking(stage.enter(t), stage);
541+
exit();
542+
return std::move(fut).then(
543+
[this, t=std::move(t)](auto &&barrier_ref) mutable {
544+
barrier = std::move(barrier_ref);
545+
return seastar::now();
546+
});
547+
}
537548
}
538549

539550
/**
@@ -542,7 +553,7 @@ class PipelineHandle {
542553
seastar::future<> complete() {
543554
auto ret = wait_barrier();
544555
barrier.reset();
545-
return ret;
556+
return ret ? std::move(ret.value()) : seastar::now();
546557
}
547558

548559
/**
@@ -578,8 +589,8 @@ class OrderedExclusivePhaseT : public PipelineStageIT<T> {
578589
ExitBarrier(OrderedExclusivePhaseT *phase, Operation::id_t id)
579590
: phase(phase), op_id(id) {}
580591

581-
seastar::future<> wait() final {
582-
return seastar::now();
592+
std::optional<seastar::future<>> wait() final {
593+
return std::nullopt;
583594
}
584595

585596
void exit() final {
@@ -681,7 +692,7 @@ class OrderedConcurrentPhaseT : public PipelineStageIT<T> {
681692
seastar::future<> &&barrier,
682693
TriggerT& trigger) : phase(phase), barrier(std::move(barrier)), trigger(trigger) {}
683694

684-
seastar::future<> wait() final {
695+
std::optional<seastar::future<>> wait() final {
685696
assert(phase);
686697
assert(barrier);
687698
auto ret = std::move(*barrier);
@@ -739,8 +750,8 @@ class UnorderedStageT : public PipelineStageIT<T> {
739750
public:
740751
ExitBarrier() = default;
741752

742-
seastar::future<> wait() final {
743-
return seastar::now();
753+
std::optional<seastar::future<>> wait() final {
754+
return std::nullopt;
744755
}
745756

746757
void exit() final {}

src/crimson/os/futurized_store.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class Transaction;
2525
namespace crimson::os {
2626
class FuturizedCollection;
2727

28-
constexpr core_id_t PRIMARY_CORE = 0;
29-
3028
class FuturizedStore {
3129
public:
3230
class Shard {

0 commit comments

Comments
 (0)