mirror of
https://github.com/ceph/ceph
synced 2025-01-03 01:22:53 +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 now = ceph_clock_now(cct);
|
||||||
utime_t too_old = now;
|
utime_t too_old = now;
|
||||||
too_old -= complaint_time;
|
too_old -= complaint_time;
|
||||||
utime_t oldest_op;
|
utime_t oldest_op = now;
|
||||||
uint64_t total_ops_in_flight = 0;
|
uint64_t total_ops_in_flight = 0;
|
||||||
bool got_first_op = false;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < num_optracker_shards; i++) {
|
for (uint32_t i = 0; i < num_optracker_shards; i++) {
|
||||||
ShardedTrackingData* sdata = sharded_in_flight_list[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);
|
Mutex::Locker locker(sdata->ops_in_flight_lock_sharded);
|
||||||
if (!sdata->ops_in_flight_sharded.empty()) {
|
if (!sdata->ops_in_flight_sharded.empty()) {
|
||||||
utime_t oldest_op_tmp = sdata->ops_in_flight_sharded.front()->get_initiated();
|
utime_t oldest_op_tmp = sdata->ops_in_flight_sharded.front()->get_initiated();
|
||||||
if (!got_first_op) {
|
if (oldest_op_tmp < oldest_op) {
|
||||||
oldest_op = oldest_op_tmp;
|
|
||||||
got_first_op = true;
|
|
||||||
} else if (oldest_op_tmp < oldest_op) {
|
|
||||||
oldest_op = oldest_op_tmp;
|
oldest_op = oldest_op_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,12 +294,12 @@ void OpTracker::_mark_event(TrackedOp *op, const string &evt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpTracker::RemoveOnDelete::operator()(TrackedOp *op) {
|
void OpTracker::RemoveOnDelete::operator()(TrackedOp *op) {
|
||||||
op->mark_event("done");
|
|
||||||
if (!tracker->tracking_enabled) {
|
if (!tracker->tracking_enabled) {
|
||||||
op->_unregistered();
|
op->_unregistered();
|
||||||
delete op;
|
delete op;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
op->mark_event("done");
|
||||||
tracker->unregister_inflight_op(op);
|
tracker->unregister_inflight_op(op);
|
||||||
// Do not delete op, unregister_inflight_op took control
|
// Do not delete op, unregister_inflight_op took control
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ protected:
|
|||||||
warn_interval_multiplier(1)
|
warn_interval_multiplier(1)
|
||||||
{
|
{
|
||||||
tracker->register_inflight_op(&xitem);
|
tracker->register_inflight_op(&xitem);
|
||||||
|
if (tracker->tracking_enabled)
|
||||||
events.push_back(make_pair(initiated_at, "initiated"));
|
events.push_back(make_pair(initiated_at, "initiated"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user