Skip to content

Commit

Permalink
fix biosnoop after kernel change
Browse files Browse the repository at this point in the history
  • Loading branch information
brendangregg committed Aug 24, 2016
1 parent 2aefbef commit 0d4d0bf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tools/biosnoop.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,23 @@
req->rq_disk->disk_name);
}
if (req->cmd_flags & REQ_WRITE) {
/*
* The following deals with a kernel version change (in mainline 4.7, although
* it may be backported to earlier kernels) with how block request write flags
* are tested. We handle both pre- and post-change versions here. Please avoid
* kernel version tests like this as much as possible: they inflate the code,
* test, and maintenance burden.
*/
#ifdef REQ_WRITE
if (req->cmd_flags & REQ_WRITE) {
#else
if ((req->cmd_flags >> REQ_OP_SHIFT) == REQ_OP_WRITE) {
#endif
data.rwflag = 1;
} else {
data.rwflag = 0;
}
events.perf_submit(ctx, &data, sizeof(data));
start.delete(&req);
infobyreq.delete(&req);
Expand Down

0 comments on commit 0d4d0bf

Please sign in to comment.