Handle integer overflow of the op_stat_count
This commit is contained in:
@@ -140,6 +140,11 @@ void osd_t::handle_finished_read(osd_client_t & cl)
|
||||
timespec tv_end;
|
||||
clock_gettime(CLOCK_REALTIME, &tv_end);
|
||||
subop_stat_count[0][request->req.hdr.opcode]++;
|
||||
if (!subop_stat_count[0][request->req.hdr.opcode])
|
||||
{
|
||||
subop_stat_count[0][request->req.hdr.opcode]++;
|
||||
subop_stat_sum[0][request->req.hdr.opcode] = 0;
|
||||
}
|
||||
subop_stat_sum[0][request->req.hdr.opcode] += (
|
||||
(tv_end.tv_sec - request->tv_begin.tv_sec)*1000000 +
|
||||
(tv_end.tv_nsec - request->tv_begin.tv_nsec)/1000
|
||||
@@ -252,6 +257,11 @@ void osd_t::handle_reply_hdr(osd_client_t *cl)
|
||||
timespec tv_end;
|
||||
clock_gettime(CLOCK_REALTIME, &tv_end);
|
||||
subop_stat_count[0][op->req.hdr.opcode]++;
|
||||
if (!subop_stat_count[0][op->req.hdr.opcode])
|
||||
{
|
||||
subop_stat_count[0][op->req.hdr.opcode]++;
|
||||
subop_stat_sum[0][op->req.hdr.opcode] = 0;
|
||||
}
|
||||
subop_stat_sum[0][op->req.hdr.opcode] += (
|
||||
(tv_end.tv_sec - op->tv_begin.tv_sec)*1000000 +
|
||||
(tv_end.tv_nsec - op->tv_begin.tv_nsec)/1000
|
||||
|
||||
Reference in New Issue
Block a user