Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objecter: minor cleanups #19994

Merged
merged 2 commits into from Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 5 additions & 29 deletions src/osdc/Objecter.cc
Expand Up @@ -708,10 +708,9 @@ void Objecter::_send_linger_ping(LingerOp *info)
o->target = info->target;
o->should_resend = false;
_send_op_account(o);
MOSDOp *m = _prepare_osd_op(o);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the posterity, it might not look like a refactor as it claims because the message's tid is set using o->tid before "o->tid" is updated. but please note, Objecter::_send_op() always m->set_tid(op->tid) before sending the message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@runsisi since you are at this file, could you help remove the line of https://github.com/ceph/ceph/blob/master/src/osdc/Objecter.cc#L3309 ? as _prepare_osd_op() should take care of this already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, removed it since _prepare_osd_op() has set the updated m->tid.
thanks~

o->tid = ++last_tid;
_session_op_assign(info->session, o);
_send_op(o, m);
_send_op(o);
info->ping_tid = o->tid;

onack->sent = now;
Expand Down Expand Up @@ -2044,20 +2043,6 @@ bool Objecter::wait_for_map(epoch_t epoch, Context *c, int err)
return false;
}

void Objecter::kick_requests(OSDSession *session)
{
ldout(cct, 10) << "kick_requests for osd." << session->osd << dendl;

map<uint64_t, LingerOp *> lresend;
unique_lock wl(rwlock);

OSDSession::unique_lock sl(session->lock);
_kick_requests(session, lresend);
sl.unlock();

_linger_ops_resend(lresend, wl);
}

void Objecter::_kick_requests(OSDSession *session,
map<uint64_t, LingerOp *>& lresend)
{
Expand Down Expand Up @@ -2478,11 +2463,6 @@ void Objecter::_op_submit(Op *op, shunique_lock& sul, ceph_tid_t *ptid)
_maybe_request_map();
}

MOSDOp *m = NULL;
if (need_send) {
m = _prepare_osd_op(op);
}

OSDSession::unique_lock sl(s->lock);
if (op->tid == 0)
op->tid = ++last_tid;
Expand All @@ -2496,7 +2476,7 @@ void Objecter::_op_submit(Op *op, shunique_lock& sul, ceph_tid_t *ptid)
_session_op_assign(s, op);

if (need_send) {
_send_op(op, m);
_send_op(op);
}

// Last chance to touch Op here, after giving up session lock it can
Expand Down Expand Up @@ -3240,7 +3220,7 @@ MOSDOp *Objecter::_prepare_osd_op(Op *op)
return m;
}

void Objecter::_send_op(Op *op, MOSDOp *m)
void Objecter::_send_op(Op *op)
{
// rwlock is locked
// op->session->lock is locked
Expand Down Expand Up @@ -3269,10 +3249,8 @@ void Objecter::_send_op(Op *op, MOSDOp *m)
}
}

if (!m) {
assert(op->tid > 0);
m = _prepare_osd_op(op);
}
assert(op->tid > 0);
MOSDOp *m = _prepare_osd_op(op);

if (op->target.actual_pgid != m->get_spg()) {
ldout(cct, 10) << __func__ << " " << op->tid << " pgid change from "
Expand Down Expand Up @@ -3306,8 +3284,6 @@ void Objecter::_send_op(Op *op, MOSDOp *m)

op->incarnation = op->session->incarnation;

m->set_tid(op->tid);

if (op->trace.valid()) {
m->trace.init("op msg", nullptr, &op->trace);
}
Expand Down
3 changes: 1 addition & 2 deletions src/osdc/Objecter.h
Expand Up @@ -1901,7 +1901,7 @@ class Objecter : public md_config_obs_t, public Dispatcher {
ceph::timespan osd_timeout;

MOSDOp *_prepare_osd_op(Op *op);
void _send_op(Op *op, MOSDOp *m = NULL);
void _send_op(Op *op);
void _send_op_account(Op *op);
void _cancel_linger_op(Op *op);
void finish_op(OSDSession *session, ceph_tid_t tid);
Expand Down Expand Up @@ -1969,7 +1969,6 @@ class Objecter : public md_config_obs_t, public Dispatcher {
void _send_command_map_check(CommandOp *op);
void _command_cancel_map_check(CommandOp *op);

void kick_requests(OSDSession *session);
void _kick_requests(OSDSession *session, map<uint64_t, LingerOp *>& lresend);
void _linger_ops_resend(map<uint64_t, LingerOp *>& lresend, unique_lock& ul);

Expand Down