liyujie
2025-08-28 786ff4f4ca2374bdd9177f2e24b503d43e7a3b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * blktrace output analysis: generate a timeline & gather statistics
 *
 * Copyright (C) 2006 Alan D. Brunelle <Alan.Brunelle@hp.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#include "globals.h"
 
static void handle_queue(struct io *q_iop)
{
   seeki_add(q_iop->dip->q2q_handle, q_iop);
   update_qregion(&all_regions, q_iop->t.time);
   dip_update_q(q_iop->dip, q_iop);
   pip_update_q(q_iop);
   if (remapper_dev(q_iop->t.device))
       update_lq(&last_q, &all_avgs.q2q_dm, q_iop->t.time);
   else {
       update_q_histo(q_iop->t.bytes);
       update_lq(&last_q, &all_avgs.q2q, q_iop->t.time);
   }
 
   q_iop->i_time = q_iop->g_time = q_iop->c_time = q_iop->m_time =
                       q_iop->d_time = (__u64)-1;
   q_iop->dip->n_qs++;
 
   q_iop->dip->t_act_q += q_iop->dip->n_act_q;
   q_iop->dip->n_act_q++;
}
 
void trace_queue(struct io *q_iop)
{
   if (q_iop->t.bytes == 0)
       return;
 
   if (io_setup(q_iop, IOP_Q))
       handle_queue(q_iop);
   else
       io_release(q_iop);
}