mirror of
https://github.com/ceph/ceph
synced 2024-12-22 03:22:00 +00:00
Merge pull request #5138 from majianpeng/cleanup
common/TrackedOp: code cleanups Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
03f3fc4aba
@ -158,9 +158,8 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
|
||||
utime_t now = ceph_clock_now(cct);
|
||||
utime_t too_old = now;
|
||||
too_old -= complaint_time;
|
||||
utime_t oldest_op;
|
||||
utime_t oldest_op = now;
|
||||
uint64_t total_ops_in_flight = 0;
|
||||
bool got_first_op = false;
|
||||
|
||||
for (uint32_t i = 0; i < num_optracker_shards; i++) {
|
||||
ShardedTrackingData* sdata = sharded_in_flight_list[i];
|
||||
@ -168,10 +167,7 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
|
||||
Mutex::Locker locker(sdata->ops_in_flight_lock_sharded);
|
||||
if (!sdata->ops_in_flight_sharded.empty()) {
|
||||
utime_t oldest_op_tmp = sdata->ops_in_flight_sharded.front()->get_initiated();
|
||||
if (!got_first_op) {
|
||||
oldest_op = oldest_op_tmp;
|
||||
got_first_op = true;
|
||||
} else if (oldest_op_tmp < oldest_op) {
|
||||
if (oldest_op_tmp < oldest_op) {
|
||||
oldest_op = oldest_op_tmp;
|
||||
}
|
||||
}
|
||||
@ -298,12 +294,12 @@ void OpTracker::_mark_event(TrackedOp *op, const string &evt,
|
||||
}
|
||||
|
||||
void OpTracker::RemoveOnDelete::operator()(TrackedOp *op) {
|
||||
op->mark_event("done");
|
||||
if (!tracker->tracking_enabled) {
|
||||
op->_unregistered();
|
||||
delete op;
|
||||
return;
|
||||
}
|
||||
op->mark_event("done");
|
||||
tracker->unregister_inflight_op(op);
|
||||
// Do not delete op, unregister_inflight_op took control
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ protected:
|
||||
warn_interval_multiplier(1)
|
||||
{
|
||||
tracker->register_inflight_op(&xitem);
|
||||
events.push_back(make_pair(initiated_at, "initiated"));
|
||||
if (tracker->tracking_enabled)
|
||||
events.push_back(make_pair(initiated_at, "initiated"));
|
||||
}
|
||||
|
||||
/// output any type-specific data you want to get when dump() is called
|
||||
|
Loading…
Reference in New Issue
Block a user