Commit Graph

107 Commits

Author SHA1 Message Date
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +00:00
scw 175f717bf5 Be more careful about validating the user-specified geometry, otherwise
it's too easy to specify a geometry which will cause a divide by zero
elsewhere in the disklabel code.
2003-10-19 07:41:19 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 4aef050969 Add DIOCKLABEL support. Fixes PR kern/21605 (Luke Mewburn). 2003-05-17 16:11:52 +00:00
thorpej e43fecb228 Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself.  This paves the way for some future changes.
2003-05-10 23:12:28 +00:00
dsl d91455ce26 Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
2003-05-02 08:45:10 +00:00
dsl 46687ce6f2 In the absensce of a netbsd disklabel:
- Use partition size (instead of type) to determine whether a disklabel slot
  has been filled in (eg from mbr info on i386).
- Set number of partitions to 16 to stop disklabel bleating.
2003-04-26 12:02:12 +00:00
drochner ea7f1bd035 Add a VNDIOF_FORCE flag which forces unconfiguration if the emulated
disk is still in use.
Not for everyday use, but we have to face eg USB flash drives being
unplugged at the wrong time, and this is a way to simulate this without
wearing out the connectors.
2003-04-11 16:11:49 +00:00
yamt 77312f97f8 read-only configuration support. 2003-03-27 15:34:36 +00:00
enami 015ce49004 Don't require root privilege explicitly to issue ioctl. It should be
controlled by file's attribute.
2003-03-01 08:01:17 +00:00
thorpej eb14e86676 Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it.  This fixes a few places where either b_dep or b_interlock were
not properly initialized.
2003-02-25 20:35:31 +00:00
pk 338f31f581 Make the buffer cache code MP-safe. 2003-02-05 21:38:38 +00:00
kleink 4e0e5333ae Fix further printf format warnings for DEBUG, in the wake of daddr_t
having changed.
2003-01-25 23:00:09 +00:00
mrg 20998b4001 vnd.c
- allow vnddetach() to return EBUSY if any vnd's are currently initialised.
lkm:
- add new 'dev' directory, initially with just a 'vnd' LKM.  for now, the
vnd lkm driver requests 4 devices....

XXX: vnd should be converted to a psuedo-device that creates & deletes
instances of itself (vnd0, vnd1, etc) when vnconfig -c/-u are called,
then the vnd lkm driver can not be limited to '4' by default.
2002-11-16 08:10:48 +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
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
enami d21877b892 No longer need to calculate geomsize if we use fictitious geometry. 2002-08-12 02:34:12 +00:00
oster 4488afa61f Do not truncate the size of the vnd, as that will cause lossage with
images with sizes that are not multiples of 1MB.  Fix as proposed by me on
tech-kern, and ok'ed by Christos.
2002-08-02 14:43:32 +00:00
enami ef6c924232 Don't sprinkle cleanup code here and there (necessary cleanup was missed). 2002-07-26 06:16:32 +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 96ea8912e6 Convert to new device buffer queue interface. 2002-07-20 11:28:07 +00:00
atatat 851e916f1b Provide a means for vnconfig to indicate which devices are in use, and
by which files (hmm...why can't I unmount that file system over
there).  Currently this is just the device and inode number of the
file backing the vnd, but hopefully consing up full pathnames can be
done at some point.
2002-06-21 19:09:29 +00:00
briggs cf294f8f84 Ensure that b_bufsize is set to a range covering the buffer in vndstrategy().
This addresses kern/16570 where using the raw vnd device with a file backed by
NFS was failing due to bp->b_bufsize being 0.
2002-05-02 16:25:23 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
tsutsui cf839323de Call malloc(9) with M_ZERO flag instead of memset() after malloc(). 2002-01-13 19:28:06 +00:00
mrg 3ccb704762 add a vnddetach: it just free()s the vnd_softc. useful for LKM. 2002-01-04 06:31:08 +00:00
lukem 2bbe2de647 add RCSIDs 2001-11-13 05:32:49 +00:00
mrg 1578242c1a use _KERNEL_OPT so this can be built as an LKM. 2001-10-22 16:43:55 +00:00
chs 30e122c6f1 in vndstrategy(), handle the underlying file being force-unmounted. 2001-09-30 12:32:09 +00:00
thorpej c8b4ac1b17 bcopy -> memcpy
bzero -> memset
2001-07-07 17:04:01 +00:00
fvdl d040bd5908 Return error in the case of using ODIOCGDINFO or ODIOCGDEFLABEL when
the number of partitions is > OLDMAXPARTITIONS. This is better
than silently truncating the label (don't want to silently throw
away partitions when using an old disklabel binary on a label with
> 8 partitions). From Enami Tsugutomo.
2001-01-08 02:03:45 +00:00
fvdl e2d1c1f926 Adapt all disk devices in MI directories to handle ODIOC* calls
for ports that have bumped MAXPARTITIONS (and thus define
__HAVE_OLD_DISKLABEL).
2001-01-07 18:09:01 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
enami 9466b8d07e Define an auto variable `bn' as off_t instead of int since it is finally
converted to byte offset.
2000-09-12 08:03:24 +00:00
pk b369b979ae Remove duplicate `flags' from printf format string. 2000-08-20 11:51:52 +00:00
pk 0c448da29b When breaking up a transfer in vndstrategy(), only inherit B_READ and
B_ASYNC from the original buffer's flags.
2000-08-19 10:44:02 +00:00
augustss 169ac5b3c1 Remove register declarations. 2000-03-30 12:41:09 +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
thorpej dc59bc1db3 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:39:55 +00:00
fvdl ba7e45647d Initialize buffer dependencies list for soft updates when initializing
a new buffer.
1999-11-17 09:34:03 +00:00
thorpej 81eb5b98aa Add a couple of missing splbio()/splx() pairs that caused pool corruption. 1999-04-21 22:14:15 +00:00
thorpej b6ac7c9b6b Must use PR_NOWAIT when allocating component buffers. 1998-11-12 22:39:57 +00:00
thorpej 6056af462f Use the pool allocator for vndxfer and vndbuf structures. 1998-07-31 02:24:26 +00:00
bouyer 44650d03a6 Better fix for PR 5113, per discussion with fvdl: now that the vnode locking
interface allow recusive locks, use it instead of the local hack to avoid
recursive locking.
1998-03-12 16:51:41 +00:00