summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
Commit message (Collapse)AuthorAgeFilesLines
...
* KSE Milestone 2julian2001-09-121-7/+7
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Don't dump on the label sector or below. This avoids clobbering thebde2001-08-151-2/+2
| | | | | | | | | | | | | | | | | | | label if the dump device overflaps the label (which is a slight misconfiguration). Dump routines don't use dscheck(), so the normal write protection of the label doesn't help. Reduced some nearby overflow bugs. In disk_dumpcheck(), there was (fatal but fail-safe) overflow on i386's with 4GB of memory, at least if Maxmem was the top page (can this happen?). The fix assumes that the sector size divides PAGE_SIZE (dump routines already assume this). In setdumpdev(), the corresponding overflow occurred with only about 2GB of memory on all machines with 32-bit ints. This allowed setdumpdev() to succeed when it shouldn't have, but then disk_dumpcheck() failed safe later. Except in old versions of FreeBSD like RELENG_3 where there is no disk_dumpcheck(). PR: 28164 (label clobbering part) MFC after: 1 week
* Remove the hack-around for the slice/label code, it didn'tphk2001-05-291-11/+1
| | | | cover the hole.
* The disklabel/slice code is more twisted than I thought. Revert tophk2001-05-281-0/+1
| | | | calling the cdevsw_add() unconditionally.
* Create a general facility for making dev_t's depend on anotherphk2001-05-261-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | dev_t. The dev_depends(dev_t, dev_t) function is for tying them to each other. When destroy_dev() is called on a dev_t, all dev_t's depending on it will also be destroyed (depth first order). Rewrite the make_dev_alias() to use this dependency facility. kern/subr_disk.c: Make the disk mini-layer use dependencies to make sure all relevant dev_t's are removed when the disk disappears. Make the disk mini-layer precreate some magic sub devices which the disk/slice/label code expects to be there. kern/subr_disklabel.c: Remove some now unneeded variables. kern/subr_diskmbr.c: Remove some ancient, commented out code. kern/subr_diskslice.c: Minor cleanup. Use name from dev_t instead of dsname()
* Don't take the detour around devsw() to find out if the proto-cdevswphk2001-05-241-3/+1
| | | | is already initialized.
* Always initialize bio_resid from bio_bcount in the disk mini-layer sophk2001-05-081-1/+1
| | | | that the drivers don't have to do it umpteen times.
* Make the disk mini-layer check for and handle zero-length transfersphk2001-05-061-0/+6
| | | | instead of the underlying drivers.
* Actually biofinish(struct bio *, struct devstat *, int error) is more generalphk2001-05-061-3/+1
| | | | | | than the bioerror(). Most of this patch is generated by scripts.
* Dont call device close and ioctl functions if device has disappeared.sos2001-03-131-2/+5
| | | | Reviewed by: phk
* Don't clone impossible unit numbers for disks.phk2000-12-151-0/+2
|
* Staticize some malloc M_ instances.phk2000-12-081-1/+1
|
* Avoid the modules madness I inadvertently introduced by making thephk2000-09-021-12/+1
| | | | | | | | | | | | | | | | | | cloning infrastructure standard in kern_conf. Modules are now the same with or without devfs support. If you need to detect if devfs is present, in modules or elsewhere, check the integer variable "devfs_present". This happily removes an ugly hack from kern/vfs_conf.c. This forces a rename of the eventhandler and the standard clone helper function. Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include like <sys/queue.h> Remove all #includes of opt_devfs.h they no longer matter.
* Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)phk2000-08-201-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove old DEVFS support fields from dev_t. Make uid, gid & mode members of dev_t and set them in make_dev(). Use correct uid, gid & mode in make_dev in disk minilayer. Add support for registering alias names for a dev_t using the new function make_dev_alias(). These will show up as symlinks in DEVFS. Use makedev() rather than make_dev() for MFSs magic devices to prevent DEVFS from noticing this abuse. Add a field for DEVFS inode number in dev_t. Add new DEVFS in fs/devfs. Add devfs cloning to: disk minilayer (ie: ad(4), sd(4), cd(4) etc etc) md(4), tun(4), bpf(4), fd(4) If DEVFS add -d flag to /sbin/inits args to make it mount devfs. Add commented out DEVFS to GENERIC
* End two weeks of on and off debugging. Fix the crash on the Nthimp2000-07-051-24/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | insertion of a CF card, for random values of N > 1. With these fixes, I've been able to do 100 insert/remove of the cards w/o a crash with lots of system activity going on that in the past would help trigger the crash. The problem: FreeBSD creates dev_t's on the fly as they are needed and never destroys them. These dev_t's point to a struct disk that is used for housekeeping on the disk. When a device goes away, the struct disk pointer becomes a dangling pointer. Sometimes when the device comes back, the pointer will point to the new struct disk (in which case the insertion will work). Other times it won't (especially if any length of time has passed, since it is dependent on memory returned from malloc). The Fix: There is one of these dev_t's that is always correct. The device for the WHOLE_DISK_SLICE is always right. It gets set at create_disk() time. So, the fix is to spend a little CPU time and lookup the WHOLE_DISK_SLICE dev_t and use the si_disk from that in preference to the one that's in the device asking to do the I/O. In addition, we change the test of si_disk == NULL meaning that the dev needed to inherit properties from the pdev to dev->si_disk != pdev->si_disk. This test is a little stronger than the previous test, but can sometimes be fooled into not inheriting. However, the results of this fooling are that the old values will be used, which will generally always be the same as before. si_drv[12] are the only values that are copied that might pose a problem. They tend to change as the si_disk field would change, so it is a hole, but it is a small hole. One could correctly argue that one should replace much of this code with something much much better. I would be on the pro side of that argument. Reviewed by: phk (who also ported the original patch to current) Sponsored by: Timing Solutions
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-1/+1
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-1/+1
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Add 'kern.disks', a sysctl which returns the list of disks fromnbm2000-06-221-0/+29
| | | | | | | disk_enumerate(), space delimited. This allows non-root users to get a list of disks and will simplify libdisk's Disk_Names(). Reviewed by: phk
* Add disk_enumerate() for finding names of disks. Vinum and libh willphk2000-06-151-1/+15
| | | | | | | | | | | | need this RSN. Remove a pointless warning in the root device locating code. Remove the "wd" compatibility name from the "ad" driver. WARNING: If you have not updated to use /dev/wd* in your /etc/fstab and modern bootblocks, it would be a very good idea to do so BEFORE you upgrade your kernel.
* Separate the struct bio related stuff out of <sys/buf.h> intophk2000-05-051-1/+1
| | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter
* Clone the {b|bio}_offset field, and make sure it is always initializedphk2000-04-251-0/+2
| | | | | | | in struct bio. Eventually, bio_offset will probably obsolete the bio_blkno and bio_pblkno fields. Remove the special hack in atapi-cd.c to determine of bio_offset was valid.
* Complete the bio/buf divorce for all code below devfs::strategyphk2000-04-151-11/+11
| | | | | | | | | | Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS
* Move B_ERROR flag to b_ioflags and call it BIO_ERROR.phk2000-04-021-1/+1
| | | | | | | | | | | | | (Much of this done by script) Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED. Move b_pblkno and b_iodone_chain to struct bio while we transition, they will be obsoleted once bio structs chain/stack. Add bio_queue field for struct bio aware disksort. Address a lot of stylistic issues brought up by bde.
* Fixed a null pointer panic for dumpon(8) on a nonexistent device whosebde2000-03-091-0/+2
| | | | | | | driver uses the new disk layer. Reviewed by: phk Approved by: jkh
* Update the ata driver to take more advantage of newbus, thissos2000-02-181-1/+4
| | | | | | | | | | | | | | | | was needed to make attach/detach of devices work, which is needed for the PCCARD support. (PCCARD support is still not working though, more to come on that) Support the CMD646 chip which is used on many alphas, sadly only in WDMA2 mode, as the silicon is broken beyond belief for UDMA modes. Lots of cosmetic fixes here and there. Sorry for the size of this megapatchfromhell but it was not possible otherwise... newbus patches based on work from: dfr (Doug Rabson)
* rename disk_delete() to disk_destroy().phk2000-01-281-1/+1
|
* Also handle zero return from dscheck().phk2000-01-101-1/+1
| | | | PR: 15956
* Don't ignore return value from tsleep().phk1999-12-191-1/+3
| | | | Spotted by: charnier
* Conditionalise unwanted chattyness.jkh1999-11-191-1/+2
|
* Put a lock on the disk structure while we open to avoid races.phk1999-11-061-3/+15
| | | | PR: 14486
* Trim unused options (or #ifdef for undoc options).peter1999-10-111-1/+0
| | | | Submitted by: phk
* be more consistent about passing the whole/raw dev_t to the driverphk1999-10-041-4/+2
|
* In some drivers we use two devices to be able to boot.sos1999-10-021-1/+2
| | | | | | | | | So if si_iosize_max is allready set, dont mess with it.. Also just log the problem with maxphys not being set once. designed by: phk tested by: sos
* Fix a problem relating to si_iosize_max which broke scsi devices.phk1999-10-021-5/+7
|
* Make all slices/partitions correctly inherit si_* fields.phk1999-09-301-6/+13
| | | | Lightly tested by: msmith
* Fix disk_close once more, and better this time.phk1999-09-301-2/+2
| | | | Spotted by: bde
* Test the slices for openness before we close them; doing it the other waymsmith1999-09-301-1/+1
| | | | | | around meant that the higher level close routine never gets called. (phk is on the road; this is a quick fix to get things working and may need more polish)
* Register the right cdevsw on the master device.phk1999-09-131-1/+1
| | | | Detected by: sos
* Bite the bullet and allocate the devsw entry at compile time.phk1999-09-121-20/+14
|
* Use a different tactic when creating the devsw so that disk_create()phk1999-09-121-44/+24
| | | | doesn't need to malloc.
* Changes to centralise the default blocksize behaviour.julian1999-09-091-0/+12
| | | | | | More likely to follow. Submitted by: phk@freebsd.org
* Improve the micro "disk" layer after gaining more experience with it.phk1999-09-011-16/+70
|
* Add micro "disk" layer which should enable us to pull all the slice/labelphk1999-08-291-0/+183
stuff out of the device drivers.
OpenPOWER on IntegriCloud