Commit Graph

49 Commits

Author SHA1 Message Date
enami 8f82ec28ee Factor out the COMPAT_16 code. 2002-11-06 02:31:34 +00:00
mrg 3e8df71794 - do the COMPAT_16 dance in sysctl_diskstats() for the where == NULL case
as well.  pointed out by enami@.
- defflag COMPAT_16.
2002-11-05 13:22:32 +00:00
mrg 5cad86b3ea repair backwards compatibility with netbsd 1.6 - if we are not given the
wanted sizeof(struct disk_sysctl), use the old size.  for non-COMPAT_16,
however, we return EINVAL so that all future programs are forced into
passing the wanted size.  1.6 iostat(8) works with -current kernel again.

as seen on tech-kern.
2002-11-04 03:50:07 +00:00
simonb 307ae1b2e5 When calculating the space needed for the data, use the supplied
userland structure size (if passed in).
Use the supplied userland structure size (if passed in) to check if
there is enough room to copyout the next structure.
2002-11-01 15:20:03 +00:00
mrg 603098b9b5 implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
	- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
	when processing hw.diskstats, add the read&write bytes/transfers for
	the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail.  however, the next time this is
change it will not fail again.

this is just the kernel portion.
2002-11-01 11:31:50 +00:00
enami fc1c4219ef Make this works with QUEUEDEBUG defined; don't use queue pointer after
removing an element from queue.
2002-11-01 03:34:07 +00:00
enami 5eec77bccd Cosmetic changes. 2002-11-01 03:32:21 +00:00
hannken 815491c0b3 Remove the old device buffer queue interface.
Approved by: Jason R. Thorpe <thorpej@wasabisystems.com>
2002-08-30 15:43:36 +00:00
hannken 91f71a4f61 The buffer returned by BUFQ_PEEK must remain the same until BUFQ_GET is
called. It may be used as the "current" buffer.
2002-07-23 14:00:16 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
hannken 10ff5e6607 Implement a new device buffer queue interface.
One basic struct, a function to setup a queue with a specific strategy and
three macros to put buf's into the queue, get and remove the next buf or
get the next buf without removal.

The BUFQ_XXX interface will be removed in the future.
The B_ORDERED flag is not longer supported.

Approved by: Jason R. Thorpe <thorpej@wasabisystems.com>
2002-07-16 18:03:17 +00:00
yamt 5154ea5e5b constify diskerr(). 2002-06-28 16:37:20 +00:00
enami 3528e53ca0 Use sizeof correctly. Fixes PR#15613. 2002-02-16 02:11:43 +00:00
enami 233c254079 - Wrap long line.
- Remove unnecessary semi-colon.
2002-02-16 02:07:56 +00:00
simonb 4aceab2a3d Remember to update the "size copied" counter in sysctl_diskstats(). 2002-01-28 03:33:55 +00:00
simonb 9e42930807 Use TAILQ_FOREACH(). 2002-01-28 03:12:13 +00:00
simonb ed6b438e40 Implement the hw.disknames and hw.diskstats sysctl's that have been listed
in <sys/sysctl.h> since day one but never implemented.
2002-01-27 12:41:07 +00:00
enami ba7af71cd5 Use cached pointer to next buf instead of re-fetching it. GCC actually
generates different code.
2001-11-30 01:31:30 +00:00
lukem 43369f69d3 add RCSID 2001-11-13 13:33:44 +00:00
simonb bc45d3d53c ANSIfy. 2001-07-09 10:54:12 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
thorpej fe551f0e64 Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle.  Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
2000-02-07 20:16:47 +00:00
hannken a6ee792cee The decision that `disksort_cylinder' uses to decide if the buffer needs
to go to the inversion list is incomplete. If the cylinders are equal
block numbers must be checked.

This caused lockups if some buffers with the same cylinder were cycling
through the list, as it may happen with softdep enabled.

Fixes PR #9197.
2000-01-28 09:27:38 +00:00
thorpej 05c6b5a9a0 - Add a B_ORDERED flag to communicate to drivers that an I/O request should
be issued/completed in order; that is, provide a barrier for I/O queues.
- Change the buffer driver queue links to a TAILQ, rather than using
  a home-grown equivalent.  Provide BUFQ_*() macros to manipulate buffer
  queues; these deal with the barrier provided by B_ORDERED.
- Update disksort() accordingly, and provide 3 versions:
	- disksort_cylinder(): historical disksort(), which keys on
	  b_cylinder (and b_blkno for the case when b_cylinder matches).
	- disksort_blkno(): sorts only on b_blkno.  Essentially the
	  same as disksort_cylinder(), but with fewer comparisons.
	- disksort_tail(): requests are simply inserted into the queue
	  at the tail.  This is provided as an option so that drivers
	  can simply have a pointer to the appropriate sort function.
  Note that disksort() now pays attention to B_ORDERED.
2000-01-21 23:20:51 +00:00
drochner 220b8d9add PR kern/7033 (Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>): use
device minor to unit/partition macros from sys/disklabel.h
1999-02-22 16:00:01 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
thorpej d3eaf8a978 Rearrange disk_detach() slightly, and make a small run-time cosmetic
change in disk_unbusy().
1997-12-30 09:51:24 +00:00
thorpej 176a81b2c5 Copyright assigned to The NetBSD Foundation. 1997-10-05 18:37:01 +00:00
perry 8a0600b163 removed #ifdef tahoe 1996-10-17 16:31:54 +00:00
christos f443b89c92 backout previous kprintf change 1996-10-13 02:32:29 +00:00
christos 60d201973e printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:46:11 +00:00
thorpej 0462d3063c Remove old-style disk instrumentation code. 1996-07-12 22:00:42 +00:00
christos c9e746a335 Fix printf() formats. 1996-03-16 23:17:04 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
thorpej 5b39541e48 New generic disk framework. Highlights:
- New metrics handling.  Metrics are now kept in the new
	  `struct disk'.  Busy time is now stored as a timeval, and
	  transfer count in bytes.

	- Storage for disklabels is now dynamically allocated, so that
	  the size of the disk structure is not machine-dependent.

	- Several new functions for attaching and detaching disks, and
	  handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
1996-01-07 22:01:38 +00:00
thorpej 17eb6e2bc1 Move the old-style disk instrumentation "structures" to a central location
(sys/kern/subr_disk.c) and note that they should/will be deperecated.
1995-12-28 19:16:31 +00:00
mycroft 46b2bb599f Make definition of b_cylinder global. 1995-03-29 20:57:35 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft 0d7b00ee14 Update to 4.4-Lite. 1994-05-19 03:43:13 +00:00
mycroft f834e39cf5 Don't need back pointers for disksort(). 1994-02-10 15:43:20 +00:00
mycroft 57892d4faf Remove another use of b_actl. 1994-02-06 17:39:48 +00:00
mycroft adeebc448e Use b_actf, not av_forw. 1994-02-06 10:00:30 +00:00
glass ff3c7667ae remove warning 1994-01-23 19:11:25 +00:00
mycroft 4448a68e2c Get rid of disklabel indirection functions. 1994-01-11 16:35:44 +00:00
mycroft b4d3382694 Canonicalize all #includes. 1993-12-17 07:56:32 +00:00
mycroft 29aea147e8 Add \n to end of error message. 1993-09-05 22:07:31 +00:00
deraadt 6fb28b3c74 more disklabel changes 1993-05-20 23:12:53 +00:00
cgd b95f963973 add rcs ids, and clean up headers where necessary 1993-05-20 03:53:21 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00