1. 02 3月, 2011 1 次提交
  2. 28 1月, 2011 1 次提交
    • T
      libata: set queue DMA alignment to sector size for ATAPI too · 729a6a30
      Tejun Heo 提交于
      ata_pio_sectors() expects buffer for each sector to be contained in a
      single page; otherwise, it ends up overrunning the first page.  This
      is achieved by setting queue DMA alignment.  If sector_size is smaller
      than PAGE_SIZE and all buffers are sector_size aligned, buffer for
      each sector is always contained in a single page.
      
      This wasn't applied to ATAPI devices but IDENTIFY_PACKET is executed
      as ATA_PROT_PIO and thus uses ata_pio_sectors().  Newer versions of
      udev issue IDENTIFY_PACKET with unaligned buffer triggering the
      problem and causing oops.
      
      This patch fixes the problem by setting sdev->sector_size to
      ATA_SECT_SIZE on ATATPI devices and always setting DMA alignment to
      sector_size.  While at it, add a warning for the unlikely but still
      possible scenario where sector_size is larger than PAGE_SIZE, in which
      case the alignment wouldn't be enough.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NJohn Stanley <jpsinthemix@verizon.net>
      Tested-by: NJohn Stanley <jpsinthemix@verizon.net>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      729a6a30
  3. 06 1月, 2011 1 次提交
  4. 18 11月, 2010 1 次提交
  5. 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
  6. 13 11月, 2010 1 次提交
  7. 22 10月, 2010 5 次提交
    • M
      libata: Signal that our SATL supports WRITE SAME(16) with UNMAP · 02e0a604
      Martin K. Petersen 提交于
      Until now identifying that a device supports WRITE SAME(16) with the
      UNMAP bit set has been black magic.  Implement support for the SBC-3
      Thin Provisioning VPD page and set the TPWS bit.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      02e0a604
    • T
      libata: reimplement link power management · 6b7ae954
      Tejun Heo 提交于
      The current LPM implementation has the following issues.
      
      * Operation order isn't well thought-out.  e.g. HIPM should be
        configured after IPM in SControl is properly configured.  Not the
        other way around.
      
      * Suspend/resume paths call ata_lpm_enable/disable() which must only
        be called from EH context directly.  Also, ata_lpm_enable/disable()
        were called whether LPM was in use or not.
      
      * Implementation is per-port when it should be per-link.  As a result,
        it can't be used for controllers with slave links or PMP.
      
      * LPM state isn't managed consistently.  After a link reset for
        whatever reason including suspend/resume the actual LPM state would
        be reset leaving ap->lpm_policy inconsistent.
      
      * Generic/driver-specific logic boundary isn't clear.  Currently,
        libahci has to mangle stuff which libata EH proper should be
        handling.  This makes the implementation unnecessarily complex and
        fragile.
      
      * Tied to ALPM.  Doesn't consider DIPM only cases and doesn't check
        whether the device allows HIPM.
      
      * Error handling isn't implemented.
      
      Given the extent of mismatch with the rest of libata, I don't think
      trying to fix it piecewise makes much sense.  This patch reimplements
      LPM support.
      
      * The new implementation is per-link.  The target policy is still
        port-wide (ap->target_lpm_policy) but all the mechanisms and states
        are per-link and integrate well with the rest of link abstraction
        and can work with slave and PMP links.
      
      * Core EH has proper control of LPM state.  LPM state is reconfigured
        when and only when reconfiguration is necessary.  It makes sure that
        LPM state is reset when probing for new device on the link.
        Controller agnostic logic is now implemented in libata EH proper and
        driver implementation only has to deal with controller specifics.
      
      * Proper error handling.  LPM config failure is attributed to the
        device on the link and LPM is disabled for the link if it fails
        repeatedly.
      
      * ops->enable/disable_pm() are replaced with single ops->set_lpm()
        which takes @policy and @hints.  This simplifies driver specific
        implementation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6b7ae954
    • T
      libata: clean up lpm related symbols and sysfs show/store functions · c93b263e
      Tejun Heo 提交于
      Link power management related symbols are in confusing state w/ mixed
      usages of lpm, ipm and pm.  This patch cleans up lpm related symbols
      and sysfs show/store functions as follows.
      
      * lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and
        MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and
        ATA_LPM_{MIN|MAX|MED}_POWER.
      
      * Pre/postfixes are unified to lpm.
      
      * sysfs show/store functions for link_power_management_policy were
        curiously named get/put and unnecessarily complex.  Renamed to
        show/store and simplified.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c93b263e
    • G
      [libata] support for > 512 byte sectors (e.g. 4K Native) · 295124dc
      Grant Grundler 提交于
      This change enables my x86 machine to recognize and talk to a
      "Native 4K" SATA device.
      
      When I started working on this, I didn't know Matthew Wilcox had
      posted a similar patch 2 years ago:
        http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors
      
      Gwendal Grignou pointed me at the the above code and small portions of
      this patch include Matthew's work. That's why Mathew is first on the
      "Signed-off-by:". I've NOT included his use of a bitmap to determine
      512 vs Native for ATA command block size - just used a simple table.
      And bugs are almost certainly mine.
      
      Lastly, the patch has been tested with a native 4K 'Engineering
      Sample' drive provided by Hitachi GST.
      Signed-off-by: NMatthew Wilcox <matthew.r.wilcox@intel.com>
      Signed-off-by: NGrant Grundler <grundler@google.com>
      Reviewed-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      295124dc
    • G
      [libata] Add ATA transport class · d9027470
      Gwendal Grignou 提交于
      This is a scheleton for libata transport class.
      All information is read only, exporting information from libata:
      - ata_port class: one per ATA port
      - ata_link class: one per ATA port or 15 for SATA Port Multiplier
      - ata_device class: up to 2 for PATA link, usually one for SATA.
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Reviewed-by: NGrant Grundler <grundler@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d9027470
  8. 08 8月, 2010 2 次提交
  9. 02 7月, 2010 1 次提交
    • T
      libata: take advantage of cmwq and remove concurrency limitations · ad72cf98
      Tejun Heo 提交于
      libata has two concurrency related limitations.
      
      a. ata_wq which is used for polling PIO has single thread per CPU.  If
         there are multiple devices doing polling PIO on the same CPU, they
         can't be executed simultaneously.
      
      b. ata_aux_wq which is used for SCSI probing has single thread.  In
         cases where SCSI probing is stalled for extended period of time
         which is possible for ATAPI devices, this will stall all probing.
      
      #a is solved by increasing maximum concurrency of ata_wq.  Please note
      that polling PIO might be used under allocation path and thus needs to
      be served by a separate wq with a rescuer.
      
      #b is solved by using the default wq instead and achieving exclusion
      via per-port mutex.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      ad72cf98
  10. 03 6月, 2010 1 次提交
    • T
      libata: implement on-demand HPA unlocking · d8d9129e
      Tejun Heo 提交于
      Implement ata_scsi_unlock_native_capacity() which will be called
      through SCSI layer when block layer notices that partitions on a
      device extend beyond the end of the device.  It requests EH to unlock
      HPA, waits for completion and returns the current device capacity.
      
      This allows libata to unlock HPA on demand instead of having to decide
      whether to unlock upfront.  Unlocking on demand is safer than
      unlocking by upfront because some BIOSes write private data to the
      area beyond HPA limit.  This was suggested by Ben Hutchings.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Suggested-by: NBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      d8d9129e
  11. 18 5月, 2010 1 次提交
    • T
      libata: kill ATA_FLAG_DISABLED · 3e4ec344
      Tejun Heo 提交于
      ATA_FLAG_DISABLED is only used by drivers which don't use
      ->error_handler framework and is largely broken.  Its only meaningful
      function is to make irq handlers skip processing if the flag is set,
      which is largely useless and even harmful as it makes those ports more
      likely to cause IRQ storms.
      
      Kill ATA_FLAG_DISABLED and makes the callers disable attached devices
      instead.  ata_port_probe() and ata_port_disable() which manipulate the
      flag are also killed.
      
      This simplifies condition check in IRQ handlers.  While updating IRQ
      handlers, remove ap NULL check as libata guarantees consecutive port
      allocation (unoccupied ports are initialized with dummies) and
      long-obsolete ATA_QCFLAG_ACTIVE check (checked by ata_qc_from_tag()).
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      3e4ec344
  12. 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
  13. 26 2月, 2010 1 次提交
  14. 04 2月, 2010 1 次提交
  15. 17 12月, 2009 1 次提交
  16. 05 12月, 2009 1 次提交
    • M
      [SCSI] modify change_queue_depth to take in reason why it is being called · e881a172
      Mike Christie 提交于
      This patch modifies scsi_host_template->change_queue_depth so that
      it takes an argument indicating why it is being called. This will be
      used so that if a LLD needs to do some extra processing when
      handling queue fulls or later ramp ups, it can do so.
      
      This is a simple port of the drivers setting a change_queue_depth
      callback. In the patch I just have these LLDs adjust the queue depth
      if the user was requesting it.
      Signed-off-by: NMike Christie <michaelc@cs.wisc.edu>
      
      [Vasu.Dev: v2
      	Also converted pmcraid_change_queue_depth and then verified
      all modules compile  using "make allmodconfig" for any new build
      warnings on X86_64.
      
      	Updated original description after combing two original
      patches from Mike to make this patch git bisectable.]
      Signed-off-by: NVasu Dev <vasu.dev@intel.com>
      [jejb: fixed up 53c700]
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      e881a172
  17. 04 12月, 2009 2 次提交
  18. 03 12月, 2009 2 次提交
  19. 09 9月, 2009 1 次提交
    • T
      libata: unbreak TPM filtering by reorganizing ata_scsi_pass_thru() · bd30add8
      Tejun Heo 提交于
      ata_scsi_pass_thru() was checking for input sanity and disallowed
      commands while initializaing qc from scmd.  TPM filtering was added
      right after protocol check at which point tf wasn't initialized
      properly.  This means that TPM filtering has never really worked.
      
      This patch fixes the bug by reorganizing ata_scsi_pass_thru() such
      that qc is fully initialized before checking for invalid conditions
      which is way less error prone.
      
      Discovered while Thilo-Alexander Ginkel was trying debug patches for
      bko#13416.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Thilo-Alexander Ginkel <thilo@ginkel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      bd30add8
  20. 02 9月, 2009 2 次提交
  21. 16 5月, 2009 2 次提交
  22. 12 5月, 2009 1 次提交
  23. 11 5月, 2009 1 次提交
    • T
      block: cleanup rq->data_len usages · b0790410
      Tejun Heo 提交于
      With recent unification of fields, it's now guaranteed that
      rq->data_len always equals blk_rq_bytes().  Convert all non-IDE direct
      users to accessors.  IDE will be converted in a separate patch.
      
      Boaz: spotted incorrect data_len/resid_len conversion in osd.
      
      [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Eric Moore <Eric.Moore@lsi.com>
      Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
      Cc: Darrick J. Wong <djwong@us.ibm.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Eric Moore <Eric.Moore@lsi.com>
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      b0790410
  24. 17 4月, 2009 1 次提交
    • A
      ata: Report 16/32bit PIO as best we can · e3cf95dd
      Alan Cox 提交于
      The legacy old IDE ioctl API for this is a bit primitive so we try
      and map stuff sensibly onto it.
      
      - Set PIO over DMA devices to report 32bit
      - Add ability to change the PIO32 settings if the controller permits it
      - Add that functionality into the sff drivers
      - Add that functionality into the VLB legacy driver
      - Turn on the 32bit PIO on the ninja32 and add support there
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      e3cf95dd
  25. 03 2月, 2009 1 次提交
  26. 27 1月, 2009 1 次提交
  27. 16 1月, 2009 1 次提交
  28. 07 1月, 2009 1 次提交
  29. 30 12月, 2008 1 次提交
  30. 29 12月, 2008 1 次提交
    • T
      libata: beef up iterators · 1eca4365
      Tejun Heo 提交于
      There currently are the following looping constructs.
      
      * __ata_port_for_each_link() for all available links
      * ata_port_for_each_link() for edge links
      * ata_link_for_each_dev() for all devices
      * ata_link_for_each_dev_reverse() for all devices in reverse order
      
      Now there's a need for looping construct which is similar to
      __ata_port_for_each_link() but iterates over PMP links before the host
      link.  Instead of adding another one with long name, do the following
      cleanup.
      
      * Implement and export ata_link_next() and ata_dev_next() which take
        @mode parameter and can be used to build custom loop.
      * Implement ata_for_each_link() and ata_for_each_dev() which take
        looping mode explicitly.
      
      The following iteration modes are implemented.
      
      * ATA_LITER_EDGE		: loop over edge links
      * ATA_LITER_HOST_FIRST		: loop over all links, host link first
      * ATA_LITER_PMP_FIRST		: loop over all links, PMP links first
      
      * ATA_DITER_ENABLED		: loop over enabled devices
      * ATA_DITER_ENABLED_REVERSE	: loop over enabled devices in reverse order
      * ATA_DITER_ALL			: loop over all devices
      * ATA_DITER_ALL_REVERSE		: loop over all devices in reverse order
      
      This change removes exlicit device enabledness checks from many loops
      and makes it clear which ones are iterated over in which direction.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      1eca4365
  31. 11 11月, 2008 1 次提交
    • T
      libata: revert convert-to-block-tagging patches · 8a8bc223
      Tejun Heo 提交于
      This patch reverts the following three commits which convert libata to
      use block layer tagging.
      
       43a49cbd
       e013e13b
       2fca5ccf
      
      Although using block layer tagging is the right direction, due to the
      tight coupling among tag number, data structure allocation and
      hardware command slot allocation, libata doesn't work correctly with
      the current conversion.
      
      The biggest problem is guaranteeing that tag 0 is always used for
      non-NCQ commands.  Due to the way blk-tag is implemented and how SCSI
      starts and finishes requests, such guarantee can't be made.  I'm not
      sure whether this would actually break any low level driver but it
      doesn't look like a good idea to break such assumption given the
      frailty of ATA controllers.
      
      So, for the time being, keep using the old dumb in-libata qc
      allocation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jens Axobe <jens.axboe@oracle.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a8bc223