Commit Graph

97 Commits

Author SHA1 Message Date
mlelstv 4d7fa4351b Support dump on wedges. 2018-05-12 10:33:06 +00:00
mlelstv ba576b71a7 Enhance disk metrics by calculating a weighted sum that is incremented
by the number of concurrent I/O requests. Also introduce a new disk_wait()
function to measure requests waiting in a bufq.
iostat -y now reports data about waiting and active requests.

So far only drivers using dksubr and dk, ccd, wd and xbd collect data about
waiting requests.
2017-03-05 23:07:12 +00:00
jdolecek 198ff4069d pass also DIOCGCACHE to underlying device, so that upper layers would be able
to get the device cache properties without knowing the topology; while here also
pass down DIOCGSTRATEGY for neater dkctl(8) output
2017-02-27 21:27:07 +00:00
maya 58dc54ad55 use a bounded copy. NFCI 2017-01-19 00:44:40 +00:00
mlelstv 3ecac0ea7c add missing mutex/cv cleanup to error paths. 2016-12-24 16:39:55 +00:00
mlelstv 203fa789e4 Make dk(4) device mpsafe. 2016-12-16 15:06:39 +00:00
mlelstv a85ccad97b missed one exit path with the previous change. 2016-05-29 13:11:21 +00:00
mlelstv 5699db66ce release openlock mutex before closing parent device. 2016-05-29 12:48:40 +00:00
christos f2a7ea8367 Add dkwedge_find_by_parent() 2016-04-27 02:19:12 +00:00
mlelstv b5733512ba Allow dump to raidframe component which is a wedge.
N.B. ordinary devices check the partition type only in the xxxsize routine.
2016-01-15 07:48:22 +00:00
mlelstv 9da52a83e5 Return error in dkopen when dk_open_parent fails. Also change dk_open_parent
to pass error code to caller.
XXX: Pullups
2015-12-27 00:47:47 +00:00
mlelstv a4f2b41710 sc_size is already measured in sectors. 2015-11-28 13:41:31 +00:00
christos 8a6acf0efa remove incorrect comment (from kre) 2015-10-10 23:39:43 +00:00
jmcneill d9483ce0a0 print wedge announcement in one line instead of two 2015-10-06 11:22:40 +00:00
pooka 89cb80befc Rename variable to avoid -Wshadow warnings with some compilers. 2015-08-25 11:08:59 +00:00
mlelstv 1e8c46e3c4 No longer access the disk driver directly.
If there is an open wedge, temporarily reference its vnode.
Otherwise try to open the block device.
2015-08-22 07:48:14 +00:00
mlelstv 862a433dd4 revert the previous 2015-08-22 07:42:46 +00:00
mlelstv 819c32b42c when scanning for disklabels, close block device only when this was
the first open. The device driver doesn't do reference counting.

This is still subject to race conditions.
2015-08-20 23:08:33 +00:00
christos ed5aa85bd1 - Use NODEV instead of 0
- Return EBUSY if there was no label
2015-01-02 01:14:22 +00:00
christos c60db2e923 make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
2014-12-31 19:52:04 +00:00
mlelstv bdddf44518 disk_blocksize and disk_set_info relay the same information
to the disk subsystem.

Make disk_set_info also set blocksize shift values.
Remove every call to disk_blocksize.

Keep disk_blocksize for ABI compatibility, make it also set dg_secsize.
2014-12-31 08:24:50 +00:00
mlelstv 9c0686ce5c Really provide disk properties, the old code computed values that were
never attached to the device.
2014-12-08 17:45:12 +00:00
mlelstv c3fa2622e8 fix iobuf setup, cleanup 2014-11-22 11:59:33 +00:00
mlelstv 0c1adb76c8 Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
2014-11-04 07:50:39 +00:00
riastradh cc5c10ea14 Make dk(4) discard from partition start, not from disk start.
Otherwise, anything mounted with `-o discard' will pretty quickly
munch itself up and barf up an unrecoverably corrupted file system!

XXX pullup to netbsd-7
2014-08-28 19:37:46 +00:00
dholland 890e036b3c Implement d_discard for dk. This closes PR 47940. 2014-07-25 08:23:56 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland 8c70ef39af Add d_discard to all struct bdevsw instances I could find.
I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
2014-07-25 08:02:18 +00:00
christos 223a7bd55f add dkwedge_get_parent_name(). 2014-04-03 15:24:20 +00:00
dholland a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
soren dcaf98cac2 Don't complain about not being able to open empty removable media drives. 2013-08-03 18:30:57 +00:00
christos 7b845fa9dc phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
	  n useless copies of it.
2013-05-29 00:47:48 +00:00
chs cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
mlelstv 5741661f64 Make detection of root on wedges (dk(4)) machine independent. Remove
MD code for x86, xen, sparc64.
2012-06-10 17:05:18 +00:00
drochner d4145bf15d minor mostly cosmetical fixes: use designated type for device major
numbers, typo in comment, misuse of minor()
(the latter one is not cosmetical, but would only affect systems
with more than 256 disk wedges)
2012-04-27 18:15:55 +00:00
jmcneill d2b1c474ba Add an FSILENT flag and use it to suppress "Medium Not Present" scsipi
spam when trying to access offline drives at boot.
2011-07-30 12:08:36 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
christos b1b063f09f check rawvp before doing ioctl or strategy. 2011-03-03 03:39:08 +00:00
christos 0437d56b01 Make error checking consistent, possibly fixes PR/44652. 2011-02-28 18:28:20 +00:00
mlelstv 9c7e989427 Make wedges aware of underlying physical block size. 2010-12-23 14:22:03 +00:00
bouyer f5a8179a2f Make sure to release sc_parent->dk_rawlock before calling
vn_close(sc->sc_parent->dk_rawvp). Avoids a lockdebug panic:
error: mutex_destroy: assertion failed: !MUTEX_OWNED(mtx->mtx_owner) && !MUTEX_HAS_WAITERS(mtx)
when the parent is a raidframe device.
See also:
http://mail-index.netbsd.org/tech-kern/2010/07/27/msg008612.html
2010-08-04 12:34:00 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
mlelstv 1ce16876f7 d_psize routine returns a number of blocks or -1 on error.
d_dump routine returns 0 or an error code.
2010-02-07 16:04:31 +00:00
mlelstv ff9a9860d6 GPTs are defined in terms of physical blocks.
- Fix reading of GPT for devices with non-512byte sectors
- Fix bounds check to use DEV_BSIZE units.
2010-01-25 14:51:03 +00:00
bouyer 5d530cfdab struct buf::b_iodone is not called at splbio() any more.
Make sure non-MPsafe iodone callbacks raise the SPL as appropriate.
Fix buffer corruption issue I noticed in dk(4), and probable similar
issues in vnd(4) and cgd(4).
2010-01-23 18:31:04 +00:00
jakllsch a70f4ed596 Implement and use a dkminphys() that calls the parent device's minphys
function with b_dev temporarily adjusted to the parent device's dev_t.

Fixes PR/37390.
2009-12-27 01:37:17 +00:00
pooka 3446f432fa dkwedge_list() is currently called only from ioctl routines where
l == curlwp.  Since there is no perceived case where we'd ever want
to copy the list to non-curlwp, simplify the code a bit.
(the struct lwp * argument could probably be dropped too, but
that's another commit)
2009-09-08 21:14:33 +00:00
pooka 48575b808e grow some _KERNEL_POT 2009-09-07 13:59:38 +00:00
pooka f926eb58c3 Remove autoconf dependency on vfs and dk:
opendisk() -> kern/subr_disk_open.c
config_handle_wedges -> dev/dkwedge/dk.c
2009-09-06 16:18:55 +00:00
haad a0a1dfda1b Add support for DIOCGDISKINFO for wedges. This fixes regression after my
DIOCGDISKINFO commit to fsck/partutil.c.

Tested by me and adegroot@.
2009-08-06 16:00:49 +00:00