Commit Graph

184 Commits

Author SHA1 Message Date
cegger
75946855ff Checking if the underlying file system supports VOP_BMAP and VOP_STRATEGY does not imply that works.
Test if VOP_BMAP actually works before using bmap/strategy.

When you create an image with

dd if=/dev/zero of=./netbsd.img bs=1m count=1 seek=1000

then the current check actually determines the "file system"
in the image supports VOP_BMAP and VOP_STRATEGY, but VOP_BMAP can't
translate any logical block numbers which results in EIO failures.

When you try to access the image in a Xen DomU you see all disk operations
failing. Therefore test if VOP_BMAP actually works and fall back to
VOP_READ/VOP_WRITE if it doesn't.

This makes a Xen DomU installation working. When you boot your fresh
installed Xen DomU with a valid disklabel and file system in the image,
VOP_BMAP actually works and is used.

This allows you to create an image with dd as above on the Dom0 and
run a DomU installation or to quickly create another virtual disk for
an existing DomU without having to create a disklabel and file system
by hand.
2008-06-14 11:44:57 +00:00
cegger
826cd7b39b add closing bracket in debug message 2008-06-14 07:52:36 +00:00
cegger
fc8fd752ef device_private(device_lookup()) -> device_lookup_private()
ok cube@
2008-06-10 22:53:08 +00:00
ad
2bbb14eaa4 Back out previous. It broke the build. 2008-05-05 13:41:29 +00:00
ad
b407147f14 Move zlib out of net/ and into kern/. It would probably be better to use
the reachover Makefiles and libz, but this is already here and it works.
2008-05-04 23:07:09 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cegger
c1886a2781 use aprint_*_dev and device_xname 2008-04-09 05:47:19 +00:00
ad
a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
cube
e567de2f43 Split device_t/softc and other related cosmetic changes. 2008-03-04 23:03:29 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
riz
0673bc57e4 Add disk-info properties to vnd(4), for use by userland tools
such as gpt(8).
2007-12-18 23:22:18 +00:00
smb
472e153a90 Add power management hooks 2007-12-12 03:54:27 +00:00
pooka
db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
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