Commit e28531da authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8986b732
......@@ -48,13 +48,13 @@ struct xiov_iter {
BEGIN {
// XXX vvv commented to save space - else BPF for BEGIN might be rejected as too large
//@nread = 0;
//@nwrite = 0;
//@nread = {}; // {} tid -> nread
//@nwrite = {}; // {} tid -> nwrite
//@rpending[0] = ustack;
//@wpending[0] = ustack;
//clear(@rpending); // {} #nr -> ustack
//clear(@wpending); // {} #nw -> ustack
//clear(@rpending); // {} (tid,#nr) -> ustack
//clear(@wpending); // {} (tid,#nw) -> ustack
// XXX bpftrace does not recognize enum
@opcode[ 1] = "LOOKUP";
......@@ -125,42 +125,43 @@ END {
// reader enqueues
kprobe::fuse_dev_read {
$nr = @nread;
@rpending[$nr] = ustack;
$nr = @nread[tid];
@rpending[tid,$nr] = ustack;
// fuse_dev_do_read advances `to` - fetch/remember buffer pointer before.
$to = (xiov_iter *)arg1;
$buf = $to->iov->iov_base;
@rbuf[tid] = $buf;
printf("/dev/fuse -> qread %s/%d #%d_r:%s\n", comm, tid, $nr, ustack)
printf("P%d /dev/fuse <- qread %s/%d_%d_r:%s\n", cpu, comm, tid, $nr, ustack)
}
// read ready
kretprobe::fuse_dev_read {
$rr = @nread;
@nread = $rr + 1;
delete(@rpending[$rr]);
$rr = @nread[tid];
@nread[tid] = $rr + 1;
delete(@rpending[tid,$rr]);
$h = (fuse_in_header *)@rbuf[tid];
delete(@rbuf[tid]);
$op = @opcode[$h->opcode];
// XXX one printf can have only 7 arguments
printf("/dev/fuse -> read %s/%d #%d_r: (ret=%d)\n", comm, tid, $rr, retval);
// wcfs/2412#2r
printf("P%d /dev/fuse -> read %s/%d_%d_r: (ret=%d)\n", cpu, comm, tid, $rr, retval);
printf("\t.%d %s i%d ...\n\n", $h->unique, $op, $h->nodeid);
}
// write request
kprobe::fuse_dev_write {
$nw = @nwrite;
@wpending[$nw] = ustack;
$nw = @nwrite[tid];
@wpending[tid,$nw] = ustack;
$from = (xiov_iter *)arg1;
$wbuf = $from->iov->iov_base;
$wh = (fuse_out_header *)$wbuf;
printf("/dev/fuse <- write: %s/%d #%d_w:\n", comm, tid, $nw);
printf("P%d /dev/fuse <- write %s/%d_%d_w:\n", cpu, comm, tid, $nw);
$u = $wh->unique;
$e = $wh->error;
......@@ -172,18 +173,18 @@ kprobe::fuse_dev_write {
// printf("\t?notify(%d) ...\n", $e);
//}
} else {
printf("\t.%d (%d)\n", $u, $e);
printf("\t.%d (%d) ...\n", $u, $e);
}
printf("%s\n", ustack);
}
// write ack
kretprobe::fuse_dev_write {
$ww = @nwrite;
@nwrite = $ww + 1;
delete(@wpending[$ww]);
$ww = @nwrite[tid];
@nwrite[tid] = $ww + 1;
delete(@wpending[tid,$ww]);
printf("/dev/fuse <- write_ack: %s/%d #%d_w (ret=%d)\n\n", comm, tid, $ww, retval);
printf("P%d /dev/fuse -> write_ack %s/%d_%d_w (ret=%d)\n\n", cpu, comm, tid, $ww, retval);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment