Module Name:    src
Committed By:   ad
Date:           Sat Apr  4 07:30:10 UTC 2009

Modified Files:
        src/sys/kern: subr_disk.c subr_iostat.c
        src/sys/sys: disk.h iostat.h

Log Message:
Add disk_isbusy(), iostat_isbusy().


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/kern/subr_disk.c
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/subr_iostat.c
cvs rdiff -u -r1.51 -r1.52 src/sys/sys/disk.h
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/iostat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.94 src/sys/kern/subr_disk.c:1.95
--- src/sys/kern/subr_disk.c:1.94	Thu Jan 22 14:38:35 2009
+++ src/sys/kern/subr_disk.c	Sat Apr  4 07:30:10 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: subr_disk.c,v 1.94 2009/01/22 14:38:35 yamt Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.95 2009/04/04 07:30:10 ad Exp $	*/
 
 /*-
- * Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.94 2009/01/22 14:38:35 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.95 2009/04/04 07:30:10 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -272,6 +272,16 @@
 }
 
 /*
+ * Return true if disk has an I/O operation in flight.
+ */
+bool
+disk_isbusy(struct disk *diskp)
+{
+
+	return iostat_isbusy(diskp->dk_stats);
+}
+
+/*
  * Set the physical blocksize of a disk, in bytes.
  * Only necessary if blocksize != DEV_BSIZE.
  */

Index: src/sys/kern/subr_iostat.c
diff -u src/sys/kern/subr_iostat.c:1.16 src/sys/kern/subr_iostat.c:1.17
--- src/sys/kern/subr_iostat.c:1.16	Thu Jan 22 14:38:35 2009
+++ src/sys/kern/subr_iostat.c	Sat Apr  4 07:30:10 2009
@@ -1,8 +1,8 @@
-/*	$NetBSD: subr_iostat.c,v 1.16 2009/01/22 14:38:35 yamt Exp $	*/
+/*	$NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $	*/
 /*	NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp	*/
 
 /*-
- * Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.16 2009/01/22 14:38:35 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.17 2009/04/04 07:30:10 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -223,6 +223,16 @@
 }
 
 /*
+ * Return non-zero if a device has an I/O request in flight.
+ */
+bool
+iostat_isbusy(struct io_stats *stats)
+{
+
+	return stats->io_busy != 0;
+}
+
+/*
  * Increment the seek counter.  This does look almost redundant but it
  * abstracts the stats gathering.
  */

Index: src/sys/sys/disk.h
diff -u src/sys/sys/disk.h:1.51 src/sys/sys/disk.h:1.52
--- src/sys/sys/disk.h:1.51	Mon Apr 28 20:24:10 2008
+++ src/sys/sys/disk.h	Sat Apr  4 07:30:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: disk.h,v 1.51 2008/04/28 20:24:10 martin Exp $	*/
+/*	$NetBSD: disk.h,v 1.52 2009/04/04 07:30:09 ad Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@@ -502,6 +502,7 @@
 void	disk_destroy(struct disk *);
 void	disk_busy(struct disk *);
 void	disk_unbusy(struct disk *, long, int);
+bool	disk_isbusy(struct disk *);
 void	disk_blocksize(struct disk *, int);
 struct disk *disk_find(const char *);
 int	disk_ioctl(struct disk *, u_long, void *, int, struct lwp *);

Index: src/sys/sys/iostat.h
diff -u src/sys/sys/iostat.h:1.9 src/sys/sys/iostat.h:1.10
--- src/sys/sys/iostat.h:1.9	Mon Apr 28 20:24:10 2008
+++ src/sys/sys/iostat.h	Sat Apr  4 07:30:09 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: iostat.h,v 1.9 2008/04/28 20:24:10 martin Exp $	*/
+/*	$NetBSD: iostat.h,v 1.10 2009/04/04 07:30:09 ad Exp $	*/
 
 /*-
- * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 1997, 2004, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -98,6 +98,7 @@
 void	iostat_init(void);
 void	iostat_busy(struct io_stats *);
 void	iostat_unbusy(struct io_stats *, long, int);
+bool	iostat_isbusy(struct io_stats *);
 struct io_stats *iostat_find(const char *);
 struct io_stats *iostat_alloc(int32_t, void *, const char *);
 void	iostat_free(struct io_stats *);

Reply via email to