Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/dksubr.c
RevisionDateAuthorComments
 1.118  18-Feb-2025  mlelstv Allowing dump to a RAID partition (i.e. a raid(4) component).
Fixes PR 59024
 1.117  06-Feb-2025  jakllsch fix debug printf in dk_discard()
 1.116  06-Feb-2025  jakllsch off_t is closer to long than it is to unsigned int; so use lmin()
rather than uimin()

Avoids incorrectling telling dk_translate() we're trying to do nothing.
 1.115  06-Feb-2025  jakllsch Prevent leakage of 4 bytes of stack data via return of uninitialized b_error.
eVS: ----------------------------------------------------------------------
 1.114  11-Jul-2023  christos branches: 1.114.6;
Move the rnd_add_uint32 outside the lock and get rid of dk_done1() suggested
by riastradh@
 1.113  15-Apr-2021  rin branches: 1.113.16;
dk_start(): retry device-dependent start() routine later, also when it
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.
 1.112  01-Mar-2020  riastradh branches: 1.112.8;
Add a flag to dk_dump for virtual disk devices.

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.
 1.111  08-Dec-2019  mlelstv Drop now unused dk_lookup function.
 1.110  05-Oct-2019  mlelstv Bail when dkdriver hasn't been initialized. This can happen when
attachment failed or when it hasn't finished yet.
 1.109  28-Jun-2019  jmcneill branches: 1.109.2;
Store a reference to the CPU that submitted the I/O request with the
request itself.
 1.108  21-Apr-2019  maya wether -> whether
 1.107  27-Mar-2019  martin Add a disk ioctl DIOCRMWEDGES to remove all wedges of a given disk
(if not busy).
 1.106  07-Jan-2019  jdolecek fix the disklabel sanity check coversion for case when both disklabel
and disk geometry are > DEV_BSIZE, such as fictitious cd(4) disklabel

still part of PR kern/53833
 1.105  07-Jan-2019  jdolecek convert the sector counts for label sanity checks to use same unit (DEV_BSIZE),
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
 1.104  24-Nov-2018  bouyer rnd_add_uint32() doens't support concurent calls for the same rnd_source,
call it with dksc->sc_iolock held.
 1.103  03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

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!)
 1.102  12-May-2018  mlelstv branches: 1.102.2;
Support dump on wedges.
 1.101  04-Dec-2017  jdolecek branches: 1.101.2;
add KASSERT() just before setting sc_deferred, to ensure this does
not trigger problem in PR kern/52769
 1.100  29-Oct-2017  mlelstv Use driver specific label code as fallback. This fixes the UDF label for CDs.
 1.99  24-Aug-2017  maya Initialize error also in the case where len=0, which just succeeds.
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
 1.98  13-Aug-2017  mlelstv validate length for discard operation and split operation when byte length
doesn't fit into 'int'.
 1.97  27-Apr-2017  jdolecek branches: 1.97.2;
do not attach nvme ld as randomness source - device is too fast, it overwhelms
the rndq handling code, and causes system crashes; gathering rnd there is
also bad idea from performance perspective
 1.96  05-Mar-2017  mlelstv branches: 1.96.4;
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.
 1.95  25-Feb-2017  mlelstv pacify disklabel validation message
 1.94  22-Dec-2016  mlelstv branches: 1.94.2;
Fix race condition in dksubr, where a dk_start from another thread
or interrupt was ignored while the queue was processed.

Bump kernel revision for changed dk_softc.
 1.93  08-Dec-2016  mlelstv invoke optional d_label callback to give the driver the possibility
to adjust the label with driver specific data.
 1.92  28-Nov-2016  mlelstv Extend dkdriver interface with a d_firstopen function. This is called
by dk_open() for the first opener and mirrors the use of the d_lastclose
callback.

Bump kernel version for the interface change.
 1.91  24-Oct-2016  jdolecek revert 1.90 of dksubr.c and change sc_deferred back to simple pointer; the
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@
 1.90  22-Oct-2016  jdolecek change sc_deferred to TAILQ (reusing bufq b_actq) to avoid possible buf leak
for MPSAFE drivers
 1.89  14-Sep-2016  mlelstv Set b_resid in error path.
 1.88  27-Jun-2016  christos branches: 1.88.2;
CID 1362902: forward null
CID 136290{3,4}: missing break
 1.87  26-Jun-2016  mlelstv Avoid NULL deref in case no bufq has been set.
 1.86  04-Jan-2016  mlelstv erase dangling pointer to prevent reuse
 1.85  21-Dec-2015  mlelstv support deferral of diskstart to a separate thread.
 1.84  21-Dec-2015  mlelstv more sanity checks
 1.83  08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.82  28-Nov-2015  mlelstv bounds check requires consistent units, i.e. DEV_BSIZE.
 1.81  23-Oct-2015  christos remove extra quote
 1.80  23-Oct-2015  christos fix this differently.
 1.79  23-Oct-2015  knakahara fix build failure on i386.
 1.78  22-Oct-2015  christos fix constant name
 1.77  21-Oct-2015  christos Fix dumping code (dk_dump):
- 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
 1.76  28-Aug-2015  mlelstv move entropy gathering into dksubr.
 1.75  28-Aug-2015  mlelstv Prevent race condition where two threads can defer a buffer.
 1.74  27-Aug-2015  mlelstv Make dksubr use a spin-mutex again, since some drivers still call dk_done
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.
 1.73  23-Aug-2015  mlelstv An adaptive mutex is sufficient, the data structures are accessed
by regular threads and by the biodone softint.

This allows diskstart routines to sleep (like cgd).
 1.72  18-Aug-2015  mlelstv only touch b_resid on error.
 1.71  16-Aug-2015  mlelstv 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.
 1.70  16-Aug-2015  mlelstv require write access to delete a wedge
 1.69  16-Aug-2015  mlelstv move FWRITE checks to a common place
 1.68  02-Aug-2015  mlelstv fix diskerr message, it needs the driver name, not the device unit name.
 1.67  22-Jul-2015  skrll Trailing whitespace.
 1.66  19-Jul-2015  mlelstv Handle non-DEV_BSIZE sectors.
 1.65  12-Jul-2015  mlelstv remove duplicate variable initializations.
 1.64  11-Jul-2015  mlelstv Mark disklabel only invalid on the last close. Existing openers might see
temporarily invalid data while it is re-read.
 1.63  09-May-2015  christos CID 1297229: use strlcpy
 1.62  09-May-2015  mlelstv CID 1297229: Memory - illegal accesses (BUFFER_SIZE_WARNING)
 1.61  05-May-2015  mlelstv warn about labels only when built with DIAGNOSTIC
 1.60  02-May-2015  mlelstv 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
 1.59  01-May-2015  mlelstv correctly return -1 on error in dk_size
 1.58  31-Dec-2014  christos 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.
 1.57  31-Dec-2014  christos Centralize wedge ioctls in disk_ioctl.
 1.56  29-Dec-2014  mlelstv Implement DIOCGMEDIASIZE and DIOCGSECTORSIZE from FreeBSD.
 1.55  29-Dec-2014  mlelstv align dk_strategy with checks from ld.c
 1.54  04-Nov-2014  mlelstv branches: 1.54.2;
support DIOCMWEDGES ioctl.
 1.53  11-Oct-2014  mlelstv No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.
 1.52  11-Oct-2014  mlelstv clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
 1.51  14-Jun-2014  hannken branches: 1.51.2;
Change dk_lookup() to return an anonymous vnode not associated with
any file system. Change all consumers of dk_lookup() to get the
device from "v_rdev" instead of VOP_GETATTR() as specfs does not
support VOP_GETATTR(). Devices obtained with dk_lookup() will no
longer disappear on forced unmounts.

Fix for PR kern/48849 (root mirror raid fails on shutdown)

Welcome to 6.99.44
 1.50  25-May-2014  bouyer As proposed in
https://mail-index.netbsd.org/tech-kern/2014/05/21/msg017098.html
remove dk_start() and dk_iodone() from dksubr.c and move the related code
to the underlying driver.
This increase complexity only marginally: the underlying drivers have
to do the while() loop themselves, but this can now be done properly with
bufq_peek()/bufq_get(), removing the buffer from the queue at the right time.
This handle both the recursion and reordering issues (the reordering
issue is described here:
https://mail-index.netbsd.org/tech-kern/2014/05/19/msg017089.html
the recursion isssue is PR #25240).

Difference with the patch posted to tech-kern@: KASSERT() that the
buffer we remove with bufq_get() is the same as the one we bufq_peek()'d
just before.
Hopefully this will allow more disk drivers to use dksubr.c
 1.49  28-Dec-2013  pgoyette branches: 1.49.2;
Make dksubr.c into a module, and make the cgd and dm modules depend on
it.

Now that cgd is completely modularized, descend into modules/cgd to
actually create the module.
 1.48  29-May-2013  christos branches: 1.48.2;
eliminate sc_size and fix printf formats
 1.47  29-May-2013  christos eliminate dk_geom
 1.46  29-May-2013  christos phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
n useless copies of it.
 1.45  29-May-2012  elric branches: 1.45.2;
Fix 32/64 bit int truncation issue.
 1.44  25-May-2012  elric Revert a few lines of accidental commit.
 1.43  25-May-2012  elric Modify dksubr.c to add a function that sets the disk properties in
the drvctl framework. And call this new functionality from cgd(4),
the consumer of dksubr.c. We do this to allow gpt(8) to be able
to label cgd(4) disks. We also add in some DIOCGSECTORSIZE logic
and we ensure that the WEDGE ioctls are not called on either
uninitialised disks or disks which have not been opened for write
access.
 1.42  19-Nov-2010  dholland branches: 1.42.8; 1.42.12; 1.42.14;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.41  24-Jun-2010  hannken 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.
 1.40  13-Jan-2009  yamt branches: 1.40.4; 1.40.6;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.39  11-Jan-2009  cegger make this compile
 1.38  11-Jan-2009  christos merge christos-time_t
 1.37  28-Apr-2008  martin branches: 1.37.8;
Remove clause 3 and 4 from TNF licenses
 1.36  05-Apr-2008  cegger branches: 1.36.2; 1.36.4;
Allow to pass device_xname() to dk_sc_init() without build error
OK joerg
 1.35  21-Mar-2008  ad branches: 1.35.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.34  30-Jan-2008  ad branches: 1.34.6;
Remove code to prevent multiple open of block devices; it's no longer
needed.
 1.33  08-Dec-2007  pooka 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.
 1.32  26-Nov-2007  pooka branches: 1.32.2;
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
 1.31  29-Jul-2007  ad branches: 1.31.4; 1.31.6; 1.31.12; 1.31.14;
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.
 1.30  21-Jul-2007  ad Replace some uses of lockmgr().
 1.29  26-Jun-2007  cube branches: 1.29.2;
Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().

While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.

The issue has been there since last august, I'm actually a bit surprised
that no one in the meantime has used ccd(4) or cgd(4) on an arch where it
would have simply faulted.
 1.28  04-Mar-2007  christos branches: 1.28.2; 1.28.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27  16-Nov-2006  christos branches: 1.27.2; 1.27.4; 1.27.8;
__unused removal on arguments; approved by core.
 1.26  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25  04-Sep-2006  dan branches: 1.25.2; 1.25.4;
typo in debug printf
 1.24  27-Aug-2006  christos Add horrible hack for wedges. Why is the block device of the wedges in use?
 1.23  21-Jul-2006  ad - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.22  14-May-2006  elad integrate kauth.
 1.21  26-Dec-2005  yamt branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
- add ioctls to set/get disk bufq strategy.
- implement them for some drivers.
 1.20  11-Dec-2005  rpaulo More ktrace-lwp merge.
 1.19  11-Dec-2005  christos merge ktrace-lwp.
 1.18  18-Oct-2005  yamt dksubr: do b_blkno -> b_rawblkno translation earlier so that bufq can uses it.
 1.17  15-Oct-2005  yamt - 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)
 1.16  20-Aug-2005  yamt add wedge support to xbd and cgd.
 1.15  28-Jun-2005  drochner branches: 1.15.2;
constification fallout
 1.14  28-Oct-2004  yamt move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.13  23-Aug-2004  thorpej Sprinkle static in a few places.
 1.12  19-Apr-2004  hannken Redo dk_start(). If di->di_diskstart() runs synchronous its biodone() will
call dk_start() via dk_iodone() before the buffer gets removed from queue.

Approved by: Roland Dowdeswell <elric@netbsd.org>

Fixes PR #25240
 1.11  27-Mar-2004  elric branches: 1.11.2;
Modified the dksubr routines to:

o expect the disk's start routine to return an int. If the
int is non-zero, we enqueue the request and try again
later.
o have a dk_start() routine which runs the request queue.
o have a dk_iodone() function which should be called by the
driver using the framwork from its iodone. dk_iodone will
retry the queue since presumably further progress may be
possible once a request is complete. It is required that
the underlying driver have the resources to keep at least
one transaction in flight at any time.

Modified cgd to:

o be able to keep one transaction in flight at any time
(almost) by keeping a buffer of size MAXPHYS in its softc
and use it.

We still need to make the cgd_cbufpool per device rather than global
and provide a low water mark for it.

Addresses PR: kern/24715
(at least according to the submitter.)
 1.10  14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.9  29-Jun-2003  fvdl branches: 1.9.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.8  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7  12-May-2003  atatat make this compile again.
 1.6  10-May-2003  thorpej Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself. This paves the way for some future changes.
 1.5  02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.4  17-Dec-2002  elric Memset disklabel area to zero before beginning when constructing default
labels. Problem noticed and tested by dan@.
 1.3  12-Oct-2002  elric branches: 1.3.2;
We need to pass the dk_softc, not the osc.
 1.2  09-Oct-2002  elric We need to do biodone() if strategy is called on an unconfigured device.
 1.1  04-Oct-2002  elric A slight abstraction for disks. This is mainly [right now] in
support of the cryptographic disk which I'll be checking in shortly.
 1.3.2.3  19-Dec-2002  thorpej Sync with HEAD.
 1.3.2.2  18-Oct-2002  nathanw Catch up to -current.
 1.3.2.1  12-Oct-2002  nathanw file dksubr.c was added on branch nathanw_sa on 2002-10-18 02:41:27 +0000
 1.9.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.6  02-Nov-2004  skrll Sync with HEAD.
 1.9.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.9.2.3  25-Aug-2004  skrll Sync with HEAD.
 1.9.2.2  03-Aug-2004  skrll Sync with HEAD
 1.9.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.11.2.1  21-Apr-2004  jmc Pullup rev 1.12 (requested by elric in ticket #163)

Redo dk_start(). If di->di_diskstart() runs synchronous its biodone() will
call dk_start() via dk_iodone() before the buffer gets removed from queue.
PR#25240
 1.15.2.7  24-Mar-2008  yamt sync with head.
 1.15.2.6  04-Feb-2008  yamt sync with head.
 1.15.2.5  21-Jan-2008  yamt sync with head
 1.15.2.4  07-Dec-2007  yamt sync with head
 1.15.2.3  03-Sep-2007  yamt sync with head.
 1.15.2.2  30-Dec-2006  yamt sync with head.
 1.15.2.1  21-Jun-2006  yamt sync with head.
 1.21.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.21.8.4  14-Sep-2006  yamt sync with head.
 1.21.8.3  03-Sep-2006  yamt sync with head.
 1.21.8.2  11-Aug-2006  yamt sync with head
 1.21.8.1  24-May-2006  yamt sync with head.
 1.21.6.1  01-Jun-2006  kardel Sync with head.
 1.21.4.1  09-Sep-2006  rpaulo sync with head
 1.25.4.2  10-Dec-2006  yamt sync with head.
 1.25.4.1  22-Oct-2006  yamt sync with head
 1.25.2.1  18-Nov-2006  ad Sync with head.
 1.27.8.1  03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.27.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.27.2.1  01-Jul-2007  bouyer Pull up following revision(s) (requested by cube in ticket #748):
sys/dev/dksubr.c: revision 1.29
sys/dev/ccd.c: revision 1.120
sys/dev/raidframe/rf_disks.c: revision 1.66
sys/dev/raidframe/rf_reconstruct.c: revision 1.96
sys/dev/cgd.c: revision 1.45
sys/dev/dkvar.h: revision 1.11
sys/dev/raidframe/rf_copyback.c: revision 1.38
Change dk_lookup() to accept an additional argument of the type enum uio_seg
that tells whether the given path is in user space or kernel space, so it
can tell NDINIT().
While the raidframe calls were ok, both ccd(4) and cgd(4) were passing
pointers to user space data, which leads to strange error on i386, as
reported by Jukka Salmi on current-users.
 1.28.4.1  11-Jul-2007  mjf Sync with head.
 1.28.2.4  20-Aug-2007  ad Sync with HEAD.
 1.28.2.3  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.28.2.2  15-Jul-2007  ad Sync with head.
 1.28.2.1  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.29.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.31.14.2  29-Jul-2007  ad 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.
 1.31.14.1  29-Jul-2007  ad file dksubr.c was added on branch matt-mips64 on 2007-07-29 12:50:19 +0000
 1.31.12.3  18-Feb-2008  mjf Sync with HEAD.
 1.31.12.2  27-Dec-2007  mjf Sync with HEAD.
 1.31.12.1  08-Dec-2007  mjf Sync with HEAD.
 1.31.6.2  23-Mar-2008  matt sync with HEAD
 1.31.6.1  09-Jan-2008  matt sync with HEAD
 1.31.4.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.31.4.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.32.2.1  26-Dec-2007  ad Sync with head.
 1.34.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.34.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.34.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.35.2.2  01-Nov-2008  christos Sync with head.
 1.35.2.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.36.4.3  11-Aug-2010  yamt sync with head.
 1.36.4.2  04-May-2009  yamt sync with head.
 1.36.4.1  16-May-2008  yamt sync with head.
 1.36.2.1  18-May-2008  yamt sync with head.
 1.37.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.40.6.2  05-Mar-2011  rmind sync with head
 1.40.6.1  03-Jul-2010  rmind sync with head
 1.40.4.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.42.14.1  03-Jun-2014  sborrill Pull up the following revisions(s) (requested by bouyer in ticket #1075):
sys/arch/xen/xen/xbd_xenbus.c: revision 1.63 via patch
sys/dev/cgd.c: revision 1.87 via patch
sys/dev/dksubr.c: revision 1.50 via patch
sys/dev/dkvar.h: revision 1.19 via patch

Avoid xbd(4) reordering requests, which, depending on the underlying
hardware, can badly affect write performances. This can give up to a 5x
performance gain in sequencial writes.
 1.42.12.1  02-Jun-2012  mrg sync to latest -current.
 1.42.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.8.1  30-Oct-2012  yamt sync with head
 1.45.2.3  03-Dec-2017  jdolecek update from HEAD
 1.45.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.45.2.1  23-Jun-2013  tls resync from head
 1.48.2.1  18-May-2014  rmind sync with head
 1.49.2.1  10-Aug-2014  tls Rebase.
 1.51.2.3  01-Jun-2015  snj Pull up following revision(s) (requested by jnemeth in ticket #775):
share/man/man9/disk.9: revision 1.37
sys/kern/subr_disk.c: revisions 1.104, 1.105
sys/dev/dksubr.c: revision 1.56
sys/sys/dkio.h: revision 1.21
Implement DIOCGMEDIASIZE and DIOCGSECTORSIZE from FreeBSD.
--
clear error for new ioctls.
 1.51.2.2  11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #202):
sys/dev/ccd.c: revision 1.153
sys/dev/ccd.c: revision 1.154
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.313
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.314
sys/dev/ld.c: revision 1.77
sys/dev/vnd.c: revision 1.233
sys/dev/dksubr.c: revision 1.52
sys/dev/dksubr.c: revision 1.53
clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.
 1.51.2.1  11-Nov-2014  martin Pull up following revision(s) (requested by mlelstv in ticket #201):
sbin/dkctl/dkctl.8: revision 1.24
sbin/dkctl/dkctl.8: revision 1.25
sys/dev/scsipi/sd.c: revision 1.310
sys/dev/ata/wd.c: revision 1.415
sbin/dkctl/dkctl.c: revision 1.21
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.315
sys/dev/ld.c: revision 1.78
sys/dev/vnd.c: revision 1.234
sys/dev/dksubr.c: revision 1.54
sys/sys/dkio.h: revision 1.20
sys/dev/dkwedge/dk.c: revision 1.74
Add ioctl to autodiscover wedges.
Implement DIOCMWEDGES ioctl that triggers wedge autodiscovery.
Also fix a reference counting bug and clean up some code.
support DIOCMWEDGES ioctl.
Add 'makewedges' option to autodiscover wedges from a changed label.
New sentence, new line. Bump date for previous.
 1.54.2.10  28-Aug-2017  skrll Sync with HEAD
 1.54.2.9  05-Feb-2017  skrll Sync with HEAD
 1.54.2.8  05-Dec-2016  skrll Sync with HEAD
 1.54.2.7  05-Oct-2016  skrll Sync with HEAD
 1.54.2.6  09-Jul-2016  skrll Sync with HEAD
 1.54.2.5  19-Mar-2016  skrll Sync with HEAD
 1.54.2.4  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.54.2.3  22-Sep-2015  skrll Sync with HEAD
 1.54.2.2  06-Jun-2015  skrll Sync with HEAD
 1.54.2.1  06-Apr-2015  skrll Sync with HEAD
 1.88.2.3  20-Mar-2017  pgoyette Sync with HEAD
 1.88.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.88.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.94.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.96.4.1  02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.97.2.3  05-Apr-2019  msaitoh Pull up following revision(s) (requested by martin in ticket #1223):
sys/sys/dkio.h: revision 1.25
sys/kern/subr_disk.c: revision 1.123
sys/dev/dksubr.c: revision 1.107
sys/dev/ccd.c: revision 1.179
sys/dev/ofw/ofdisk.c: revision 1.53
Add a disk ioctl DIOCRMWEDGES to remove all wedges of a given disk
(if not busy).
 1.97.2.2  26-Nov-2018  snj Pull up following revision(s) (requested by bouyer in ticket #1105):
sys/dev/dksubr.c: revision 1.104
rnd_add_uint32() doens't support concurent calls for the same rnd_source,
call it with dksc->sc_iolock held.
 1.97.2.1  01-Sep-2017  martin Pull up following revision(s) (requested by mlelstv in ticket #261):
sys/dev/sdmmc/ld_sdmmc.c: revision 1.32
sys/dev/sdmmc/ld_sdmmc.c: revision 1.33
sys/dev/sdmmc/ld_sdmmc.c: revision 1.34
sys/dev/sdmmc/sdmmc_mem.c: revision 1.62
sys/dev/i2o/ld_iop.c: revision 1.39
sys/dev/ld.c: revision 1.102
sys/dev/ld.c: revision 1.103
sys/dev/dksubr.c: revision 1.98
sys/dev/dksubr.c: revision 1.99
sys/dev/sdmmc/sdmmcvar.h: revision 1.29
sys/dev/ic/ld_nvme.c: revision 1.17
sys/dev/ldvar.h: revision 1.31
sys/dev/ldvar.h: revision 1.32
sys/dev/ic/ld_cac.c: revision 1.31
sys/dev/pci/ld_virtio.c: revision 1.16
While ld(4) is MP safe, many backends are not.
Add a flag for backends that are MP safe. Take KERNEL_LOCK when calling
into a backend that doesn't have the flag set. Do the same for the
discard routine.
Fixes PR 52462.
Defer sdmmc discard operations to the sdmmc task queue. Fixes a panic
introduced by ld.c r1.102.
validate length for discard operation and split operation when byte length
doesn't fit into 'int'.
make the sc_discard interface for the ld backend asynchronous and
signal completion through new callback lddiscardend. Use a standard
struct buf to pass disk address and range instead of two off_t values.
make lddiscard synchronous again. This is a requirement of the current
ffs discard code.
Initialize error also in the case where len=0, which just succeeds.
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
 1.101.2.4  18-Jan-2019  pgoyette Synch with HEAD
 1.101.2.3  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.101.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.101.2.1  21-May-2018  pgoyette Sync with HEAD
 1.102.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.102.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.102.2.1  10-Jun-2019  christos Sync with HEAD
 1.109.2.3  20-Feb-2025  martin Pull up following revision(s) (requested by jakllsch in ticket #1936):

sys/dev/dksubr.c: revision 1.115

Prevent leakage of 4 bytes of stack data via return of uninitialized b_error.
 1.109.2.2  21-Mar-2020  martin Apply patch, requested by riastradh in ticket #795, to keep ABI compatibility.
 1.109.2.1  21-Mar-2020  martin Pull up following revision(s) (requested by riastradh in ticket #795):

sys/dev/dksubr.c: revision 1.112
sys/arch/xen/xen/xbd_xenbus.c: revision 1.95
sys/dev/scsipi/sd.c: revision 1.328
sys/dev/dkvar.h: revision 1.32
sys/dev/ld.c: revision 1.109
sys/dev/cgd.c: revision 1.120
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.380
sys/dev/ata/wd.c: revision 1.458

Add a flag to dk_dump for virtual disk devices.

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.
 1.112.8.1  17-Apr-2021  thorpej Sync with HEAD.
 1.113.16.2  20-Feb-2025  martin Pull up following revision(s) (requested by jakllsch in ticket #1051):

sys/dev/dksubr.c: revision 1.115

Prevent leakage of 4 bytes of stack data via return of uninitialized b_error.
 1.113.16.1  20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #888):

sys/dev/dksubr.c: revision 1.114

Move the rnd_add_uint32 outside the lock and get rid of dk_done1() suggested
by riastradh@
 1.114.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed