blob: 017bcc274ab620536f1f9f027582d9b65e55d26a (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
// IO scheduler tapset
// Copyright (C) 2005, 2006 IBM Corp.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
%{
#include <linux/blkdev.h>
#include <linux/elevator.h>
%}
/* when a request is retrieved from request queue */
probe ioscheduler.elv_next_request
= kernel.function("elv_next_request")
{
%( kernel_v >= "2.6.10" %?
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
%:
elevator_name = kernel_string($q->elevator->elevator_name)
%)
}
probe ioscheduler.elv_next_request.return
= kernel.function("elv_next_request").return
{
if($return == 0) {
req = 0
req_flags = 0
disk_major = -1
disk_minor = -1
} else {
req = $return
%( kernel_v >= "2.6.19" %?
req_flags = $return->cmd_flags
%:
req_flags = $return->flags
%)
if($return->rq_disk == 0) {
disk_major = -1
disk_minor = -1
} else {
disk_major = $return->rq_disk->major
disk_minor = $return->rq_disk->first_minor
}
}
}
/* when a request is added to the request queue */
probe ioscheduler.elv_add_request
= kernel.function("__elv_add_request")
{
%( kernel_v >= "2.6.10" %?
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
%:
elevator_name = kernel_string($q->elevator->elevator_name)
%)
if($rq == 0) {
disk_major = -1
disk_minor = -1
} else {
if($rq->rq_disk == 0) {
disk_major = -1
disk_minor = -1
} else {
disk_major = $rq->rq_disk->major
disk_minor = $rq->rq_disk->first_minor
}
}
req = $rq
%( kernel_v >= "2.6.19" %?
req_flags = $rq==0? 0:$rq->cmd_flags
%:
req_flags = $rq==0? 0:$rq->flags
%)
}
/* when a request is completed */
probe ioscheduler.elv_completed_request
= kernel.function("elv_completed_request")
{
%( kernel_v >= "2.6.10" %?
elevator_name = kernel_string($q->elevator->elevator_type->elevator_name)
%:
elevator_name = kernel_string($q->elevator->elevator_name)
%)
if($rq == 0) {
disk_major = -1
disk_minor = -1
} else {
if($rq->rq_disk == 0) {
disk_major = -1
disk_minor = -1
} else {
disk_major = $rq->rq_disk->major
disk_minor = $rq->rq_disk->first_minor
}
}
req = $rq
%( kernel_v >= "2.6.19" %?
req_flags = $rq==0? 0:$rq->cmd_flags
%:
req_flags = $rq==0? 0:$rq->flags
%)
}
function disk_major_from_request:long(var_q:long)
%{ /* pure */
struct request_queue *q = (struct request_queue *)((long)THIS->var_q);
struct list_head *queue_head = &(q->queue_head);
if (list_empty(&(q->queue_head))) /* FIXME: deref hazard! */
THIS->__retvalue = -1;
else {
struct request *rq = list_entry_rq(q->queue_head.next); /* FIXME: deref hazard! */
struct gendisk *rq_disk = kread(&(rq->rq_disk));
THIS->__retvalue = kread(&(rq_disk->major));
}
CATCH_DEREF_FAULT();
%}
function disk_minor_from_request:long(var_q:long)
%{ /* pure */
struct request_queue *q = (struct request_queue *)((long)THIS->var_q);
struct list_head *queue_head = &(q->queue_head);
if (list_empty(&(q->queue_head))) /* FIXME: deref hazard! */
THIS->__retvalue = -1;
else {
struct request *rq = list_entry_rq(q->queue_head.next); /* FIXME: deref hazard! */
struct gendisk *rq_disk = kread(&(rq->rq_disk));
THIS->__retvalue = kread(&(rq_disk->first_minor));
}
CATCH_DEREF_FAULT();
%}
|