1. 17 11月, 2010 1 次提交
    • J
      SCSI host lock push-down · f281233d
      Jeff Garzik 提交于
      Move the mid-layer's ->queuecommand() invocation from being locked
      with the host lock to being unlocked to facilitate speeding up the
      critical path for drivers who don't need this lock taken anyway.
      
      The patch below presents a simple SCSI host lock push-down as an
      equivalent transformation.  No locking or other behavior should change
      with this patch.  All existing bugs and locking orders are preserved.
      
      Additionally, add one parameter to queuecommand,
      	struct Scsi_Host *
      and remove one parameter from queuecommand,
      	void (*done)(struct scsi_cmnd *)
      
      Scsi_Host* is a convenient pointer that most host drivers need anyway,
      and 'done' is redundant to struct scsi_cmnd->scsi_done.
      
      Minimal code disturbance was attempted with this change.  Most drivers
      needed only two one-line modifications for their host lock push-down.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      Acked-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  2. 23 10月, 2010 3 次提交
  3. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  4. 03 3月, 2010 1 次提交
    • A
      usb-storage: use max_hw_sectors instead of max_sectors · 49d6271b
      Alan Stern 提交于
      This patch (as1347) makes some adjustments to the way usb-storage
      handles the request-queue parameters.
      
      USB host controllers are able to handle arbitrarily long
      scatter-gather lists, since they are limited only by main memory and
      not by the controller hardware.  Hence the sg_tablesize field in the
      host template can be increased to the maximum value.
      
      Drivers like usb-storage aren't supposed to touch the queue's
      max_sectors parameter; instead they are supposed to use the
      max_hw_sectors value.  Accordingly, the patch replaces calls of
      queue_max_sectors() with calls of queue_max_hw_sectors().  Oddly
      enough, the blk_queue_max_sectors() routine is nevertheless still
      appropriate.
      
      The existing code imposes a limit of SCSI_DEFAULT_MAX_SECTORS (1024)
      on the values accepted by the max_sectors attribute file.  There's no
      reason not to accept larger values, so the limit is removed.  (It
      would be nice to change the file's name to max_hw_sectors, but the old
      name is already a well-established API.)
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      49d6271b
  5. 26 2月, 2010 1 次提交
  6. 12 12月, 2009 1 次提交
  7. 23 5月, 2009 1 次提交
  8. 25 3月, 2009 2 次提交
    • A
      usb-storage: prepare for subdriver separation · e6e244b6
      Alan Stern 提交于
      This patch (as1206) is the first step in converting usb-storage's
      subdrivers into separate modules.  It makes the following large-scale
      changes:
      
      	Remove a bunch of unnecessary #ifdef's from usb_usual.h.
      	Not truly necessary, but it does clean things up.
      
      	Move the USB device-ID table (which is duplicated between
      	libusual and usb-storage) into its own source file,
      	usual-tables.c, and arrange for this to be linked with
      	either libusual or usb-storage according to whether
      	USB_LIBUSUAL is configured.
      
      	Add to usual-tables.c a new usb_usual_ignore_device()
      	function to detect whether a particular device needs to be
      	managed by a subdriver and not by the standard handlers
      	in usb-storage.
      
      	Export a whole bunch of functions in usb-storage, renaming
      	some of them because their names don't already begin with
      	"usb_stor_".  These functions will be needed by the new
      	subdriver modules.
      
      	Split usb-storage's probe routine into two functions.
      	The subdrivers will call the probe1 routine, then fill in
      	their transport and protocol settings, and then call the
      	probe2 routine.
      
      	Take the default cases and error checking out of
      	get_transport() and get_protocol(), which run during
      	probe1, and instead put a check for invalid transport
      	or protocol values into the probe2 function.
      
      	Add a new probe routine to be used for standard devices,
      	i.e., those that don't need a subdriver.  This new routine
      	checks whether the device should be ignored (because it
      	should be handled by ub or by a subdriver), and if not,
      	calls the probe1 and probe2 functions.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e6e244b6
    • A
      USB: usb-storage: increase max_sectors for tape drives · 5c16034d
      Alan Stern 提交于
      This patch (as1203) increases the max_sector limit for USB tape
      drives.  By default usb-storage sets max_sectors to 240 (i.e., 120 KB)
      for all devices.  But tape drives need a higher limit, since tapes can
      and do have very large block sizes.  Without the ability to transfer
      an entire large block in a single command, such tapes can't be used.
      
      This fixes Bugzilla #12207.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: NPhil Mitchell <philipm@sybase.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5c16034d
  9. 10 2月, 2009 1 次提交
  10. 08 1月, 2009 4 次提交
    • A
      USB: storage: set CAPACITY_HEURISTICS flag for bad vendors · a81a81a2
      Alan Stern 提交于
      This patch (as1194) makes usb-storage set the CAPACITY_HEURISTICS flag
      for all devices made by Nokia, Nikon, or Motorola.  These companies
      seem to include the READ CAPACITY bug in all of their devices.
      
      Since cell phones and digital cameras rely on flash storage, which
      always has an even number of sectors, setting CAPACITY_HEURISTICS
      shouldn't cause any problems.  Not even if the companies wise up and
      start making devices without the bug.
      
      A large number of unusual_devs entries are now unnecessary, so the
      patch removes them.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a81a81a2
    • A
      USB: storage: add last-sector hacks · 25ff1c31
      Alan Stern 提交于
      This patch (as1189b) adds some hacks to usb-storage for dealing with
      the growing problems involving bad capacity values and last-sector
      accesses:
      
      	A new flag, US_FL_CAPACITY_OK, is created to indicate that
      	the device is known to report its capacity correctly.  An
      	unusual_devs entry for Linux's own File-backed Storage Gadget
      	is added with this flag set, since g_file_storage always
      	reports the correct capacity and since the capacity need
      	not be even (it is determined by the size of the backing
      	file).
      
      	An entry in unusual_devs.h which has only the CAPACITY_OK
      	flag set shouldn't prejudice libusual, since the device will
      	work perfectly well with either usb-storage or ub.  So a
      	new macro, COMPLIANT_DEV, is added to let libusual know
      	about these entries.
      
      	When a last-sector access succeeds and the total number of
      	sectors is odd (the unexpected case, in which guessing that
      	the number is even might cause trouble), a WARN is triggered.
      	The kerneloops.org project will collect these warnings,
      	allowing us to add CAPACITY_OK flags for the devices in
      	question before implementing the default-to-even heuristic.
      	If users want to prevent the stack dump produced by the WARN,
      	they can disable the hack by adding an unusual_devs entry
      	for their device with the CAPACITY_OK flag.
      
      	When a last-sector access fails three times in a row and
      	neither the FIX_CAPACITY nor the CAPACITY_OK flag is set,
      	we assume the last-sector bug is present.  We replace the
      	existing status and sense data with values that will cause
      	the SCSI core to fail the access immediately rather than
      	retry indefinitely.  This should fix the difficulties
      	people have been having with Nokia phones.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      25ff1c31
    • A
      USB: storage: set bounce limit for non-DMA-capable host controllers · 96983d2d
      Alan Stern 提交于
      This patch (as1175) makes usb-storage set a SCSI device's
      request-queue bounce limit such that all buffers will be located in
      addressable memory (i.e., not in high memory) if the host controller's
      dma_mask is NULL.  This is necessary when the host controller doesn't
      support DMA: If a buffer is in high memory then the both the virtual
      and DMA addresses produced by the scatter-gather library will be NULL,
      preventing the HCD from accessing the buffer's data.
      
      In particular, the isp1760 driver needs this when used on a system
      with more than 1 GB of memory.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Tested-by: NThomas Hommel <Thomas.Hommel@gefanuc.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      96983d2d
    • B
      USB: storage devices and SAT · 1537e0ad
      Ben Efros 提交于
      Add the SANE SENSE flag to indicate that a device is capable of handling
      more than 18-bytes of sense data.  This functionality is required for
      USB-ATA bridges implementing SAT.  A future patch will actually enable this
      function for several devices.
      
      The logic behind this is that we can detect support for SANE_SENSE in a few ways:
       1) ATA PASS THROUGH (12) or (16) execute successfully
       2) SPC-3 or higher is in use
       3) A previous CHECK CONDITION occurred with sense format 70-73 and had
          a length greater than 18-bytes total
      Signed-off-by: NBen Efros <ben@pc-doctor.com>
      Signed-off-by: NMatthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      1537e0ad
  11. 22 7月, 2008 4 次提交
    • A
      usb-storage: revert DMA-alignment change for Wireless USB · f756cbd4
      Alan Stern 提交于
      This patch (as1110) reverts an earlier patch meant to help with
      Wireless USB host controllers.  These controllers can have bulk
      maxpacket values larger than 512, which puts unusual constraints on
      the sizes of scatter-gather list elements.  However it turns out that
      the block layer does not provide the support we need to enforce these
      constraints; merely changing the DMA alignment mask doesn't help.
      Hence there's no reason to keep the original patch.  The Wireless USB
      problem will have to be solved a different way.
      
      In addition, there is a reason to get rid of the earlier patch.  By
      dereferencing a pointer stored in the ep_in array of struct
      usb_device, the current code risks an invalid memory access when it
      runs concurrently with device removal.  The members of that array are
      cleared before the driver's disconnect method is called, so it should
      not try to use them.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f756cbd4
    • A
      USB: remove CVS keywords · ea05af61
      Adrian Bunk 提交于
      This patch removes CVS keywords that weren't updated for a long time
      from comments.
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ea05af61
    • A
      usb-storage: change remaining semaphore to completion · 7119e3c3
      Alan Stern 提交于
      This patch (as1090) converts the one remaining semaphore in
      usb-storage into a completion.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7119e3c3
    • A
      usb-storage: separate dynamic flags from fixed flags · 7e4d6c38
      Alan Stern 提交于
      This patch (as1089) separates out the dynamic atomic bitflags and the
      static bitfields in usb-storage.  Until now the two sorts of flags
      have been sharing the same word; this has always been awkward.
      
      To help prevent possible confusion, the two new fields each have a
      different name from the original.  us->fflags contains the fixed
      bitfields (mostly taken from the USB ID table in unusual_devs.h), and
      us->dflags contains the dynamic atomic bitflags (used with set_bit,
      test_bit, and so on).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7e4d6c38
  12. 25 4月, 2008 3 次提交
  13. 26 1月, 2008 1 次提交
  14. 12 1月, 2008 1 次提交
  15. 18 12月, 2007 1 次提交
    • D
      usb-storage: Fix devices that cannot handle 32k transfers · 33abc04f
      Doug Maxey 提交于
      When a device cannot handle the smallest previously limited transfer
      size (64 blocks) without stalling, limit the device to the amount of
      packets that fit in a platform native page.
      
      The lowest possible limit is PAGE_CACHE_SIZE, so if the device is ever
      used on a platform that has larger than 8K pages, you lose unless you
      can convince the device firmware folks to fix the issue.
      
      Cc: Mathew Dharm <mdharm-scsi@one-eyed-alien.net>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NDoug Maxey <dwm@austin.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      33abc04f
  16. 29 11月, 2007 1 次提交
  17. 13 9月, 2007 1 次提交
  18. 13 7月, 2007 2 次提交
    • A
      usb-storage: implement autosuspend · 8dfe4b14
      Alan Stern 提交于
      This patch (as930) implements autosuspend for usb-storage.  It is
      adapted from a patch by Oliver Neukum.  Autosuspend is allowed except
      during LUN scanning, resets, and command execution.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8dfe4b14
    • A
      USB: add reset_resume method · f07600cf
      Alan Stern 提交于
      This patch (as918) introduces a new USB driver method: reset_resume.
      It is called when a device needs to be reset as part of a resume
      procedure (whether because of a device quirk or because of the
      USB-Persist facility), thereby taking over a role formerly assigned to
      the post_reset method.  As a consequence, post_reset no longer needs
      an argument indicating whether it is being called as part of a
      reset-resume.  This separation of functions makes the code clearer.
      
      In addition, the pre_reset and post_reset method return types are
      changed; they now must return an error code.  The return value is
      unused at present, but at some later time we may unbind drivers and
      re-probe if they encounter an error during reset handling.
      
      The existing pre_reset and post_reset methods in the usbhid,
      usb-storage, and hub drivers are updated to match the new
      requirements.  For usbhid the post_reset routine is also used for
      reset_resume (duplicate method pointers); for the other drivers a new
      reset_resume routine is added.  The change to hub.c looks bigger than
      it really is, because mark_children_for_reset_resume() gets moved down
      next to the new hub_reset_resume() routine.
      
      A minor change to usb-storage makes the usb_stor_report_bus_reset()
      routine acquire the host lock instead of requiring the caller to hold
      it already.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      f07600cf
  19. 17 2月, 2007 1 次提交
  20. 08 2月, 2007 1 次提交
  21. 28 9月, 2006 1 次提交
  22. 13 7月, 2006 1 次提交
  23. 22 6月, 2006 1 次提交
  24. 21 3月, 2006 1 次提交
  25. 22 12月, 2005 1 次提交
    • P
      [PATCH] USB Storage: Force starget->scsi_level in usb-storage scsiglue.c · 28120be5
      Paul Walmsley 提交于
      When the usb-storage module forces sdev->scsi_level to SCSI_2, it should
      also force starget->scsi_level to the same value.  Otherwise, the SCSI
      layer may attempt to issue SCSI-3 commands to the device, such as REPORT
      LUNS, which it cannot handle.  This can prevent the device from working
      with Linux.
      
      The AMS Venus DS3 DS2316SU2S SATA-to-SATA+USB enclosure, based on the
      Oxford Semiconductor OXU921S chip, requires this patch to function
      correctly on Linux.  The enclosure reports a SCSI-3 SPC-2 command set
      level, but does not correctly handle the REPORT LUNS SCSI command -
      probably due to a bug in its firmware.
      
      It seems likely that other USB storage enclosures with similar bugs will
      also benefit from this patch.
      
      Tony Lindgren <tony@atomide.com> collaborated in the development of this
      patch.
      Signed-off-by: NPaul Walmsley <paul@booyaka.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      28120be5
  26. 13 9月, 2005 1 次提交
    • M
      [PATCH] USB: storage: Fix messed-up locking · 226173ed
      Matthew Dharm 提交于
      This is patch as550 from Alan Stern.
      
      Apparently someone changed the SCSI core so that it no longer holds the
      host lock when doing a device or bus reset.  usb-storage was updated at
      the time, but the change was done carelessly.  Some of the code depends
      on that lock being held.
      
      This patch reintroduces the host lock where needed and tries to clarify
      the comments explaining why the lock is necessary.  It also moves the
      code that clears the TIMED_OUT and ABORTING bitflags so that it executes
      as soon as the timed-out command has completed (and while the host lock
      is held).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMatthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      226173ed
  27. 09 9月, 2005 1 次提交
  28. 28 6月, 2005 1 次提交