Commit Graph

90 Commits

Author SHA1 Message Date
jakllsch f397bb6d4d Add support for implementing discard functionality with ld(4) 2015-08-17 19:47:21 +00:00
mlelstv 28e124faa7 Two changes to the dksubr interface.
- d_diskstart callback now processes a single buffer only.
  The new wrapper function dk_start processes the queue,
  performs other buffer handling and also provides locking
  for the the data structures.

- add d_discard callback to handle device specific function inside
  the new dk_discard helper function.

Replace splbio with mutex to protect queue and disk structure.
Refactor common code in dk_strategy and dk_discard into dk_translate.

Adjust and simplify ld(4), cgd(4) and xbd(4) drivers accordingly.

ld(4) now becomes MP_SAFE.

Bump kernel version.
2015-08-16 18:00:03 +00:00
mlelstv 975ae63de7 missed wakeup -> cv_broadcast conversion. 2015-08-16 17:32:31 +00:00
mlelstv 1cc5f2a75e use device_printf 2015-08-16 17:22:00 +00:00
mlelstv f0f7e7a642 replace tsleep with condvar 2015-08-16 14:07:19 +00:00
mlelstv f7d15a6b0d replace spl and tsleep with mutex and condvar. 2015-08-16 14:02:52 +00:00
skrll 2937f60293 Trailing whitespace. 2015-07-22 10:32:16 +00:00
mlelstv 5f99165065 Merge dk_intf and dkdriver interfaces.
Merge common disk driver functionality in ld.c with dksubr.c.
Adjust the two previous users of dk_intf (cgd and xbd) to
the changes.

bump kernel version to 7.99.14
2015-05-02 08:00:08 +00:00
riastradh 233f556c2e Convert sys/dev to use <sys/rndsource.h>. 2015-04-13 16:33:23 +00:00
christos c182898b0d We have three sets of DTYPE_ constants in the kernel:
altq		Drop 		Type
	disklabel	Disk 		Type
	file		Descriptor	Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
2015-01-02 19:42:05 +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
christos 3be6bb2414 Centralize wedge ioctls in disk_ioctl. 2014-12-31 17:06:48 +00:00
mlelstv 64c07f5206 support DIOCMWEDGES ioctl. 2014-11-04 07:51:54 +00:00
mlelstv 53385cb9cd clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
2014-10-11 12:01:27 +00:00
matt 103f3cd915 Don't use new as a variable name. 2014-09-05 05:27:23 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +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
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
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
tls 7b0b7dedd9 Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
   to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
   source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
   avoid expensive operations on disabled entropy sources; make the
   rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
   have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
   system events, and skew between clocks, with a sample implementation
   for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files).  Tested with release
builds on amd64 and evbarm and live testing on amd64.
2012-02-02 19:42:57 +00:00
kiyohara e7ce62fde3 Check disk bounds, in RAW_PART. 2010-09-20 06:54:06 +00:00
jmcneill b4ea244316 flush cache on suspend 2010-08-19 17:59:10 +00:00
dyoung 90dc63ec14 Extract ldlastclose() and use it in ldclose(). At the top of
ldbegindetach(), call disk_begindetach(..., ldlastclose, ...).

Compiles.  Not tested.
2009-07-23 21:38:33 +00:00
cegger 5496566c68 struct device * -> device_t, no functional changes intended. 2009-05-07 09:11:42 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
tron 362b2f2b14 Complete device_t/softc split for the ld(4) attachments. This should
prevent crashes while attaching a drive.

Patch supplied by Juan RP in PR kern/39468.
2008-09-09 12:45:39 +00:00
simonb 82bb1c2ff8 Add a flags argument to the ld(4) flush handlers, and call these with a
"poll" flag when called from ld_shutdown().

This is the infrastructure part of kern/38655 - in itself it doesn't
fix the panic referenced in that PR.

XXX: At least ld_twa.c and perhaps ld_iop.c and ld_icp.c need to
check for this new poll flag and do something useful.
2008-08-11 06:43:37 +00:00
ws d172dc9df5 Destroy our mutex on detach in order to avoid
an "allocation contains active lock" panic
when halting a LOCKDEBUG kernel.
2008-08-01 16:09:45 +00:00
cube 4b9fef643e Use device_private() where appropriate.
Noted by Paul Goyette in PR#39110.
2008-07-06 14:07:44 +00:00
tsutsui 13a1e15f0e Use device_lookup_private() to get softc. 2008-06-11 12:41:22 +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
jmcneill 47379c8458 Don't forget to deregister with PMF on detach. 2008-03-09 19:18:25 +00:00
jmcneill fdf8cc9718 Replace shutdownhook with PMF power handler. 2008-03-09 19:15:01 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
xtraeme 1b0de52cf2 Use sc_mutex (which runs at IPL_BIO) to protect the DIOC[GS]STRATEGY
ioctl ops, sorry didn't see it before.
2007-11-12 19:01:07 +00:00
xtraeme 4ffff27911 Implement DIOCGSTRATEGY and DIOCSSTRATEGY for dkctl <foo0> strategy. 2007-11-12 14:45:23 +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 b5a9ff06f1 Replace some uses of lockmgr(). 2007-07-21 19:51:47 +00:00
tron c021b87a9d Reset error code if an ioctl() request is not handled by the generic
disk framework. This stops ld(4) from returning an error for various
ioctl() requests which actually *did* work. As a result fdisk(8) and
therefore also sysinst(8) work with ld(4) devices once again.

Based on a patch supplied by Todd Kover in PR kern/36244, successfully
tested with ld(4)@icp(4).
2007-04-30 17:23:09 +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
riz 52138eeaf6 Defer dkwedge_discover() until after interrupts are enabled. This
allows a kernel with options DKWEDGE_AUTODISCOVER to boot
on a machine with a twa(4) card.

ok matt@
2007-02-22 22:28:32 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
riz 35ed82b748 Add disk-info properties to ld(4), based on Jason Thorpe's similar
code in wd(4).

OK ad, cube
2007-02-08 03:19:42 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +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