Skip to content

Commit

Permalink
Merge pull request ceph#18982 from neha-ojha/wip-const-cleanup
Browse files Browse the repository at this point in the history
osd/PG: const cleanup for recoverable/readable predicates

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
tchaikov authored Nov 20, 2017
2 parents 697fb15 + c8419de commit 028ab3b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/osd/ECBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ class ECBackend : public PGBackend {
return ec_impl->minimum_to_decode(want, have, &min) == 0;
}
};
IsPGRecoverablePredicate *get_is_recoverable_predicate() override {
IsPGRecoverablePredicate *get_is_recoverable_predicate() const override {
return new ECRecPred(ec_impl);
}

Expand All @@ -622,7 +622,7 @@ class ECBackend : public PGBackend {
return _have.count(whoami) && rec_pred(_have);
}
};
IsPGReadablePredicate *get_is_readable_predicate() override {
IsPGReadablePredicate *get_is_readable_predicate() const override {
return new ECReadPred(get_parent()->whoami_shard(), ec_impl);
}

Expand Down
3 changes: 2 additions & 1 deletion src/osd/PG.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,12 @@ class PG : public DoutPrefixProvider {
bool eio_errors_to_process = false;

virtual PGBackend *get_pgbackend() = 0;
virtual const PGBackend* get_pgbackend() const = 0;

protected:
/*** PG ****/
/// get_is_recoverable_predicate: caller owns returned pointer and must delete when done
IsPGRecoverablePredicate *get_is_recoverable_predicate() {
IsPGRecoverablePredicate *get_is_recoverable_predicate() const {
return get_pgbackend()->get_is_recoverable_predicate();
}
protected:
Expand Down
4 changes: 2 additions & 2 deletions src/osd/PGBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ typedef ceph::shared_ptr<const OSDMap> OSDMapRef;

virtual void on_flushed() = 0;

virtual IsPGRecoverablePredicate *get_is_recoverable_predicate() = 0;
virtual IsPGReadablePredicate *get_is_readable_predicate() = 0;
virtual IsPGRecoverablePredicate *get_is_recoverable_predicate() const = 0;
virtual IsPGReadablePredicate *get_is_readable_predicate() const = 0;

virtual void dump_recovery_info(Formatter *f) const = 0;

Expand Down
4 changes: 4 additions & 0 deletions src/osd/PrimaryLogPG.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
return pgbackend.get();
}

const PGBackend *get_pgbackend() const override {
return pgbackend.get();
}

/// Listener methods
DoutPrefixProvider *get_dpp() override {
return this;
Expand Down
4 changes: 2 additions & 2 deletions src/osd/ReplicatedBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ReplicatedBackend : public PGBackend {
return !have.empty();
}
};
IsPGRecoverablePredicate *get_is_recoverable_predicate() override {
IsPGRecoverablePredicate *get_is_recoverable_predicate() const override {
return new RPCRecPred;
}

Expand All @@ -87,7 +87,7 @@ class ReplicatedBackend : public PGBackend {
return have.count(whoami);
}
};
IsPGReadablePredicate *get_is_readable_predicate() override {
IsPGReadablePredicate *get_is_readable_predicate() const override {
return new RPCReadPred(get_parent()->whoami_shard());
}

Expand Down

0 comments on commit 028ab3b

Please sign in to comment.