Skip to content

Commit

Permalink
Merge pull request ceph#3112 from xiaoxichen/cleanup_getheader
Browse files Browse the repository at this point in the history
Cleanup:Use get_type()instead of get_header().type

Reviewed-by: Loic Dachary <[email protected]>
  • Loading branch information
ldachary committed Dec 13, 2014
2 parents 7106801 + c0ce4a5 commit b9ddb83
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
28 changes: 14 additions & 14 deletions src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ void OSDService::reply_op_error(OpRequestRef op, int err, eversion_t v,
version_t uv)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
assert(m->get_header().type == CEPH_MSG_OSD_OP);
assert(m->get_type() == CEPH_MSG_OSD_OP);
int flags;
flags = m->get_flags() & (CEPH_OSD_FLAG_ACK|CEPH_OSD_FLAG_ONDISK);

Expand All @@ -1218,7 +1218,7 @@ void OSDService::reply_op_error(OpRequestRef op, int err, eversion_t v,
void OSDService::handle_misdirected_op(PG *pg, OpRequestRef op)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
assert(m->get_header().type == CEPH_MSG_OSD_OP);
assert(m->get_type() == CEPH_MSG_OSD_OP);

assert(m->get_map_epoch() >= pg->info.history.same_primary_since);

Expand Down Expand Up @@ -5540,7 +5540,7 @@ template<typename T, int MSGTYPE>
epoch_t replica_op_required_epoch(OpRequestRef op)
{
T *m = static_cast<T *>(op->get_req());
assert(m->get_header().type == MSGTYPE);
assert(m->get_type() == MSGTYPE);
return m->map_epoch;
}

Expand Down Expand Up @@ -6800,7 +6800,7 @@ void OSD::split_pgs(
void OSD::handle_pg_create(OpRequestRef op)
{
MOSDPGCreate *m = (MOSDPGCreate*)op->get_req();
assert(m->get_header().type == MSG_OSD_PG_CREATE);
assert(m->get_type() == MSG_OSD_PG_CREATE);

dout(10) << "handle_pg_create " << *m << dendl;

Expand Down Expand Up @@ -7216,7 +7216,7 @@ void OSD::do_infos(map<int,
void OSD::handle_pg_notify(OpRequestRef op)
{
MOSDPGNotify *m = (MOSDPGNotify*)op->get_req();
assert(m->get_header().type == MSG_OSD_PG_NOTIFY);
assert(m->get_type() == MSG_OSD_PG_NOTIFY);

dout(7) << "handle_pg_notify from " << m->get_source() << dendl;
int from = m->get_source().num();
Expand Down Expand Up @@ -7254,7 +7254,7 @@ void OSD::handle_pg_notify(OpRequestRef op)
void OSD::handle_pg_log(OpRequestRef op)
{
MOSDPGLog *m = (MOSDPGLog*) op->get_req();
assert(m->get_header().type == MSG_OSD_PG_LOG);
assert(m->get_type() == MSG_OSD_PG_LOG);
dout(7) << "handle_pg_log " << *m << " from " << m->get_source() << dendl;

if (!require_osd_peer(op))
Expand Down Expand Up @@ -7284,7 +7284,7 @@ void OSD::handle_pg_log(OpRequestRef op)
void OSD::handle_pg_info(OpRequestRef op)
{
MOSDPGInfo *m = static_cast<MOSDPGInfo *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_INFO);
assert(m->get_type() == MSG_OSD_PG_INFO);
dout(7) << "handle_pg_info " << *m << " from " << m->get_source() << dendl;

if (!require_osd_peer(op))
Expand Down Expand Up @@ -7321,7 +7321,7 @@ void OSD::handle_pg_info(OpRequestRef op)
void OSD::handle_pg_trim(OpRequestRef op)
{
MOSDPGTrim *m = (MOSDPGTrim *)op->get_req();
assert(m->get_header().type == MSG_OSD_PG_TRIM);
assert(m->get_type() == MSG_OSD_PG_TRIM);

dout(7) << "handle_pg_trim " << *m << " from " << m->get_source() << dendl;

Expand Down Expand Up @@ -7379,7 +7379,7 @@ void OSD::handle_pg_trim(OpRequestRef op)
void OSD::handle_pg_backfill_reserve(OpRequestRef op)
{
MBackfillReserve *m = static_cast<MBackfillReserve*>(op->get_req());
assert(m->get_header().type == MSG_OSD_BACKFILL_RESERVE);
assert(m->get_type() == MSG_OSD_BACKFILL_RESERVE);

if (!require_osd_peer(op))
return;
Expand Down Expand Up @@ -7428,7 +7428,7 @@ void OSD::handle_pg_backfill_reserve(OpRequestRef op)
void OSD::handle_pg_recovery_reserve(OpRequestRef op)
{
MRecoveryReserve *m = static_cast<MRecoveryReserve*>(op->get_req());
assert(m->get_header().type == MSG_OSD_RECOVERY_RESERVE);
assert(m->get_type() == MSG_OSD_RECOVERY_RESERVE);

if (!require_osd_peer(op))
return;
Expand Down Expand Up @@ -7484,7 +7484,7 @@ void OSD::handle_pg_query(OpRequestRef op)
assert(osd_lock.is_locked());

MOSDPGQuery *m = (MOSDPGQuery*)op->get_req();
assert(m->get_header().type == MSG_OSD_PG_QUERY);
assert(m->get_type() == MSG_OSD_PG_QUERY);

if (!require_osd_peer(op))
return;
Expand Down Expand Up @@ -7591,7 +7591,7 @@ void OSD::handle_pg_query(OpRequestRef op)
void OSD::handle_pg_remove(OpRequestRef op)
{
MOSDPGRemove *m = (MOSDPGRemove *)op->get_req();
assert(m->get_header().type == MSG_OSD_PG_REMOVE);
assert(m->get_type() == MSG_OSD_PG_REMOVE);
assert(osd_lock.is_locked());

if (!require_osd_peer(op))
Expand Down Expand Up @@ -7910,7 +7910,7 @@ struct send_map_on_destruct {
void OSD::handle_op(OpRequestRef& op, OSDMapRef& osdmap)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
assert(m->get_header().type == CEPH_MSG_OSD_OP);
assert(m->get_type() == CEPH_MSG_OSD_OP);
if (op_is_discardable(m)) {
dout(10) << " discardable " << *m << dendl;
return;
Expand Down Expand Up @@ -8062,7 +8062,7 @@ template<typename T, int MSGTYPE>
void OSD::handle_replica_op(OpRequestRef& op, OSDMapRef& osdmap)
{
T *m = static_cast<T *>(op->get_req());
assert(m->get_header().type == MSGTYPE);
assert(m->get_type() == MSGTYPE);

dout(10) << __func__ << " " << *m << " epoch " << m->map_epoch << dendl;
epoch_t up_epoch = service.get_up_epoch();
Expand Down
16 changes: 8 additions & 8 deletions src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3150,7 +3150,7 @@ void PG::unreg_next_scrub()
void PG::sub_op_scrub_map(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp *>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);
dout(7) << "sub_op_scrub_map" << dendl;

if (m->map_epoch < info.history.same_interval_since) {
Expand Down Expand Up @@ -3210,7 +3210,7 @@ void PG::_request_scrub_map(
void PG::sub_op_scrub_reserve(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);
dout(7) << "sub_op_scrub_reserve" << dendl;

if (scrubber.reserved) {
Expand All @@ -3231,7 +3231,7 @@ void PG::sub_op_scrub_reserve(OpRequestRef op)
void PG::sub_op_scrub_reserve_reply(OpRequestRef op)
{
MOSDSubOpReply *reply = static_cast<MOSDSubOpReply*>(op->get_req());
assert(reply->get_header().type == MSG_OSD_SUBOPREPLY);
assert(reply->get_type() == MSG_OSD_SUBOPREPLY);
dout(7) << "sub_op_scrub_reserve_reply" << dendl;

if (!scrubber.reserved) {
Expand Down Expand Up @@ -3263,7 +3263,7 @@ void PG::sub_op_scrub_reserve_reply(OpRequestRef op)

void PG::sub_op_scrub_unreserve(OpRequestRef op)
{
assert(op->get_req()->get_header().type == MSG_OSD_SUBOP);
assert(op->get_req()->get_type() == MSG_OSD_SUBOP);
dout(7) << "sub_op_scrub_unreserve" << dendl;

op->mark_started();
Expand All @@ -3276,7 +3276,7 @@ void PG::sub_op_scrub_stop(OpRequestRef op)
op->mark_started();

MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);
dout(7) << "sub_op_scrub_stop" << dendl;

// see comment in sub_op_scrub_reserve
Expand Down Expand Up @@ -4973,7 +4973,7 @@ template<typename T, int MSGTYPE>
bool PG::can_discard_replica_op(OpRequestRef& op)
{
T *m = static_cast<T *>(op->get_req());
assert(m->get_header().type == MSGTYPE);
assert(m->get_type() == MSGTYPE);

/* Mostly, this overlaps with the old_peering_msg
* condition. An important exception is pushes
Expand All @@ -4998,7 +4998,7 @@ bool PG::can_discard_replica_op(OpRequestRef& op)
bool PG::can_discard_scan(OpRequestRef op)
{
MOSDPGScan *m = static_cast<MOSDPGScan *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_SCAN);
assert(m->get_type() == MSG_OSD_PG_SCAN);

if (old_peering_msg(m->map_epoch, m->query_epoch)) {
dout(10) << " got old scan, ignoring" << dendl;
Expand All @@ -5010,7 +5010,7 @@ bool PG::can_discard_scan(OpRequestRef op)
bool PG::can_discard_backfill(OpRequestRef op)
{
MOSDPGBackfill *m = static_cast<MOSDPGBackfill *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_BACKFILL);
assert(m->get_type() == MSG_OSD_PG_BACKFILL);

if (old_peering_msg(m->map_epoch, m->query_epoch)) {
dout(10) << " got old backfill, ignoring" << dendl;
Expand Down
2 changes: 1 addition & 1 deletion src/osd/ReplicatedBackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ void ReplicatedBackend::op_commit(
void ReplicatedBackend::sub_op_modify_reply(OpRequestRef op)
{
MOSDSubOpReply *r = static_cast<MOSDSubOpReply*>(op->get_req());
assert(r->get_header().type == MSG_OSD_SUBOPREPLY);
assert(r->get_type() == MSG_OSD_SUBOPREPLY);

op->mark_started();

Expand Down
30 changes: 15 additions & 15 deletions src/osd/ReplicatedPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ bool ReplicatedPG::pg_op_must_wait(MOSDOp *op)
void ReplicatedPG::do_pg_op(OpRequestRef op)
{
MOSDOp *m = static_cast<MOSDOp *>(op->get_req());
assert(m->get_header().type == CEPH_MSG_OSD_OP);
assert(m->get_type() == CEPH_MSG_OSD_OP);
dout(10) << "do_pg_op " << *m << dendl;

op->mark_started();
Expand Down Expand Up @@ -1369,7 +1369,7 @@ bool ReplicatedPG::check_src_targ(const hobject_t& soid, const hobject_t& toid)
void ReplicatedPG::do_op(OpRequestRef& op)
{
MOSDOp *m = static_cast<MOSDOp*>(op->get_req());
assert(m->get_header().type == CEPH_MSG_OSD_OP);
assert(m->get_type() == CEPH_MSG_OSD_OP);
if (op->includes_pg_op()) {
if (pg_op_must_wait(m)) {
wait_for_all_missing(op);
Expand Down Expand Up @@ -2211,7 +2211,7 @@ void ReplicatedPG::do_sub_op(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(have_same_or_newer_map(m->map_epoch));
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);
dout(15) << "do_sub_op " << *op->get_req() << dendl;

OSDOp *first = NULL;
Expand Down Expand Up @@ -2249,7 +2249,7 @@ void ReplicatedPG::do_sub_op(OpRequestRef op)
void ReplicatedPG::do_sub_op_reply(OpRequestRef op)
{
MOSDSubOpReply *r = static_cast<MOSDSubOpReply *>(op->get_req());
assert(r->get_header().type == MSG_OSD_SUBOPREPLY);
assert(r->get_type() == MSG_OSD_SUBOPREPLY);
if (r->ops.size() >= 1) {
OSDOp& first = r->ops[0];
switch (first.op.op) {
Expand All @@ -2265,7 +2265,7 @@ void ReplicatedPG::do_scan(
ThreadPool::TPHandle &handle)
{
MOSDPGScan *m = static_cast<MOSDPGScan*>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_SCAN);
assert(m->get_type() == MSG_OSD_PG_SCAN);
dout(10) << "do_scan " << *m << dendl;

op->mark_started();
Expand Down Expand Up @@ -2350,7 +2350,7 @@ void ReplicatedPG::do_scan(
void ReplicatedBackend::_do_push(OpRequestRef op)
{
MOSDPGPush *m = static_cast<MOSDPGPush *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_PUSH);
assert(m->get_type() == MSG_OSD_PG_PUSH);
pg_shard_t from = m->from;

vector<PushReplyOp> replies;
Expand Down Expand Up @@ -2409,7 +2409,7 @@ struct C_ReplicatedBackend_OnPullComplete : GenContext<ThreadPool::TPHandle&> {
void ReplicatedBackend::_do_pull_response(OpRequestRef op)
{
MOSDPGPush *m = static_cast<MOSDPGPush *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_PUSH);
assert(m->get_type() == MSG_OSD_PG_PUSH);
pg_shard_t from = m->from;

vector<PullOp> replies(1);
Expand Down Expand Up @@ -2457,7 +2457,7 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
void ReplicatedBackend::do_pull(OpRequestRef op)
{
MOSDPGPull *m = static_cast<MOSDPGPull *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_PULL);
assert(m->get_type() == MSG_OSD_PG_PULL);
pg_shard_t from = m->from;

map<pg_shard_t, vector<PushOp> > replies;
Expand All @@ -2473,7 +2473,7 @@ void ReplicatedBackend::do_pull(OpRequestRef op)
void ReplicatedBackend::do_push_reply(OpRequestRef op)
{
MOSDPGPushReply *m = static_cast<MOSDPGPushReply *>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_PUSH_REPLY);
assert(m->get_type() == MSG_OSD_PG_PUSH_REPLY);
pg_shard_t from = m->from;

vector<PushOp> replies(1);
Expand All @@ -2494,7 +2494,7 @@ void ReplicatedBackend::do_push_reply(OpRequestRef op)
void ReplicatedPG::do_backfill(OpRequestRef op)
{
MOSDPGBackfill *m = static_cast<MOSDPGBackfill*>(op->get_req());
assert(m->get_header().type == MSG_OSD_PG_BACKFILL);
assert(m->get_type() == MSG_OSD_PG_BACKFILL);
dout(10) << "do_backfill " << *m << dendl;

op->mark_started();
Expand Down Expand Up @@ -7943,7 +7943,7 @@ void ReplicatedPG::put_snapset_context(SnapSetContext *ssc)
void ReplicatedBackend::sub_op_modify(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);

const hobject_t& soid = m->poid;

Expand Down Expand Up @@ -8051,7 +8051,7 @@ void ReplicatedBackend::sub_op_modify_applied(RepModifyRef rm)
dout(10) << "sub_op_modify_applied on " << rm << " op "
<< *rm->op->get_req() << dendl;
MOSDSubOp *m = static_cast<MOSDSubOp*>(rm->op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);

if (!rm->committed) {
// send ack to acker only if we haven't sent a commit already
Expand Down Expand Up @@ -9034,7 +9034,7 @@ void ReplicatedBackend::sub_op_push_reply(OpRequestRef op)
{
MOSDSubOpReply *reply = static_cast<MOSDSubOpReply*>(op->get_req());
const hobject_t& soid = reply->get_poid();
assert(reply->get_header().type == MSG_OSD_SUBOPREPLY);
assert(reply->get_type() == MSG_OSD_SUBOPREPLY);
dout(10) << "sub_op_push_reply from " << reply->get_source() << " " << *reply << dendl;
pg_shard_t peer = reply->from;

Expand Down Expand Up @@ -9128,7 +9128,7 @@ void ReplicatedPG::finish_degraded_object(const hobject_t& oid)
void ReplicatedBackend::sub_op_pull(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);

op->mark_started();

Expand Down Expand Up @@ -9400,7 +9400,7 @@ void ReplicatedBackend::_failed_push(pg_shard_t from, const hobject_t &soid)
void ReplicatedPG::sub_op_remove(OpRequestRef op)
{
MOSDSubOp *m = static_cast<MOSDSubOp*>(op->get_req());
assert(m->get_header().type == MSG_OSD_SUBOP);
assert(m->get_type() == MSG_OSD_SUBOP);
dout(7) << "sub_op_remove " << m->poid << dendl;

op->mark_started();
Expand Down

0 comments on commit b9ddb83

Please sign in to comment.