Commit Graph

171 Commits

Author SHA1 Message Date
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
ad 2af68666da Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
2007-10-08 16:41:05 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
hannken e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
yamt 073d78105b use b_bcount where appropriate rather than keeping b_resid sync with it.
no functional changes.
2007-03-09 05:28:37 +00:00
christos 15eacddccc Fix compression problem from Cliff Wright:
Break one: because b_cylinder, and b_resid are one and the same.
The work the routine was commented as being its primary function,
end of patition adjustment, is wiped out, as at the end of
the routine b_cylinder is set, splat, doing a wipe out of the adjustment
to b_resid.
  Break two: When doing the adjustment, a block count is created from a
byte count, a block calculation is done, then the results are compared to
the original byte count. i.e. apples to oranges, not blocks to blocks,
but blocks to bytes.
  Break three: since if all the other drivers that used this routine
would have broken as vnd compress did, I must assume they always ignored
the results of this routine. So if end of patition adjustment is
really required then all these other drivers have been broken for a
long time.
2007-03-05 02:55:32 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
chs 11703af575 don't print b_resid when it's not valid. 2007-01-28 21:33:24 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
jmmv ea4fb88d87 Do not mess with B_VFLUSH in the read/write case. Requested by yamt@.
(I did this because the system could panic otherwise.  But this seemed to
be a side-effect of another mistake that was present in the code before it
was commited.  So effectively this simplification should have happened
before.)
2006-11-11 13:42:14 +00:00
martin 43ae9165b5 size_t is not always == int 2006-11-10 14:31:14 +00:00
jmmv b6714d04d8 Check if the underlying file system supports VOP_BMAP and VOP_STRATEGY and,
if not, fallback to VOP_READ and VOP_WRITE.  This makes vnd work with files
on, e.g. tmpfs and smbfs; all file systems should behave as before.
OK'ed by silence in tech-kern@.
2006-11-09 15:27:40 +00:00
dogcow 372e6ef309 now that we have -Wno-unused-parameter, back out all the tremendously ugly
code to gratuitously access said parameters.
2006-10-17 18:21:29 +00:00
dogcow 4c85d8a8d6 more super exciting fun unused arguments. 2006-10-14 01:49:20 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
cube f6eef99476 Don't accept a compressed image that has 0 for the block size...
Fixes PR#34608.
2006-09-25 13:47:26 +00:00
elad 5425e24592 Use u_quad_t and not uint64_t (even though they might be the same),
pointed out by tsutsui@.
2006-09-23 07:54:17 +00:00
elad af7d9594a4 PR/34589: Cliff Wright: vnd(4) compress error with large files
Applied slightly different patch (u_int64_t -> uint64_t), thanks!
2006-09-23 00:53:46 +00:00
bouyer 2aee9a0f50 Back out rev 1.149.
From various discussion about vndstrategy (see
http://mail-index.netbsd.org/tech-kern/2005/03/29/0034.html
http://mail-index.netbsd.org/tech-kern/2005/03/23/0015.html)
it's not correct to tsleep() in a strategy routine, which may be called from
interrupt context.
Unfortunably this reopens PR/10731, PR/12189, PR/20296, PR/34293

As for what the correct fix it, this needs to be analysed deeper. I suspect
throttling the caller in vnd only hides the problem; the same caller writing
to some other device could exaust all buffers as well. If this driver doesn't
need to allocate buffer this won't cause a deadlock, but it's bad for
performances on systems with e.g. multiple drives. Also, others stacked
block device drivers may also have this issue.
2006-09-03 19:49:34 +00:00
christos b34c6cdc81 PR/34293: Michael van Elst: vnd deadlocks on I/O buffers
Also fixes: PR/10731, PR/12189, PR/20296
Sleep while there a buffer shortage.
2006-08-27 18:45:20 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
cube 59e53df5fa Silence device creation and destruction. That means there won't be
spurious messages when doing "vnconfig -l", but it also means there won't
be a message when an actual device is created.  Oh, well.

PR#33116 by Izumi Tsutsui.
2006-03-30 15:19:45 +00:00
thorpej 2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
dogcow a3d114851f as yamt and bouyer pointed out, there are a few other cases where l should
be checked for NULL, if one's going to do it at all, and that the proper idiom
is KASSERT, not panic.
2006-03-21 10:22:59 +00:00
dogcow de119fc4bd in VNDIOCGET, make sure there's a valid lwp. coverity CID 837. 2006-03-18 01:13:24 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
yamt e31143d772 vndthread: fix an integer overflow. fix a panic reported by Simon Burge. 2006-02-04 13:40:38 +00:00
yamt 9e261d2477 vndstrategy: do bounds_check_with_mediasize. 2006-02-04 13:38:04 +00:00
yamt 6e6449891d vndthread: play with b_vp and v_numoutput as it used to do,
for "strange" filesystems like nfs.  PR/32671 from Simon Burge.

although i'm not really happy with this "fix", i think that the code will
be replaced with direct i/o anyway, sooner or later...
2006-02-04 11:52:32 +00:00
yamt b38b1510eb vnd_cget: remove a wrong comment. 2006-02-04 11:19:59 +00:00
yamt fe1aa7db74 vnd_destroy: don't access freed memory. 2006-02-04 10:48:32 +00:00
cube 69a545f3ff Fix typo. 2006-02-02 06:57:35 +00:00
cube da9c97d43c Move the code that destroys the device to vndclose. That way it no longer
returns ENXIO when deconfiguring a vnd.
2006-02-02 06:56:30 +00:00
cube 9f02c7bd62 Free cfdata memory. The tap LKM might be wrong in that area, to...
Pointed out by Greg Oster.
2006-02-01 05:05:22 +00:00
cube aa933732c0 Free the bufq. Pointed out by yamt@. 2006-02-01 04:30:10 +00:00
cube 6527a45571 Have vnd(4) devices automatically created when the user tries to
configure one.  That removes the compile-time constant that limits the
number of vnds.

Thanks xtraeme@ for testing.
2006-02-01 03:15:33 +00:00
yamt c05dbefbea compstrategy: remove bogus handling of B_PHYS. 2006-01-15 12:14:52 +00:00
yamt 432eec05f5 use nestiobuf api for vnd. 2006-01-11 00:50:29 +00:00
yamt e86cc25701 don't set b_rawblkno unnecessarily.
it will be set by device strategy routine.
2006-01-11 00:49:59 +00:00
yamt fe3aca751f do b_blkno -> b_rawblkno translation earlier so that bufq can use it. 2006-01-08 09:09:00 +00:00
yamt 9c0e5c0db7 - do disk_busy/unbusy for requested i/o, rather than ones that we reuqest.
- on error, be conservative about b_resid.
- make vndthread static.
2006-01-07 13:25:50 +00:00
bouyer fc1d07dd69 Only VNDIOCSET needs a valid process context, so don't blindly
dereference l, test it l is NULL first.
Fix exporting a vnd device to a XENU domain.
2005-12-14 19:49:16 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
christos f9364a8936 Fix logic error in vndiocget. 2005-08-28 08:56:14 +00:00