Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Implement the 'io' provider for DTrace. From riast...
details: https://anonhg.NetBSD.org/src/rev/138f138df59a
branches: trunk
changeset: 343375:138f138df59a
user: riz <riz%NetBSD.org@localhost>
date: Mon Feb 01 05:05:43 2016 +0000
description:
Implement the 'io' provider for DTrace. From riastradh@, with
fixes from me.
diffstat:
sys/kern/subr_devsw.c | 14 ++++++++++++--
sys/kern/vfs_bio.c | 19 +++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
diffs (122 lines):
diff -r d3ed63e754b5 -r 138f138df59a sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c Mon Feb 01 02:59:33 2016 +0000
+++ b/sys/kern/subr_devsw.c Mon Feb 01 05:05:43 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_devsw.c,v 1.33 2014/09/05 05:57:21 matt Exp $ */
+/* $NetBSD: subr_devsw.c,v 1.34 2016/02/01 05:05:43 riz Exp $ */
/*-
* Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.33 2014/09/05 05:57:21 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34 2016/02/01 05:05:43 riz Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_dtrace.h"
+#endif
#include <sys/param.h>
#include <sys/conf.h>
@@ -80,6 +84,7 @@
#include <sys/cpu.h>
#include <sys/buf.h>
#include <sys/reboot.h>
+#include <sys/sdt.h>
#ifdef DEVSW_DEBUG
#define DPRINTF(x) printf x
@@ -730,12 +735,17 @@
return rv;
}
+SDT_PROVIDER_DECLARE(io);
+SDT_PROBE_DEFINE1(io, kernel, , start, "struct buf *"/*bp*/);
+
void
bdev_strategy(struct buf *bp)
{
const struct bdevsw *d;
int mpflag;
+ SDT_PROBE1(io, kernel, , start, bp);
+
if ((d = bdevsw_lookup(bp->b_dev)) == NULL) {
bp->b_error = ENXIO;
bp->b_resid = bp->b_bcount;
diff -r d3ed63e754b5 -r 138f138df59a sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c Mon Feb 01 02:59:33 2016 +0000
+++ b/sys/kern/vfs_bio.c Mon Feb 01 05:05:43 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_bio.c,v 1.258 2016/01/11 01:22:36 dholland Exp $ */
+/* $NetBSD: vfs_bio.c,v 1.259 2016/02/01 05:05:43 riz Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,10 +123,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.258 2016/01/11 01:22:36 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.259 2016/02/01 05:05:43 riz Exp $");
#ifdef _KERNEL_OPT
#include "opt_bufcache.h"
+#include "opt_dtrace.h"
#endif
#include <sys/param.h>
@@ -146,6 +147,7 @@
#include <sys/wapbl.h>
#include <sys/bitops.h>
#include <sys/cprng.h>
+#include <sys/sdt.h>
#include <uvm/uvm.h> /* extern struct uvm uvm */
@@ -1474,6 +1476,11 @@
return size;
}
+SDT_PROVIDER_DEFINE(io);
+
+SDT_PROBE_DEFINE1(io, kernel, , wait__start, "struct buf *"/*bp*/);
+SDT_PROBE_DEFINE1(io, kernel, , wait__done, "struct buf *"/*bp*/);
+
/*
* Wait for operations on the buffer to complete.
* When they do, extract and return the I/O's error value.
@@ -1485,11 +1492,15 @@
KASSERT(ISSET(bp->b_cflags, BC_BUSY));
KASSERT(bp->b_refcnt > 0);
+ SDT_PROBE1(io, kernel, , wait__start, bp);
+
mutex_enter(bp->b_objlock);
while (!ISSET(bp->b_oflags, BO_DONE | BO_DELWRI))
cv_wait(&bp->b_done, bp->b_objlock);
mutex_exit(bp->b_objlock);
+ SDT_PROBE1(io, kernel, , wait__done, bp);
+
return bp->b_error;
}
@@ -1528,11 +1539,15 @@
}
}
+SDT_PROBE_DEFINE1(io, kernel, , done, "struct buf *"/*bp*/);
+
static void
biodone2(buf_t *bp)
{
void (*callout)(buf_t *);
+ SDT_PROBE1(io, kernel, ,done, bp);
+
mutex_enter(bp->b_objlock);
/* Note that the transfer is done. */
if (ISSET(bp->b_oflags, BO_DONE))
Home |
Main Index |
Thread Index |
Old Index