summaryrefslogtreecommitdiff
path: root/sys/dev/dksubr.c
AgeCommit message (Collapse)Author
2021-04-15dk_start(): retry device-dependent start() routine later, also when itrin
returns ENOMEM in addition to EAGAIN. Device-dependent start() routine may allocate buffer directly, or via bus_dma(9) API (some implementations for bus_dma(9) like alpha allocate memory internally). If these attempts fail with ENOMEM, this is not a disk error, therefore we must retry later, as already done for EAGAIN.
2020-03-01Add a flag to dk_dump for virtual disk devices.riastradh
If a disk is backed by a physical medium other than itself, such as cgd(4), then it passes DK_DUMP_RECURSIVE to disable the recursion detection for dk_dump. If, however, a device represents a physical medium on its own, such as wd(4), then it passes 0 instead. With this, I can now dump to dk on cgd on dk on wd.
2019-12-08Drop now unused dk_lookup function.mlelstv
2019-10-05Bail when dkdriver hasn't been initialized. This can happen whenmlelstv
attachment failed or when it hasn't finished yet.
2019-06-28Store a reference to the CPU that submitted the I/O request with thejmcneill
request itself.
2019-04-21wether -> whethermaya
2019-03-27Add a disk ioctl DIOCRMWEDGES to remove all wedges of a given diskmartin
(if not busy).
2019-01-07fix the disklabel sanity check coversion for case when both disklabeljdolecek
and disk geometry are > DEV_BSIZE, such as fictitious cd(4) disklabel still part of PR kern/53833
2019-01-07convert the sector counts for label sanity checks to use same unit (DEV_BSIZE),jdolecek
so that the check is meaningful if disklabel sector size and disk geometry sector size differ - for example 512 disklabel vs 2048 for sparc cd(4) conversion assumes that the sector sizes are multiples of DEV_BSIZE (512) fixes kern/53833 by Andreas Gustafsson Note: the checks are executed #ifdef DIAGNOSTIC, that's why nothing is printed by 8.0 kernel, or anything built from release branches
2018-11-24rnd_add_uint32() doens't support concurent calls for the same rnd_source,bouyer
call it with dksc->sc_iolock held.
2018-09-03Rename min/max -> uimin/uimax for better honesty.riastradh
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
2018-05-12Support dump on wedges.mlelstv
2017-12-04add KASSERT() just before setting sc_deferred, to ensure this doesjdolecek
not trigger problem in PR kern/52769
2017-10-29Use driver specific label code as fallback. This fixes the UDF label for CDs.mlelstv
2017-08-24Initialize error also in the case where len=0, which just succeeds.maya
while here, assert that the len is indeed non-negative. this is already confirmed by sys_fdiscard, but let's be sure. reported by: GCC, but with different compile flags
2017-08-13validate length for discard operation and split operation when byte lengthmlelstv
doesn't fit into 'int'.
2017-04-27do not attach nvme ld as randomness source - device is too fast, it overwhelmsjdolecek
the rndq handling code, and causes system crashes; gathering rnd there is also bad idea from performance perspective
2017-03-05Enhance disk metrics by calculating a weighted sum that is incrementedmlelstv
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-02-25pacify disklabel validation messagemlelstv
2016-12-22Fix race condition in dksubr, where a dk_start from another threadmlelstv
or interrupt was ignored while the queue was processed. Bump kernel revision for changed dk_softc.
2016-12-08invoke optional d_label callback to give the driver the possibilitymlelstv
to adjust the label with driver specific data.
2016-11-28Extend dkdriver interface with a d_firstopen function. This is calledmlelstv
by dk_open() for the first opener and mirrors the use of the d_lastclose callback. Bump kernel version for the interface change.
2016-10-24revert 1.90 of dksubr.c and change sc_deferred back to simple pointer; thejdolecek
global sc_busy flag guards against race so it's not actually necessary, and this place is unlikely to need to be parallelized in near future discussed with mlelstv@
2016-10-22change sc_deferred to TAILQ (reusing bufq b_actq) to avoid possible buf leakjdolecek
for MPSAFE drivers
2016-09-14Set b_resid in error path.mlelstv
2016-06-27CID 1362902: forward nullchristos
CID 136290{3,4}: missing break
2016-06-26Avoid NULL deref in case no bufq has been set.mlelstv
2016-01-04erase dangling pointer to prevent reusemlelstv
2015-12-21support deferral of diskstart to a separate thread.mlelstv
2015-12-21more sanity checksmlelstv
2015-12-08Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead ofchristos
pointers.
2015-11-28bounds check requires consistent units, i.e. DEV_BSIZE.mlelstv
2015-10-23remove extra quotechristos
2015-10-23fix this differently.christos
2015-10-23fix build failure on i386.knakahara
2015-10-22fix constant namechristos
2015-10-21Fix dumping code (dk_dump):christos
- set DKF_TAKEDUMP on attach, otherwise we can never dump - add DKF_DUMP debugging - use __func__ instead of hard-coding names - only allow dumps on swap partitions
2015-08-28move entropy gathering into dksubr.mlelstv
2015-08-28Prevent race condition where two threads can defer a buffer.mlelstv
2015-08-27Make dksubr use a spin-mutex again, since some drivers still call dk_donemlelstv
from hardware interrupt. Instead, release mutex while calling start routine. The buffer peek/use/get sequence which can no longer be atomic. So consume the buffer directly and on error privately save and retry the buffer later. The dk_drain function is used to flush such a deferred buffer together with the buffer queue. Adjust drivers to use dk_drain. Fix an error path where dk_done was called while the lock was already held.
2015-08-23An adaptive mutex is sufficient, the data structures are accessedmlelstv
by regular threads and by the biodone softint. This allows diskstart routines to sleep (like cgd).
2015-08-18only touch b_resid on error.mlelstv
2015-08-16Two changes to the dksubr interface.mlelstv
- 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-16require write access to delete a wedgemlelstv
2015-08-16move FWRITE checks to a common placemlelstv
2015-08-02fix diskerr message, it needs the driver name, not the device unit name.mlelstv
2015-07-22Trailing whitespace.skrll
2015-07-19Handle non-DEV_BSIZE sectors.mlelstv
2015-07-12remove duplicate variable initializations.mlelstv
2015-07-11Mark disklabel only invalid on the last close. Existing openers might seemlelstv
temporarily invalid data while it is re-read.