summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
AgeCommit message (Collapse)Author
2010-08-03Don't attempt to set the read or write caches on usb disks. ItKenneth R Westerback
breaks at least one previously working device, as discovered by naddy@. dlg@ confirmed other kernels also avoid attempting this operation on usb disks. ok dlg@ deraadt@
2010-07-07Pull out disk sort. I committed the wrong version of the diff and itMarco Peereboom
wasn't ok deraadt & dlg.
2010-07-06Enable FIFO IO for sd devices. This time committed against the actual tree.Marco Peereboom
Tested by lots of people during c2k10 ok phessler krw thib
2010-07-03Stop disk on suspend and start it again upon resume. Gets rid of the loudMark Kettenis
click upon suspend that my laptop with ahci(4) has. ok dlg@, ok marco@ on an earlier iteration of this diff
2010-07-01Die struct scsi_device! Die! Instead, save a pointer to the routineKenneth R Westerback
to interpret sense errors. This is initialized to the basic interpretation routine, and specific scsi drivers (sd/st/cd) can replace this with their own. While here kill EJUSTRETURN dance and make more specialized interpretation routines directly call the basic routine if desired. Fixes by matthew@ to my first diff. Most original work by dlg@. ok matthew@ marco@ dlg@
2010-07-01Restore setting xs->bp; fixes ncr(4) on VAX.Matthew Dempsky
ok miod@, krw@
2010-06-30Flush cache before suspend.Mark Kettenis
ok krw@, marco@
2010-06-28Move disk_attach() to the end of the attach functions, at which point theJoel Sing
disk is now ready to handle I/O. ok krw@ dlg@
2010-06-24we cant rely on being able to sleep when dumping, so dont lose theDavid Gwynne
SCSI_NOSLEEP flag on the xs when setting extra flags by oring them in rather than assigning them. from matthew dempsky
2010-06-16Always check both the return value of scsi_do_mode_sense() and theKenneth R Westerback
NULL'ness of the pointer to the actual page data. Fixes a NULL deref when trying to set caching on my ASUS eeePC 1000HE's SD slot. ok dlg@
2010-06-15enable the write cache on disks during attach.David Gwynne
requested by deraadt@ ok krw@ marco@
2010-06-15dont pass the dev_t from the scsi device drivers into the midlayer forDavid Gwynne
ioctl requests, and dont pass the proc pointers around for any ioctl requests in scsi land at all. neither were used, so trim the fat. ok krw@ marco@
2010-06-11Restore an unusual XS_SENSE semantic that inadvertantly got lostKenneth R Westerback
in the great re-write. If the scsi device *_interpret_sense() function returns 0 that means there was no error. Fixes restore(8) problems seen on certain tape drives. Found and fix tested by Percey Piper. Suggestions from Matthew Dempsky. Thanks! ok dlg@
2010-06-02bring back the SDF_WAITING waiting flag while adapters still implementDavid Gwynne
NO_CCB. if sd_buf_done is told that the adapter has no more ccbs via NO_CCB, this sets a flag so sdstart doesnt try and queue more io straight away. this fixes the lockups on ciss that halex and okan were experiencing after the iopools code went in. it will fix any other hba that returns NO_CCB too. tested by me@, okan@, and halex@ ok krw@ okan@ halex@
2010-05-26Trying this again. Mixing anoncvs with cvs is _not_ a good idea.Thordur I. Bjornsson
Reintroduce bufqs. A few changes since it was backed out after some good comments from dlg@. No need for a separate bufq.h, keep all of in buf.h; As requested by kittens and deraadt. Only sd(4) and wd(4) for now. The rest of the drivers will be converted soon, also other goodies like heuristics for sd(4) for selecting the bufq type and the death of disksort() are forthcoming. Tested on: i386, amd64, sparc64, macppc, loongson and alpha by myself and phessler. OK art@, beck@, kettenis@, oga@
2010-05-20Simplify new disk cache code so simpler people can understand it.Kenneth R Westerback
No functional change. ok dlg@
2010-05-19remove unused flag.David Gwynne
2010-05-19add an ioctl that allows userland to get or set a disks read and writeDavid Gwynne
caches, and implement handling of these ioctls on vanilla scsi disks. discussed with krw@, marco@, miod@, kettenis@. krw@ has a diff to make the sd.c code prettier coming shortly.
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-04-30unbreak dumps on scsi disks.David Gwynne
discovered by oga@
2010-04-23Recycle unused disklabel fields in order to create a disklabel uniqueJoel Sing
identifier, allowing the disk to be identified without relying on the device name. ok deraadt@ krw@ beck@ marco@ todd@
2010-04-12i snuck fine grained locking into the midlayer as part of all theDavid Gwynne
other stuff ive been doing in here. everything that needs protection inside the midlayer and the scsi device drivers (sd, cd, etc) uses mutexes now. this pushes splbio out of the midlayer. splbio is only taken before biodone is called now. ok beck@ marco@ krw@ deraadt@. theyre all terrified, but they all say if we're going to do then now is the right stage of the dev cycle.
2010-04-06cut sd over to using the new shiny scsi_xsh api. instead of pushing io ontoDavid Gwynne
the disk as soon as it gets any from the block layer, this now registers a callback for when a resource becomes available on the bus. ok krw@ beck@ marco@ tested by many including krw@ beck@ mk@ okan@ todd@
2010-01-15Abstract and merge the manual buf queue manipulating functions intoKenneth R Westerback
one place for easier debugging and maintenance. No intended functional changes. ok dlg@
2010-01-15Restore XS_BUSY delay behaviour for buf i/o. Same as for sync path.Kenneth R Westerback
ok dlg@
2010-01-12dont let the antisemaphore clear the WAITING flag so NO_CCB doesnt causeDavid Gwynne
us to loop forever. follow sdstart through to to an adapters scsi_cmd handler and assume that handler returns NO_CCB to enjoy the bug in full. ok kettenis@ krw@ beck@
2010-01-11dlg@ lost the SCSI_IGNORE_ILLEGAL_REQUEST flag on all SYNCHRONIZE_CACHEKenneth R Westerback
commands. Noticed & fix tested by halex@. ok dlg@
2010-01-11Be as careful with sd/cd buf queue manipulations as was found necessary forKenneth R Westerback
st's queue manipulations. i.e. ensure b_actb is correctly updated as the queue becomes empty or has an i/o requeued on it. Tested on claudio@'s backup crashing box. ok dlg@ beck@
2010-01-11Add mutex around work consuming loop in sdstart - this ensures that onlyBob Beck
one thread will be grabbing xs's at a time and dequeuing work, but avoids a race between notification there is work to do and exiting the loop releasing the xs's. Fixes problem noticed by claudio where usb disks would hang with the new minty dlg midlayer. ok krw@, dlg@, tested by claudio@
2010-01-09dont try to prevent multiple concurrent runs of a devices start routineDavid Gwynne
by setting flags around the loop. there is a race which can prevent necessary work being completed by any of the currently running instances of xxstart. the caveat with the removal of this code is because multiple xxstarts can be running at the same time they can cause io reordering, but that is less of a problem than no io. found by and fix tested by claudio@ debugged with krw@ claudio@ beck@ deraadt@
2010-01-05only call disk_unbusy when we're finished with the io (or we're requeuingDavid Gwynne
it when we hit NO_CCB). retried io would call unbusy twice before this change. noticed by deraadt@
2010-01-04introduce scsi_xs_sync. this will synchronously execute a scsi_xferDavid Gwynne
and do the appropriate sleeps, retries, error processing, and finally returns an errno style value to the caller. this cuts scsi_scsi_cmd, the ioctl code, sd_flush, and scsi_inquiry over to scsi_xs_sync. ok krw@
2009-12-07Re-enable SCSIDEBUG display of commands and data. Original diffKenneth R Westerback
from dlg@, tweaking by me to make it compile. ok dlg@
2009-12-06Nuke SCSI_URGENT after removing its only use, in ncr53c9x.c. That useKenneth R Westerback
was to try to play dangerous games with tagged queuing. ok marco@
2009-12-06consistently refer to the softc pointer as sc, not sd.David Gwynne
2009-12-06biodone must be called at splbio.David Gwynne
2009-12-03prevent a completion interrupt pulling io of the buf queue and shoving itDavid Gwynne
down to the disk while a process is doing the same thing. this will avoid some relatively minor io reordering from occurring. discovered by krw@ during his long dark trek through the code. requested by marco@
2009-12-03set the length of the cdb when synchronising cache.David Gwynne
noticed by deraadt@ and miod@
2009-12-01Mark disk as dirty when starting a write to it. Restores issuing ofKenneth R Westerback
SYNCHRONIZE_CACHE commands on device close. ok dlg@ marco@
2009-12-01properly handle all xs states that can be returned by an adapter in sd.David Gwynne
requested by krw@ after spending a week munging through my code.
2009-12-01put the midlayer changes back in.David Gwynne
the two issues affecting it last time are gone. the first, mishandling of TRY_AGAIN_LATER is not relevant now that krw got rid of TRY_AGAIN_LATER. the second, the misbehaving IBM disk was found to be a problem with siop using ordered tags on most ops combined with the speed of the new code. putting this in so we can move forward. ok krw@ "commit please" marco@
2009-11-12revert midlayer back to it was before i put my big rewrite in. this isDavid Gwynne
causing a weird problems on an alpha and also appears responsible for isp(4) weirdness i havent had a chance to examine yet. sigh, this makes me sad.
2009-11-10fix the NO_CCB handling i broke when working on simplifying the midlayer.David Gwynne
marco@ discovered my rewrite retried commands rejected by an adapter from a timeout, which was trivially starved by normal io going to disks. this diff allows an xs to be marked as XS_NO_CCB, which will cause it to be returned to the device driver to be retried as part of the normal io queue. tested by krw@ marco@ johan@ ok krw@ marco@
2009-11-10backout the backout marco did of my code because of the NO_CCB breakage.David Gwynne
the fix for the NO_CCB breakage will follow shortly. tested by krw@ marco@ johan@ ok krw@ marco@
2009-11-05The big diff dlg committed to the midlayer breaks NO_CCB andMarco Peereboom
TRY_AGAIN_LATER. NO_CCB is a timer based mechanism that can trivially be made to fail by running IO to two or more disks simultaneously. The TRY_AGAIN_LATER thing is more subtle because it now is a permanent failure instead of transient however this is much harder to hit because something must have gone wrong before it hits. ok deraadt krw miod
2009-10-21use _lto8b to calculate 64 bit address. Fixes issue ckuethe saw at 2TBMarco Peereboom
boundary. miod "go for it."
2009-10-13Get rid of devact enum, substitute it with an int and coresponding defines.Paul Irofti
This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
2009-09-14rework the scsi midlayer to start addressing some problems i haveDavid Gwynne
with it which became extremely annoying with what mpath wants to do. the major change is a new interface for submitting scsi commands. previously the only way for drivers like sd, cd, st, etc to push commands onto the hardware was via scsi_scsi_cmd(). the problem with scsi_scsi_cmd is that it doesnt tell the caller if the command failed, was queued, or completed unless you shoved a buf down with it. this is important for mpath which wants to know what the physical path to the device did so it can report it back to the midlayer which called it. this provides a new api which lets drivers like cd/sd/st/mpath etc allocate an xs, fill it in, and provide a completion routine which the midlayer will call with the state of the command when it is finished with it. the caller is then responsible for freeing the xs. from the hba side of thing, the return code from the scsi_cmd entrypoint is largely ignored now, and it is now always the responsibility of the hba driver to call scsi_done when it has completed the io, rather than returning COMPLETE and expecting the midlayer to do it for you. i have emulated scsi_scsi_cmd on top of this new api so existing users of it will continue to work. sd(4) has been reworked to use the new api directly to both demonstrate its use and test that the new api actually does work. this diff was mostly written in a day at f2k9. thanks to miod for poking through hba drivers to help mitigate against fallout from the change to the COMPLETE semantic. this has been reviewed by krw who didnt spot anything wrong. thanks to dave del debbio for testing. ok deraadt@
2009-08-13Replace the error strings that were being passed around with much simplerTheo de Raadt
errnos. Note that the error strings are being ignored, since we long ago decided to not spam the console, and there is no other nice way to use the errors (without changing the ioctls to pass it back) The errno is now useful, since we can pass b_error from failing IO up, and the drive can decide how to use that ok miod
2009-06-17Revert bufq's. this is inline with the major midlayer reverts thatThordur I. Bjornsson
have been going on. this appears to bring us back to stable state. lots of testing by oga and ariane and my self.